1

In MobileConnect 'Unrecognized Keyword Response', the MSG(0).VERB and MSG(0).NOUNS don't seem to work

I'm trying to print the error response as a JSON but when I look at the response, in the key:value pair, the key is gone and the JSON just prints as a single string. However, I dont see this issue in a recognized keyword.

%%[  
    set @json =   
    concat(  
        '{',  
            '"MOBILENUMBER"',':','"',MOBILE_NUMBER,'"',',',  
            '"KEYWORD"',':','"',[MSG(0).VERB],'"',',',  
            '"MSG"',':','"',[MSG(0).NOUNS],'"'  
        '}')  
]%%  
For HELP, call 800.555.1000. %%=v(@json)=%%  

Greatly appreciate any advice... ty!

2

I would recommend not using naked personalization/send context placeholder strings. If for whatever reason they don't exist in the context, they'll cause a runtime error.

The AttributeValue() function returns an empty string if they don't exist. It's a good defensive coding practice to set them with the function and check for empty (or in your case, outputting the values for debugging purposes).

%%[  

  set @mn = AttributeValue("MOBILE_NUMBER")
  set @kw = AttributeValue("MSG(0).VERB")
  set @msg = AttributeValue("MSG(0).NOUNS")
   
]%%  
For HELP, call 800.555.1000. mn: %%=v(@mn)=%% kw: %%=v(@kw)=%% msg: %%=v(@msg)=%%

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.