DEV Community

Aditya Kushwaha
Aditya Kushwaha

Posted on

This is a submission for the Twilio Challenge

What I Built
I developed an automated reminder system that leverages Twilio's SMS and Voice APIs to send appointment reminders via text messages and voice calls. This system includes basic AI functionality to handle user interactions, such as confirming or rescheduling appointments through SMS and IVR (Interactive Voice Response) calls.

Demo
You can access the app here. Below are some screenshots of the application:

Twilio and AI
I utilized Twilio’s powerful SMS and Voice APIs to build the reminder system:

SMS Reminders: The system uses Twilio’s SMS API to schedule and send automated text message reminders for upcoming appointments.
Voice Call Reminders: Using Twilio’s Voice API, the system schedules and makes automated voice calls to remind users of their appointments. I used TwiML (Twilio Markup Language) to create the call flow, which allows users to confirm or reschedule their appointments during the call.
AI Integration: I integrated the spaCy NLP library to add basic AI capabilities. This allows the system to understand and process user responses such as "yes," "no," "reschedule," and "cancel." The AI component helps in providing a more interactive and user-friendly experience.
Here is a code snippet showcasing the integration:

python
Copy code
from flask import Flask, request
import spacy
import json
from twilio.rest import Client
import requests

app = Flask(name)

Load spaCy model

nlp = spacy.load("en_core_web_sm")

Load config and user data

with open('config.json', 'r') as f:
config = json.load(f)

Twilio configuration

twilio_config = {
"account_sid": config["account_sid"],
"auth_token": config["auth_token"],
"twilio_number": config["twilio_number"]
}

client = Client(twilio_config['account_sid'], twilio_config['auth_token'])

def translate_text(text, target_language):
api_url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=" + target_language
headers = {
'Ocp-Apim-Subscription-Key': '',
'Content-Type': 'application/json'
}
body = [{'text': text}]
response = requests.post(api_url, headers=headers, json=body)
return response.json()[0]['translations'][0]['text']

def personalize_message(user, message_template):
return message_template.format(name=user['name'], time=user['appointment_time'])

@app.route('/handle_voice_response', methods=['POST'])
def handle_voice_response():
# Handle user response from voice call
pass

if name == 'main':
app.run(debug=True)
Additional Prize Categories
This submission qualifies for the following additional prize categories:

Twilio Times Two: This project makes use of both Twilio’s SMS and Voice APIs, providing a robust and flexible reminder system.
Impactful Innovators: The system is designed to reduce the number of missed appointments by providing timely and interactive reminders, potentially benefiting healthcare providers, businesses, and their clients.
Thank you for considering my submission!

Top comments (0)