x

SignalWire Work is here. A complete office, school, or event venue right in your browser. Sign up for a 30-DAY FREE TRIAL or Learn more.

Snippet: Queue Callback Request

This snippets will show you how to request a callback from a voice call or text message so you can have your customers keep their sanity, while avoiding long hold times by offering this useful option. Customers can call and request a callback by pressing a digit, or they can text message the number and request a callback when the next agent is available.

You will need a machine with Python installed, the SignalWire SDK, a provisioned SignalWire phone number, and optionaly Docker if you decide to run it in a container.

For this demo we will be using Python, but more languages may become available.

  • Python
  • SignalWire SDK
  • SignalWire Phone Number
  • Docker (Optional)
Methods and Endpoints
Endpoint: /text_request_call
Methods: GET OR POST
Endpoint to accept incoming text messages from SignalWire space.
Endpoint: /enter_queue
Methods: GET OR POST
Endpoint to place callers into queue.
Endpoint: /wait_url
Methods: GET OR POST
Endpoint to handle people on hold in queue.
Endpoint: /request_callback
Methods: GET OR POST
Endpoint to process request call back.
Endpoint: /connect_agent
Methods: GET OR POST
Endpoint to connect agent to caller.

Setup Your Environment File

  1. Copy from example.env and fill in your values
  2. Save new file called .env

Your file should look something like this:

## This is the full name of your SignalWire Space. e.g.: example.signalwire.com
SIGNALWIRE_SPACE=
# Your Project ID - you can find it on the `API` page in your Dashboard.
SIGNALWIRE_PROJECT=
#Your API token - you can generate one on the `API` page in your Dashboard
SIGNALWIRE_TOKEN=
# The phone number you'll be using for this Snippets. Must include the `+1` , e.g.: +15551234567
SIGNALWIRE_NUMBER=
Build and Run on Docker

Let's get started!

  • Use our pre-built image from Docker Hub:
For Python:
docker pull signalwire/snippets-queue-request-callback:python
  • Or build your own image:
docker build -t snippets-queue-request-callback .
  • Run your image:
docker run --publish 5000:5000 --env-file .env snippets-queue-request-callback
  • The application will run on port 5000
Build and Run Natively

For Python:

1. Replace environment variables
2. From command line run, python3 app.py
More Documentation

You can find more documentation on LaML, Relay, and all SignalWire APIs at:


Support

If you have any issues or want to engage further about this snippet, please open an issue on this repo or join our fantastic Slack community and chat with others in the SignalWire community!

If you need assistance or support with your SignalWire services please file a support ticket from your Dashboard.