sessions
Creates, updates, deletes, gets or lists a sessions resource.
Overview
| Name | sessions |
| Type | Resource |
| Id | aws.lex_runtime.sessions |
Fields
The following fields are returned by SELECT queries:
- get_session
| Name | Datatype | Description |
|---|---|---|
active_contexts | array | A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the PostContent, PostText, or PutSession operation. You can use a context to control the intents that can follow up an intent, or to modify the operation of your application. |
dialog_action | object | Describes the next action that the bot should take in its interaction with the user and provides information about the context in which the action takes place. Use the DialogAction data type to set the interaction to a specific state, or to return the interaction to a previous state. |
recent_intent_summary_view | array | An array of information about the intents used in the session. The array can contain a maximum of three summaries. If more than three intents are used in the session, the recentIntentSummaryView operation contains information about the last three intents used. If you set the checkpointLabelFilter parameter in the request, the array contains only the intents with the specified label. |
session_attributes | object | Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application. |
session_id | string | A unique identifier for the session. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_session | select | bot_name, bot_alias, user_id, region | checkpointLabelFilter | Returns session information for a specified bot, alias, and user ID. |
put_session | replace | bot_name, bot_alias, user_id, region | Accept | Creates a new session or modifies an existing session with an Amazon Lex bot. Use this operation to enable your application to set the state of the bot. For more information, see Managing Sessions. |
delete_session | delete | bot_name, bot_alias, user_id, region | Removes session information for a specified bot, alias, and user ID. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
bot_alias | string | The alias in use for the bot that contains the session data. |
bot_name | string | The name of the bot that contains the session data. |
region | string | AWS region (default: us-east-1) |
user_id | string | The identifier of the user associated with the session data. |
Accept | string | The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field. If the value is text/plain; charset=utf-8, Amazon Lex returns text in the response. If the value begins with audio/, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify audio/mpeg as the value, Amazon Lex returns speech in the MPEG format. If the value is audio/pcm, the speech is returned as audio/pcm in 16-bit, little endian format. The following are the accepted values: audio/mpeg audio/ogg audio/pcm audio/* (defaults to mpeg) text/plain; charset=utf-8 |
checkpointLabelFilter | string | A string used to filter the intents returned in the recentIntentSummaryView structure. When you specify a filter, only intents with their checkpointLabel field set to that string are returned. |
SELECT examples
- get_session
Returns session information for a specified bot, alias, and user ID.
SELECT
active_contexts,
dialog_action,
recent_intent_summary_view,
session_attributes,
session_id
FROM aws.lex_runtime.sessions
WHERE bot_name = '{{ bot_name }}' -- required
AND bot_alias = '{{ bot_alias }}' -- required
AND user_id = '{{ user_id }}' -- required
AND region = '{{ region }}' -- required
AND checkpointLabelFilter = '{{ checkpointLabelFilter }}'
;
REPLACE examples
- put_session
Creates a new session or modifies an existing session with an Amazon Lex bot. Use this operation to enable your application to set the state of the bot. For more information, see Managing Sessions.
REPLACE aws.lex_runtime.sessions
SET
sessionAttributes = '{{ sessionAttributes }}',
dialogAction = '{{ dialogAction }}',
recentIntentSummaryView = '{{ recentIntentSummaryView }}',
activeContexts = '{{ activeContexts }}'
WHERE
bot_name = '{{ bot_name }}' --required
AND bot_alias = '{{ bot_alias }}' --required
AND user_id = '{{ user_id }}' --required
AND region = '{{ region }}' --required
AND Accept = '{{ Accept}}'
RETURNING
active_contexts,
audio_stream,
content_type,
dialog_state,
encoded_message,
intent_name,
message,
message_format,
session_attributes,
session_id,
slot_to_elicit,
slots;
DELETE examples
- delete_session
Removes session information for a specified bot, alias, and user ID.
DELETE FROM aws.lex_runtime.sessions
WHERE bot_name = '{{ bot_name }}' --required
AND bot_alias = '{{ bot_alias }}' --required
AND user_id = '{{ user_id }}' --required
AND region = '{{ region }}' --required
;