Build a Call Appointment Reminder using SignalWire RELAY

Using SignalWire RELAY you can quickly create a service to send custom text to speech calls to any number and use user input to confirm or deny appointments. You can then receive realtime information about their decisions and redirect their call programatically.


Using SignalWire RELAY you can quickly create a service to send custom text to speech calls to any number and use user input to confirm or deny appointments. You can then receive realtime information about their decisions and redirect their call programatically.

We’ve created a ready to use example that hosts both a RELAY Consumer, a call automation app, and a basic javascript web app. The web app has an interface to make calls to any number with a custom message that gets played as text to speech. If they press the option to confirm an appointment, a realtime notification is sent and displayed on the web app. If they do not confirm, they are redirected to a number you specify to reschedule.

The purpose of this example to give you a template to build call automation around. Using our example you can integrate your own calendar system or add different options and automations.

You can follow the instructions in the SignalWire Relay Examples repository for this example. Or use the instructions below which use a CodeSandbox cloud instance you can run in your browser.

Prerequisites

To run this example you will need to first create a SignalWire account and a SignalWire Phone Number.

Configuring the example

  1. A SignalWire Project ID and API Token are required to run this example. Follow these intructions to create a new API Token.
  2. Open this CodeSandbox URL. https://codesandbox.io/s/signalwire-v3-dialer-h2jr9z
  3. Click Fork in the top right corner.
  4. In the CodeSandbox file explore, open the .env file.
    Replace all the values with your credentials. The default destination property is the number that users will be redirected to.

Since the consumer will be running in the same instance as the frontend app, there is no need to modify the reporting URL field.

Running the example in CodeSandbox

Once the environment variables are set, refresh the page to restart the sandbox or go to the Server Control Panel menu.


This will restart the API and web app and the consumer using the start script in the package.json file.

Using the example

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 sandbox which in turn uses the SignalWire Realtime API to create a Task on the Context ‘office’. Since 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 realtime.

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.

What next?!

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 realtime 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 its possible to send out text confirmations as well.

Whatever you use SignalWire RELAY for we will always strive to provide the best support and documentation to help you on your journey.

Here at SignalWire, we love our community of developers! Find us on the SignalWire Twitter and be sure to join our SignalWire Community Slack. We’re always happy to help answer questions and we look forward to engaging with you!