I am trying to create variable which consists of other variables and some text, how can I do this? It doesn't seem to work when using the following code:

set @content = '{
 "Subscribers": [{"MobileNumber": "1122334455667", "SubscriberKey": "@subscriberKey"}],
 "Subscribe": true,
 "Resubscribe": true,
 "keyword": "TEST",
 "Override": true,
 "messageText": "Test Message!"

1 Answer 1


You will need to use the concat() function, I also tend to not use line breaks inside of AMPscript setting as it usually causes issues with the rendering of the script/content when I do.

See below:

set @content = CONCAT('{"Subscribers": [{"MobileNumber": "1122334455667", "SubscriberKey": "',@subscriberKey,'"}],"Subscribe": true,"Resubscribe": true,  "keyword": "TEST", "Override": true, "messageText": "Test Message!"}')

You must log in to answer this question.

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