3

Can someone please advise me how to use AMPScript with the SMS?

I'd like to use two different contents depending on the field in data extension, which is language. So for example for English clients I'd like to send the message:

Hello, welcome

and for the German one I'd like to send:

Guten morgen.

I want to create one SMS with AMPScript.

2
  • Have you written any of the AMPScript already? If so, please update your question with those details -- even if the code doesn't work. AMPScript in SMS is the same as in an email (with a few exceptions). Commented May 17, 2016 at 18:53
  • Relevant: salesforce.stackexchange.com/questions/75986/… Commented May 17, 2016 at 18:57

1 Answer 1

2

I recently configured this AMPScript. In my example you should have mobile_number and locale as fields of SMS_DataExtension. I set a default message that will be shown when locale is empty.

%%[
var @rows, @row, @rowCount, @locale
set @rows = LookupRows("SMS_DataExtension","Mobile_number", MOBILE_NUMBER)
set @rowCount = rowcount(@rows)

If @rowCount > 0 then
  set @row = row(@rows,1)
  set @locale = field(@row,"Locale")
Endif

IF @locale == "en-GB" then
    Set @msg = "Hello, welcome"
elseif @locale == "de-DE" then 
    Set @msg = "Guten morgen."
else 
    set @msg = "Hello, welcome"
endif 
]%%  
%%=v(@msg)=%%
2
  • This looks interesting. Where exactly would one put this AMPscript? Commented Jun 16, 2020 at 21:06
  • In the SMS message itself @JordanMiguel
    – Mike Marks
    Commented Apr 20, 2021 at 16:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .