Webhook & AWS SQS
With Webhook and AWS SQS integrations, you can take full control over your voice bot sessions. This integration is ideal if your voice bot requires custom handling of conversations and you can build a service to analyze events and generate responses.
Overview
Webhooks and AWS SQS (Amazon Simple Queue Service) are methods that allow the voice bot service to send real-time events to your application. By integrating these, you can:
- Receive updates about the voice session as they happen.
- Process user input and generate dynamic responses.
- Control the conversation flow by sending commands back to the voice bot.
What Are Webhooks?
Webhooks are HTTP callbacks that occur when specific events happen. When the voice bot service detects an event (like a user speaking), it sends an HTTP POST request to your application’s endpoint with details about that event.
What Is AWS SQS?
AWS SQS is a message queuing service that allows applications to send, store, and receive messages between software components. The voice bot service can send event messages to an SQS queue, which your application can read and process.
How It Works
When integrating webhooks or AWS SQS with your voice bot, the communication flow between the user, the voice bot service, and your application typically looks like this:
Events
The voice bot service sends different types of events to inform your application about the session’s state.
transcription
Triggered when the user’s speech is recognized and transcribed.
{
"type": "transcription",
"id": "c40203aa-f4d0-4fa6-be88-9e55ec368655",
"text": "Stop, stop, stop",
"time": 1727340528091
}
reply
Triggered when the user finishes speaking.
{
"type": "reply",
"id": "038a6fc8-a957-4677-b719-21cb7ac2ac2f",
"text": "Stop, stop.",
"startTime": 1727340531211,
"endTime": 1727340533031
}
playback
Triggered when the voice bot starts or finishes speaking a response.
{
"type": "playback",
"text": "Of course! Here’s a short story for you:\n\nOnce upon a time in a small village nestled between rolling hills, there lived a young girl named Lila. Lila had a special gift; she could talk to animals. Every day after school, she would wander into the nearby forest, where she would meet her friends—the birds, rabbits, and even the wise old owl named Oliver.\n\nOne sunny afternoon, Lila discovered that the river running through the forest was drying up. The animals were worried because they relied on the river for water. Lila decided to help her friends. She gathered all the animals and together they brainstormed ideas.\n\nAfter much discussion, they realized that a large pile of fallen branches was blocking the river’s flow. Lila and her animal friends worked together, using their unique skills. The beavers chewed through the branches, the birds flew overhead to scout the area, and Lila directed everyone with her cheerful spirit.\n\nAfter hours of hard work, the river began to flow again, sparkling in the sunlight. The animals cheered, and Lila felt a warm glow of happiness in her heart. From that day on, the forest thrived, and Lila learned that teamwork and friendship could overcome any challenge.\n\nAnd so, Lila and her animal friends continued to explore the forest, always ready for their next adventure.\n\nWhat do you think?",
"replyId": "598f1483-0090-4ec0-ba9e-dd88b52358d1",
"complete": false,
"startTime": 1727340510461,
"endTime": null
}
interruption
Triggered when the user interrupts the bot while it’s speaking.
{
"type": "interruption",
"replyId": "4ff6bdf4-0e91-4d60-adbd-242199b150cd",
"playedText": "Sure, here's a short story for you. Once upon a time in a small village there lived a kindhearted baker named Elara. She was known for her delicious bread and paste, but more importantly, she had a special",
"originalText": "Sure! Here’s a short story for you:\n\nOnce upon a time in a small village, there lived a kind-hearted baker named Elara. She was known for her delicious bread and pastries, but more importantly, she had a special gift: she could make anyone who tasted her baked goods feel happy.\n\nOne day, a traveler named Leo arrived in the village, weary and sad from his long journey. He wandered into Elara's bakery, drawn in by the warm aroma of fresh bread. Elara greeted him with a warm smile and offered him a slice of her famous honey bread.\n\nAs Leo took a bite, a wave of warmth and joy washed over him. He felt lighter, as if the burdens he carried were lifted. Elara noticed the change in his demeanor and asked him about his troubles. Leo shared his story of loss and longing, and Elara listened with compassion.\n\nInspired by his story, Elara decided to bake a special cake for the village festival, dedicating it to all those who had faced hardships. She invited Leo to help her, and together they created a beautiful cake adorned with flowers and fruits.\n\nOn the day of the festival, the villagers gathered to taste Elara's cake. As they enjoyed the sweet treat, laughter and joy filled the air. Leo felt a sense of belonging he hadn’t felt in a long time. \n\nFrom that day on, Leo decided to stay in the village, helping Elara in her bakery. Together, they spread happiness through their baked goods, reminding everyone that even in tough times, a little kindness and a sweet treat can make all the difference.\n\nAnd so, the village thrived, filled with joy, laughter, and the delightful aroma of freshly baked bread.\n\nThe end! What did you think?",
"time": 1727344036109
}
Commands
Your application can control the voice bot by sending commands over HTTP API and SDK.