StateVoicesNational / Spoke

mass-contact text/SMS distribution tool
Other
461 stars 402 forks source link

Feature Request: Turn off standard opt-out message #2184

Closed mel-indwng closed 1 month ago

mel-indwng commented 2 years ago

Problem Right now, we are encountering an issue with 21610 errors (attempt to send message to unsubscribed recipient). We identified the cause of this error-- when we receive a message with the keyword "Stop," Twilio will automatically send them an opt-out message. However, this is not viewable by the texter in Spoke, so the texter will opt them out again, sending the standard opt-out message. We then can see that this standard opt-out message is flagged with a 21610 error; since Twilio already opted them out, opting them out again with a message triggers the error.

Solution Right now, when texters click the opt-out button, the standard setting is to send the standard opt-out message. We would like the option to change it so the standard setting is to send no message. This will help prevent texters from sending opt-out messages to people who have already been opted out automatically by Twilio.

Context Our high number of 21610 errors is endangering our ability to text.

crayolakat commented 2 years ago

Thanks for flagging this issue! This would be a useful feature to have in Spoke.

There is also a workaround you can use right now to avoid this issue happening in your Spoke instance.

Enable the auto-optout message handler in your environment variables. When you enable this, if someone responds with one of the following phrases: stop, remove me, remove my name, take me off the/this list, lose my number, don't contact me, delete my number, I opt out, stop2quit, stopall, unsubscribe, cancel, end, quit, Spoke will automatically opt them out without sending them an opt-out message and this person will be removed from the texter's view. Enabling the auto-optout message handler eliminates the risk of the texter sending another opt-out message to someone if they already received one from Twilio.

You can also modify the auto-optout keywords by adding an AUTO_OPTOUT_REGEX_LIST_BASE64 environment variable to only include the phrases that Twilio flags as an opt-out (cancel, end, quit, unsubscribe, stop, stopall), so that your texters can still manually send the standard opt-out message to people who opt out via any other keyword.

Do you think this would work for you? Let me know if you have any additional questions or need support!

mel-indwng commented 2 years ago

Thank you so much! We tried implementing this but saw that this did not remove the texts from the texter's view. The recipient did receive an automatic opt-out message, but the texter was still able to view the recipient's message and did not see that automatic opt-out message-- the same problem we had before.

When looking in the environment variables, we saw that we already had MESSAGE_HANDLERS = auto-optout, ngpvan. We tried MESSAGE_HANDLERS = auto-optout, as well as MESSAGE_HANDLERS = auto-optout (not default) according to guidance we found online. We also tried removing this environment variable to see if it would stop the automatic opt-out message from being sent, which it did not.

I was wondering if you know why this might be or if there is another step we would need to take?

On Fri, Jun 17, 2022 at 8:21 PM Kathy Nguyen @.***> wrote:

Thanks for flagging this issue! This would be a useful feature to have in Spoke.

There is also a workaround you can use right now to avoid this issue happening in your Spoke instance.

Enable the auto-optout message handler in your environment variables. When you enable this, if someone responds with one of the following phrases: stop, remove me, remove my name, take me off the/this list, lose my number, don't contact me, delete my number, I opt out, stop2quit, stopall, unsubscribe, cancel, end, quit, Spoke will automatically opt them out and this person will be removed from the texter's view, eliminating the risk of the texter sending another opt-out message to them.

Do you think this would work for you?

— Reply to this email directly, view it on GitHub https://github.com/MoveOnOrg/Spoke/issues/2184#issuecomment-1159316129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZVHKKW3ZSQ55SDKBMCOYD3VPUJARANCNFSM5Y7OLM3A . You are receiving this because you authored the thread.Message ID: @.***>

-- Melinda Wang they/them or she/her Capacity Building Manager New York Civic Engagement Table Schedule a meeting with me https://calendly.com/melinda-nycet

crayolakat commented 2 years ago

@mel-indwng Is Redis enabled in your Spoke instance? If there is an environment variable named REDIS_URL, then that means it probably is. We recently discovered a bug where auto-optout only works if Redis is enabled: https://github.com/MoveOnOrg/Spoke/issues/2186

mel-indwng commented 2 years ago

@crayolakat Thanks so much! It looks like it is. Here is what that looks like:

image

crayolakat commented 2 years ago

Can you try changing the environment variable from REDIS_URI to REDIS_URL?

mel-indwng commented 2 years ago

Yeah! We can't edit the key for that variable. Would it make sense to delete the REDIS_URI variable and create a new one that says REDIS_URL? Or to leave the REDIS_URI one and try one with REDIS_URL as well?

crayolakat commented 2 years ago

Try leaving the REDIS_URI one alone and create a new one that says REDIS_URL and set it to the same value

vcao commented 1 year ago

AUTO_OPTOUT_REGEX_LIST_BASE64

@crayolakat For AUTO_OPTOUT_REGEX_LIST_BASE64, do we need to input the word list in regex or can we just type it in the value field?

crayolakat commented 1 year ago

@vcao You need to input the word list in regex and then encode it to Base64.

For example, here is a regex list: [{"regex": "^\\s*stop\\b|\\bremove me\\s*$|remove my name|\\btake me off th\\w+ list|\\blose my number|don\\W?t contact me|delete my number|I opt out|stop2quit|stopall|^\\s*unsubscribe\\s*$|^\\s*cancel\\s*$|^\\s*end\\s*$|^\\s*quit\\s*$", "reason": "stop"}]

You can test/modify the regex here: https://regex101.com/

Then, I use this website to encode the regex list to Base64: https://www.base64encode.org/

