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.

1

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)=%%
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.