Here's what I have - an outbound message with NEXT keyword functionality which is intended to capture the recipient's responses. If the recipient replies with a response that my AMPScript code does not handle, they get a response that says "Invalid response - please type Yes or No". But, at THAT point, the conversation is over and the recipient is no longer interacting with the message (because if they at that point realized they goofed up and then put the right response "Yes" or "No", they get a message that says "Keyword not recognized"). Basically, I want the conversation to continue despite them entering wrong possibilities of answers. Here's my SMS code:
%%[
var @response, @validResponse
set @response = [MSG(0).NOUNS]
if IndexOf(@response, 'yes') > 0 or IndexOf(@response, 'no') > 0 then
set @validResponse = true
]%%
%%[
if @validResponse == true then
UpsertData('Vaccine_Scheduler_Text_Responses', 1, 'MobileNumber', MOBILE_NUMBER, 'InitialResponse', @response)
if IndexOf(@response, 'no') > 0 then
/*UpdateSingleSalesforceObject('Account', ID of object to update, appointment preference, 'Appt no longer needed')
UpdateSingleSalesforceObject('Account', ID of object to update, 'No_Longer_Wants_Vaccine__c', TRUE)*/
]%%
Thank you for your reply. You have reported that you no longer need an appointment. We kindly ask that you provide a reason by replying to this message with one of the numbers below.
1 - Already Received COVID-19 Vaccine Elsewhere
2 - Obtained COVID-19 Vaccine Appointment Elsewhere
3 - No Longer Wish to be Vaccinated
%%[
endif
]%%
%%[
if IndexOf(@response, 'yes') > 0 then
/*UpdateSingleSalesforceObject('Account', ID of object to update, appointment preference, 'Need an appointment')*/
]%%
Thank you for your reply. You will receive an appointment confirmation when you are matched with an available appointment. If at any point you would like to change your response, you may do so from the View/Cancel Appointments screen in the TPHVS.
%%[ endif ]%%
%%[ endif ]%%
%%[ else ]%%
Your response is invalid. Please reply 'yes' or 'no'.
%%[ endif ]%%