This project shows an example of how to build an automated Voice Notification fallback for failed Twilio SMS messages. For users who are unable to receive SMS messages using a phone call to deliver the message and provide businesses with a way to connect with their customers. Leveraging Answering Machine Detection and high quality text to speech models also allows users to leverage visual voicemail to receive the intended message.
In order to test out this project you will need to open a Twilio Account and purchase at least one Twilio Phone Number.
This is an example of how to list things you need to use the software and how to install them.
- Twilio CLI
brew tap twilio/brew && brew install twilio twilio login
Below is an example of how you can instruct your audience on installing and setting up your app. This template doesn't rely on any external dependencies or services.
-
Get a free API Key at https://example.com
-
Clone the repo
git clone https://github.com/mdvickst/voice-notifications
-
Deploy to Twilio Serverless using the CLI
cd voice-notifications twilio serverless:deploy
-
Create Twilio Event Sink using the Function domain created in the previous step
twilio api:events:v1:sinks:create --description "SMS Undelivered Sink" \ --sink-configuration '{"destination":"https://${function_domain}/eventStreamWebhook","method":"POST","batch_events":false}' \ --sink-type webhook
-
Create Event Streams Susbcription using the Sink SID from the previous ttep
twilio api:events:v1:subscriptions:create \ --description "Subscription to SMS undelivered events" \ --sink-sid <sink id validated above DGxxx> \ --types '{"type":"com.twilio.messaging.message.undelivered","schema_version":3}'
Call the sendSMS function with a "To" (subscriber phone number), "From" (your Twilio Phone Number), and "Body" parameters to a number which cannot receive SMS messages or is unsubscribed (texted STOP to your Twilio Number) to test.
curl --location --request POST 'https://voice-notifications-6377-dev.twil.io/sendSMS' \
--header 'Content-Type: application/json' \
--data-raw '{
"From": "+19197377453",
"To": "+17048193222",
"Body": "Hello, your table is ready now. Please proceed to the host stand."
}'
For more examples, please refer to the Documentation
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Mark Vickstrom - [email protected]
Project Link: https://github.com/mdvickst/voice-notifications