For example, the above example regex list encodes to W3sicmVnZXgiOiAiXlxccypzdG9wXFxifFxcYnJlbW92ZSBtZVxccyokfHJlbW92ZSBteSBuYW1lfFxcYnRha2UgbWUgb2ZmIHRoXFx3KyBsaXN0fFxcYmxvc2UgbXkgbnVtYmVyfGRvblxcVz90IGNvbnRhY3QgbWV8ZGVsZXRlIG15IG51bWJlcnxJIG9wdCBvdXR8c3RvcDJxdWl0fHN0b3BhbGx8Xlxccyp1bnN1YnNjcmliZVxccyokfF5cXHMqY2FuY2VsXFxzKiR8XlxccyplbmRcXHMqJHxeXFxzKnF1aXRcXHMqJCIsICJyZWFzb24iOiAic3RvcCJ9XQ==, so the environment variable would be "AUTO_OPTOUT_REGEX_LIST_BASE64": "W3sicmVnZXgiOiAiXlxccypzdG9wXFxifFxcYnJlbW92ZSBtZVxccyokfHJlbW92ZSBteSBuYW1lfFxcYnRha2UgbWUgb2ZmIHRoXFx3KyBsaXN0fFxcYmxvc2UgbXkgbnVtYmVyfGRvblxcVz90IGNvbnRhY3QgbWV8ZGVsZXRlIG15IG51bWJlcnxJIG9wdCBvdXR8c3RvcDJxdWl0fHN0b3BhbGx8Xlxccyp1bnN1YnNjcmliZVxccyokfF5cXHMqY2FuY2VsXFxzKiR8XlxccyplbmRcXHMqJHxeXFxzKnF1aXRcXHMqJCIsICJyZWFzb24iOiAic3RvcCJ9XQ=="

vcao commented 1 year ago

Thank you so much for spelling it out. For some reason it just clicked the way you stated it. I was not really understanding the documentation and I forgot the Base64 conversion part of it.

On Sat, Oct 15, 2022 at 5:43 PM Kathy Nguyen @.***> wrote:

@vcao https://github.com/vcao You need to input the word list in regex and then encode it to Base64.

For example, here is a regex list: [{"regex": "^\sstop\b|\bremove me\s$|remove my name|\btake me off th\w+ list|\blose my number|don\W?t contact me|delete my number|I opt out|stop2quit|stopall|^\sunsubscribe\s$|^\scancel\s$|^\send\s$|^\squit\s$", "reason": "stop"}]

You can test/modify the regex here: https://regex101.com/

Then, I use this website to encode the regex list to Base64: https://www.base64encode.org/

For example, the above example regex list encodes to W3sicmVnZXgiOiAiXlxccypzdG9wXFxifFxcYnJlbW92ZSBtZVxccyokfHJlbW92ZSBteSBuYW1lfFxcYnRha2UgbWUgb2ZmIHRoXFx3KyBsaXN0fFxcYmxvc2UgbXkgbnVtYmVyfGRvblxcVz90IGNvbnRhY3QgbWV8ZGVsZXRlIG15IG51bWJlcnxJIG9wdCBvdXR8c3RvcDJxdWl0fHN0b3BhbGx8Xlxccyp1bnN1YnNjcmliZVxccyokfF5cXHMqY2FuY2VsXFxzKiR8XlxccyplbmRcXHMqJHxeXFxzKnF1aXRcXHMqJCIsICJyZWFzb24iOiAic3RvcCJ9XQ==, so the environment variable would be "AUTO_OPTOUT_REGEX_LIST_BASE64": "W3sicmVnZXgiOiAiZmFrZXNsdXJ8Yml0Y2h8Ymxvd2pvYnxjdW50fGNvY2t8ZmFnZ290fGZ1Y2sgeW91fFxcYmtpa2VcXGJ8bXkgZGlja3xuaWdnZXJ8cGVkb3BoaWxlfHNoeWxvY2t8XFxic3BpY1xcYnx3aG9yZSIsICJyZWFzb24iOiAiaG9zdGlsZSJ9LCB7InJlZ2V4IjogIlxcYktBR1xcYnxNQUdBfFRydW1wIFRyYWlufFRydW1wMjAyMHxUcnVtcCAyMDIwfF5tYXJ4aXN0JCIsICJyZWFzb24iOiAibWFnYSJ9LCB7InJlZ2V4IjogIl5cXHMqc3RvcFxcYnxcXGJyZW1vdmUgbWVcXHMqJHxyZW1vdmUgbXkgbmFtZXxcXGJ0YWtlIG1lIG9mZiB0aFxcdysgbGlzdHxcXGJsb3NlIG15IG51bWJlcnxkb25cXFc/dCBjb250YWN0IG1lfGRlbGV0ZSBteSBudW1iZXJ8SSBvcHQgb3V0fHN0b3AycXVpdHxzdG9wYWxsfF5cXHMqdW5zdWJzY3JpYmVcXHMqJHxeXFxzKmNhbmNlbFxccyokfF5cXHMqZW5kXFxzKiR8XlxccypxdWl0XFxzKnxzdG9wMmVuZHxzdG9wMiQiLCAicmVhc29uIjogInN0b3AifSwgeyJyZWdleCI6ICJUaGFua3MgZm9yIHRoZSBtZXNzYWdlLiBDb25maWd1cmUgeW91ciBudW1iZXIucyBTTVMgVVJMIHRvIGNoYW5nZSB0aGlzIG1lc3NhZ2UuIiwgInJlYXNvbiI6ICJhdXRvcmVzcG9uZCJ9XQ=="

— Reply to this email directly, view it on GitHub https://github.com/MoveOnOrg/Spoke/issues/2184#issuecomment-1279860796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFJGBTRK2VFY2IY4JDD673WDNFSNANCNFSM5Y7OLM3A . You are receiving this because you were mentioned.Message ID: @.***>

engelhartrueben commented 1 month ago

Please reopen a new issue if this issue persists.