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.


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")

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

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.