Requests and Responses
Learn more about the general architecture and lifecycle of voice app requests and responses.
Introduction to Voice Interactions
The request and response lifecycle of a voice application has two key concepts:
- Session
- Interaction
Each interaction between a user and a voice application consists of an interaction pair with a request
and a response
.
Request
The request
is the incoming data that the voice platform sends to your app's endpoint. It consists of information like:
and other things that might be relevant to your app. You can access the incoming request with this.$request
.
Logic
The app logic is what happens between an incoming request and sending back a response to the voice platform.
Usually, this includes:
- Routing through intents, states, and variable user input
- Data input and storage
- Other things like business logic and API calls
A great next step to learn more about the Jovo app logic is taking a look at Routing.
Response
The response
is what you send back to the platform after the request
has been run through your app logic. It includes
- Speech output (text or audio URL)
- Visual output to display on screens
- Session data
You can access the incoming request with this.$response
.
Sessions
A session
is an uninterrupted interaction between a user and your application. It consists of at least one request
and response
interaction pair, but can have a series of inputs and outputs. A session can end for the following reasons:
- The response includes
shouldEndSession
, which is true fortell
andendSession
method calls - A user doesn't respond to an ask prompt and the session times out
- The user asks to end the session by saying "quit" or "exit"