I'm facing some issues while implementing Two-way SMS unsubscribe/resubscribe using AWS Pinpoint and SNS.
Use Case:
After collecting the user's number, he gets a confirmation SMS. He replies with the YES keyword to opt into the SMS list. He may later opt out by replying with the STOP keyword. After opting out, he still has the option to resubscribe by replying with the START keyword. Furthermore, even after resubscribing, he has an option to unsubscribe again by replying with the STOP keyword, and so on.
Current Implementation:
Similar to the example given in the documentation (https://docs.aws.amazon.com/pinpoint/latest/developerguide/tutorials-two-way-sms.html), I have a lambda function subscribed to the SNS topic which handles the YES and START keywords. Responses to STOP (and HELP) keyword(s) are handled by AWS Pinpoint.
- After collecting the user's number, the backend creates a pinpoint endpoint for the user's number, sends him the confirmation SMS, and updates the endpoint opt-out status to ALL.
- User replies with YES, his reply is handled by the lambda which updates the endpoint opt-out status to NONE.
- User replies with STOP, his reply is handled by pinpoint, which automatically opts him out.
- User replies with START, his reply is handled by the lambda which updates the endpoint opt-out status to NONE.
I need help with the following queries:
- In step 3 of the above implementation, I've noticed that the user's number gets added to the SNS opt-out list (as checked from AWS Console), but his pinpoint endpoint opt-out status (as checked from aws-cli) is still set to NONE instead of ALL. As expected, I am unable to send SMS to this user. Are there two separate opt-out statuses maintained for pinpoint and SNS as I've observed? If yes, is there in-depth documentation regarding how they get updated?
- In step 4 of the above implementation, I've noticed that the user's number does NOT get removed from the SNS opt-out list and his pinpoint endpoint opt-out status remains NONE. Unlike the expected behavior, I am still unable to send SMS to this user. Am I doing the resubscribe implementation correctly?
Please answer the queries and guide me on the correct implementation of my use-case.