Skip to main content

Null value in AMPscript SET expression causes errors in SMS sends via MobileConnect and REST 

 Summary An SMS message containing AMPscript with a SET expression contains an empty or null value: SET @var1= FieldName    This issue is observed when an SMS message send is performed via MobileConnect with FieldName send in API body under templateAttributes. The  issue occurs with an API triggered message created in MobileConnect (e.g. using the REST route POST /sms/v1/messageContact/{id}/send).  However, no error occurs when the same SET expression is used in an Outbound send scheduled in MobileConnect.   Repro:  1. In Mobile Connect Create Message 

2. Select Template Outbound 

3. Enter Message Name 

4. Selct Short/Long Code 

5. Send Method - API Trigger 

6. OutBound Message: %%[ var @codedym     SET @codedym = ActivationCode     ]%% Click here: %%=v(@codedym)=%%  

7. Save and Ativate 

8. Use REST route POST /sms/v1/messageContact/{id}/send 

Body: 

 {   "smsRequest": {  

 "templateName": "TemplateName",   

"recipient": 

{   "number": "0000000000"   

},   

"templateAttributes": {   

"ActivationCode": "ABCD"    

},   

"from": {   

"address": "11111"   

}  

 } 

 }  

9. SMS sent success  

Message recieve on Mobile: Click here:  

The SMS recieved does not have the value from the templateAttributes. 

Expected SMS is: Click here: ABCD  

But the ActivationCode is not delivered in the SMS text.

 

#Marketing Cloud