bedstuystrong / automation_prime

0 stars 5 forks source link

Mass texting improvements #27

Open maybejustmaybe opened 3 years ago

maybejustmaybe commented 3 years ago

Mass texting has proven useful for numerous applications; however, the processing of sending a mass test is still quite manual and error prone. We should add some tooling and guardrails around mass texting to enable a self-service model for working groups while avoiding common pitfalls.

My general idea here is that we build a 100% airtable flow for sending out mass texts. We'd use the neighbor profiles table to select folks to reach out to, and a new mass texting table to create "campaigns". A campaign corresponds to a mass text that gets sent out to some number of neighbors, where a neighbor can only be part of one mass texting campaign at a time. On the backend there would be one set of functions for managing campaigns (e.g. assigning neighbors to a campaign), and another function that sends mass texts for in progress campaigns.

Guardrails:

Components:

NOTE that we should only send messages between ~9am and ~8pm

Mass Texting Campaigns Suggested Schema:

Depends on #24

Chrysaora commented 3 years ago

This would be AMAZING. Some quick thoughts/questions:

cubeghost commented 3 years ago

This sounds interesting! Here mostly to brain dump.

First, the script I've been using to send texts: https://github.com/bedstuystrong/firebase-functions/blob/ab/phone-number-api/functions/scripts/send-mass-text-2.js This one has an interactive CLI prompt, confirmation steps, and has a cancellable timeout. It stores some metadata about our "contacts" in the Phone Numbers table of the primary Airtable base- phone number type (from Twilio's lookup API) and human-added tags ("do not contact" etc). This is pretty similar to the neighbor profiles concept, but doesn't attempt to associate a name with a phone number.

Some notes on Twilio pricing. Currently, mass texting costs us around $0.015/text. For the past two campaigns we were a lot more careful with who we texted, and sent messages to about 1000-1500 contacts. In October, when we ran 3 really aggressive campaigns, we spent $200 total just on outbound texts. Because we have a 10 digit number (as opposed to a 5 digit shortcode), we'll probably soon face some new fees for certain carriers as they attempt to regulate SMS spam (unless we can find a way to register as a business with Twilio– I need to open a support ticket w/ them).

  • Monitoring/notifications for unanswered mass texting convos

This would be huge, I've already wanted to add some automation around Twilio Flex tasks and workers (i.e. automatically setting new workers to have a larger task capacity) but haven't had time. This all goes through TaskRouter.

  • Message content (might need to be multiple fields for multi part messages, validate that message is <160 chars)

Right now we don't attempt to send multi-part messages because I haven't been able to verify that sending multiple Notify messages to the same number will send them in the correct order. A useful validation would be whether or not the message encoding conforms to GSM-7 or not like this tool does. Non-GSM segments are much shorter than the 160 characters per GSM segment (modern phones will join the segments automatically anyway but for older phones I don't like to send more than 2 segments).

To answer a specific part of @Chrysaora's question: the main reason Twilio Flex access is bottlenecked right now is because I have to manually enable multitasking when each person joins– if we add automation to handle that it won't be a problem any more :)

Overall, my only general concern is that by making this so self-service, we open back up the possibility that neighbors will end up oversaturated with messages, especially when they haven't opted in. I honestly think some oversight (maybe owned by comms?) might be warranted with such a powerful tool.