1

I've been working on an alternative solution to using non-keyword responses. I've been able to get that part working, however, when I try adding an AMPscript function to add or update a data extension record, I get an error thrown at me saying "There was an error processing your message".

Here's what I have set up:

Outbound message: "Hi! Would you like to receive more mobile messages? Reply Y or N

%%[
var @nxtkywrd 
set @nxtkywrd = CreateSmsConversation("85240",MOBILE_NUMBER,"Next_Keyword","MOBILECONNECT")
]%% 

Text Response message:

%%[ VAR @message
IF (Uppercase([MSG(0).NOUN(0)]) == "YES") OR (Uppercase([MSG(0).NOUN(0)]) == "Y") THEN
SET @message = "Thank you for consenting to receive messages."
ELSE
SET @message = "Ok, no more messages"
ENDIF ]%%
%%=v(@message)=%%

%%[ VAR @response
SET @response = v([MSG(0).NOUNS])
UpsertData('Data_Extension',1,'Mobile_Phone',MobileNumber,'Text_1_Response',@response)
]%%

The text response works without the UpsertData function. I've tried InsertData, UpdateData, but none seem to work. Any suggestions?

Thanks! Sean

3
  • Cameron, thanks for the suggestion, however, I'm still getting the same error with your approach. I did remove @response from the code since it wasn't getting used but I'm still at a loss for why it's not working. What I'd like to do is store and submit what a user would reply with, whether that's a one word/letter or a short phrase response in a data extension.
    – Sean
    Commented Mar 20, 2017 at 16:37
  • would you be able to share details on "I've been working on an alternative solution to using non-keyword responses. I've been able to get that part working"? We're trying to do this too for a private shortcode and I'd like to ask you some questions about it. Thanks! Kevin Commented Nov 21, 2017 at 16:59
  • Is this resolved ? I came across the same issue and you need to do something like this SET @response2 = UpsertData('Data_Extension',1,'Mobile_Phone',MobileNumber,'Text_1_Response',@response)
    – Johhnytska
    Commented Jan 15, 2020 at 14:17

1 Answer 1

1

You were very close Sean! I was able to get your code working as follows:

%%[
VAR @msg,@response,@inbound
SET @inbound = [MSG(0).NOUN(0)]
IF Uppercase(@inbound) == "YES" OR Uppercase(@inbound) == "Y" THEN
    SET @msg = "Thank you for consenting to receive messages."
    UpsertData('Data_Extension',1,'Mobile_Phone',Mobile_Number,'Text_1_Response',"YES")
ELSE
    SET @msg = "Ok, no more messages"
    UpsertData('Data_Extension',1,'Mobile_Phone',Mobile_Number,'Text_1_Response',"NO")
ENDIF
]%%
%%=v(@msg)=%%

Changes:

  • AMPScript code for the Mobile Number of the customer is "Mobile_Number"
  • You don't need v() inside an AMPScript Block to capture values.
  • Changed the UpsertData function to explicit YES and NO, as it looked like you were capturing subscription flags.

Hopefully this gets you closer to achieving your goal!

2
  • It doesn't work for me. My Text Response message only has this %%[ UpsertData('InnovationDE',1,'phone',Mobile_Number,'last',"Yo Yo") ]%%
    – Maneesh
    Commented May 23, 2017 at 16:45
  • Hi @Maneesh, double check the 'phone' reference in your call - this may need to be 'Mobile_Phone' as in my example above. Also assuming the DE has the field 'last' as a [text] type? Commented May 30, 2017 at 1:54

You must log in to answer this question.

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