Send followup SMS to volunteers upon task completion #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the Twilio SMS API library, in order to send volunteers a "Thank You" text message upon task completion.
Airtable Schema Updates
Two new fields are created in the
Requeststable:Followup SMS Sent?: tracks whether the volunteer has been sent a followup text upon task completion.Last modified time: tracks when theStatusfield was last updated. This is necessary to select onlyrequestrecords that have been markedCompletedin the last day, so as to avoid sending a text to all volunteers who have completed a task ever and possibly overloading the system.Dependencies Updates
Two new dependencies are added:
twilio: Twilio API libraryphone: library to normalize mobile numbers into E.164 format, as required by Twilio.Node Environment Variable Updates
Three new environment variables are added:
TWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKENTWILIO_PHONE_NUMBERTesting
In order to test the text message functionality, follow these steps:
Followup SMS Sent?toYesfor all records with aStatusofCompletedrequestrecord, and update the corresponding volunteer's phone number in thevolunteerstable with your personal/testing numberrequestwas completed more than a day ago, change the value ofStatusto one of the other options, then change it back toCompleted. This will updateLast modified timeFollowup SMS Sent?toNofor the most recently completedrequestrecordConsole
Followup SMS