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!

1 Answer 1

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)=%%
1
  • Thanks Adam...Using AttributeValue solved the issue.. thanks again, Raj
    – rajpc
    Apr 14, 2021 at 20:30

You must log in to answer this question.

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