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
Requests
table:Followup SMS Sent?
: tracks whether the volunteer has been sent a followup text upon task completion.Last modified time
: tracks when theStatus
field was last updated. This is necessary to select onlyrequest
records that have been markedCompleted
in 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_SID
TWILIO_AUTH_TOKEN
TWILIO_PHONE_NUMBER
Testing
In order to test the text message functionality, follow these steps:
Followup SMS Sent?
toYes
for all records with aStatus
ofCompleted
request
record, and update the corresponding volunteer's phone number in thevolunteers
table with your personal/testing numberrequest
was completed more than a day ago, change the value ofStatus
to one of the other options, then change it back toCompleted
. This will updateLast modified time
Followup SMS Sent?
toNo
for the most recently completedrequest
recordConsole
Followup SMS