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.
- 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
- Copy from example.env and fill in your values
- 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
1. Replace environment variables 2. From command line run, python3 app.py
You can find more documentation on LaML, Relay, and all SignalWire APIs at:
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.