A session represents a conversation between a Dialogflow agent and an end-user. You create a session at the beginning of a conversation and use it for each turn of the conversation. Once the conversation has ended, you discontinue using the session.
You should not use the same session for concurrent conversations with different end-users. A session remains active and its data is stored for 30 minutes after the last request is sent for the session.
Each session is determined unique by a session ID generated by your system. You create a new session by providing a new session ID in a detect intent request and other session methods. A session ID is a string of at most 36 bytes in size. Your system is responsible for generating unique session IDs. They can be random numbers, hashed end-user identifiers, or any other values that are convenient for you to generate.
Check the Regionalization documentation for information about the Location ID value in the session name.
Currently, Dialogflow doesn't support maintaining session data for longer than
30 minutes. However, you can revive the previous session state by setting
An example workflow looks like:
- End-user talks with the agent under session A.
- Your code records the state associated with session A returned in the API
- End-user stops interacting with the agent after 50 minutes.
- End-user talks with the agent again.
- Your code sends the end-user input, together with the previously recorded
QueryParameters.parametersin the request, to detect intent with the previous session state. You do not need to use the same session ID as used by session A.
For information on session pricing, see the pricing page.
For more information on sessions:
Select a protocol and version for the Session reference:
|REST||Session resource||Session resource|
|RPC||Session interface||Session interface|
|C#||Not available||Not available|
|Go||Not available||Not available|
|PHP||Not available||Not available|
|Ruby||Not available||Not available|