Using SignalWire RELAY you can quickly create a service to send custom text-to-speech calls to any number and use any user input to confirm or deny appointments. You can then receive real-time information about their decisions and redirect their call programatically.
We’ve created a ready to use example that hosts a RELAY Consumer, a call automation app, and a basic javascript web app. The web app has an interface to make calls or send SMS messages to any number with a custom message that gets played as text-to-speech.
If the option to confirm an appointment is selected, a real-time notification is sent and displayed on the web app. If they do not confirm, they are redirected to a number of your choice to reschedule.
This example gives you a template to build call automation around with a variety of different communication methods. You can also use it to integrate your own calendar system or add different options and automations.
You can follow the instructions in the SignalWire Relay Examples repository, or use the instructions below which use a Replit cloud instance you can run in your browser.
Configuring the example
To run this example you will need to create a SignalWire account and buy or verify a SignalWire phone number. You will also need to save an API Token.
Start by opening the Replit instance. Select Fork, or download as .zip to run locally.
In the Replit interface, open the secrets feature. From there, enter in the credentials as they are presented in the .env file. The default destination property is the number that users will be redirected to.
SIGNALWIRE_PROJECT_ID= SIGNALWIRE_TOKEN= CALLER_ID=########### AGENT_NUMBER=########### DEFAULT_DESTINATION=########### REPORTING_URL=http://localhost:8080
Because the consumer will be running in the same instance as the frontend app, there is no need to modify the reporting URL field.
Now that the RELAY Consumer, API, and web app are running we can use the example to make a call.
Type in a phone number and click Send Reminder. This will make a request to the API running in the instance which in turn uses the SignalWire Realtime API to create a Task on the Context 'office'.
Because our Consumer is connected to SignalWire RELAY under that Context, it will receive that Task and make a call. As the call goes through its various stages, they will be logged in real-time.
To better understand, see index.js (the file that contains all the code for the API).
You should also see the consumer.js file where we create a Task client.
Using Tasks and Contexts you can create powerful automations that are distributed across multiple applications and languages. In this example we’re using NodeJS, but RELAY is available in multiple languages such as Go and Python.
Through this example we’ve shown how SignalWire RELAY can be used to create a call notification system with text-to-speech, realtime notifications, call transferring, and interactive options.
All of this can be done with just a few lines of code. By inspecting or modifying the example we’ve provided, its possible to quickly build an automated system to create appointment reminders that integrate with existing platforms.
For example, you could tie in Google or Microsoft Exchange calendar invites and programmatically send out call reminders with the option to redirect to a representative for rescheduling. The ability to receive real-time events of call status can be used to kick off other automations as well, such as notifying all parties that an appointment is being changed.
SignalWire RELAY also enables SMS messaging, so it's possible to send out text confirmations.
If you have any questions while getting started with SignalWire RELAY, stop by our Community Slack or our Forum to connect with our team!