Skip to content

HarperDB/twilio-sms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harper + Twilio SMS

A Harper Systems Component for tracking Twilio SMS opt-outs and opt-ins.

Why track SMS Opt-In status?

Twilio recommends tracking your customer's SMS opt out status per carrier and country-based legal compliance regulations regarding messaging:

As a business, you must follow certain guidelines when adding and removing customers from your text message lists to ensure you only send messages customers want and comply with SMS regulations.

Keeping track of your user's status (Twilio official docs)

If you see the OptOutType property in Twilio's request to your application...You may want to store this information, but because Twilio has already sent a confirmation message/reply to your end user, we do not recommend sending another Message back from your application to the end user.

How to use this Component with Twilio

This component offers an easy to use endpoint and storage system to add as your opt-in status tracker. The phonenumber and status is stored in a Harper datatable for easy access. Whether you are sending one-off SMS messages or a text blast you will need to make sure your customers are opted in before sending.

This component listens on inbound SMS for the OptOutType Parameter and subsequently updates the phone number's corresponding status.

How to listen for inbound messages with OptOutType & use this component:

  1. In the Twilio Console, go to Twilio Messaging Services
  2. Select a service and click on Integrations
  3. Select Send a webhook for Incoming Messages
  4. Add https://this-applications-url.com/optInStatus to the Request URL
  5. Make sure to leave it as a POST
  6. Save!
  7. Verify this component is working by texting an opt-in or opt-out keyword to a phone number in the service. This will appear in the Harper datatable PhoneNumbers: accessible either in your Harper Studio UI or via the RESTful API endpoint for PhoneNumbers

Usage

Local Development

Install Harper or run npm i -g harperdb

git clone this repo & cd to it

npm i

npm run dev

Endpoints

Endpoint Description
/optInStatus Supports POST req for inbound Twilio SMS & update optin status
/PhoneNumbers Direct REST interface for the PhoneNumbers table

Deployment

Deploy this Harper component wherever you like: Linode, AWS, GCP, DigitalOcean, on prem

Follow the Harper installation guide on the machine where this will be deployed

About

Harper extension to track and store Twilio SMS opt-outs and opt-ins in a db

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published