Skip to content

Conversation

@omardeleo
Copy link
Contributor

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.

Screen Shot 2020-07-01 at 7 18 54 PM

  • Last modified time: tracks when the Status field was last updated. This is necessary to select only request records that have been marked Completed 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.

Screen Shot 2020-07-01 at 7 20 21 PM

Dependencies Updates

Two new dependencies are added:

  • twilio: Twilio API library
  • phone: 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:

  • Verify your personal mobile number (or a number for testing) with Twilio
  • In your copy of Airtable, set the value of Followup SMS Sent? to Yes for all records with a Status of Completed
  • Choose the most recently completed request record, and update the corresponding volunteer's phone number in the volunteers table with your personal/testing number
  • If the most recently completed request was completed more than a day ago, change the value of Status to one of the other options, then change it back to Completed. This will update Last modified time
  • Set Followup SMS Sent? to No for the most recently completed request record

Console

Screen Shot 2020-07-01 at 7 48 16 PM

Followup SMS

Screenshot_2020-07-01-19-49-15

Check for Twilio credentials before attempting to send a followup text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant