1

I was trying to trigger a specific MobileConnect text response keyword which should update a Data extension. When I add some ampscript to the outbound response, I get an error saying "There was an error processing your message".

Any ideas?

%%[ 
Var @message
if (Uppercase(MSG(0).VERB) == "LATER") then 
Set @message = "Thank you"
InsertData('Mobile_Response', 'MobileNumber', MOBILE_NUMBER, 'Keyword', "LATER", 'Response', MSG(0).NOUNS)
else 
Set @message = "Sorry" 
endif
]%% 

%%=v(@message)=%%

2 Answers 2

0

Are you using an outbound message type or text response? You should use a "Text Response" message type so your ampscript can analyze the sms response. I think the issue might be that the term your looking for "LATER" isn't a verb. Also you should try using indexof in front of your IF to evaluate the whole message response. Try the following:

%%[ 
Var @message
if indexof(Uppercase(MSG(0).NOUNS) == "LATER") then 
Set @message = "Thank you"
InsertData('Mobile_Response', 'MobileNumber', MOBILE_NUMBER, 'Keyword', "LATER", 'Response', MSG(0).NOUNS)
else 
Set @message = "Sorry" 
endif
]%% 

%%=v(@message)=%%
2
  • Hi Nate, We are Using Journey builder to send an “Outbound - Interaction” and using a “Text Response ” to collect the reply and adding it to the data extension. We tried your ampscript code but sadly without any luck. Still receiving “There was an error processing your message” after I replied with “LATER”. It might not be an ampscript problem, because even with a simple function (like setting the message variable) we get this error.
    – Alex
    Feb 8, 2019 at 14:37
  • I'd try SET @response = InsertData('Mobile_Response', 'MobileNumber', MOBILE_NUMBER, 'Keyword', "LATER", 'Response', MSG(0).NOUNS)
    – Johhnytska
    Jan 15, 2020 at 14:20
0

I want to make sure I understand. You are using a Text Response message and just trying to evaluate the text sent to you and make a decision off what it is.

Are you using a text response message or the default keyword functionality?

Because if it isn't the keyword setup on the text response then you won't ever hit the alternative on the if statement.

You must log in to answer this question.

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