Stay organized with collections
Save and categorize content based on your preferences.
A session represents a conversation between a Dialogflow agent and an end-user.
You can create special entities, called session entities, during a session.
Session entities can extend or replace custom entity types
and only exist during the session that they were created for.
All session data, including session entities, is stored by Dialogflow for 20 minutes.
For example, if your agent has a @fruit entity type
that includes "pear" and "grape",
that entity type could be updated to include "apple" or "orange",
depending on the information your agent collects from the end-user.
The updated entity type would have the "apple" or "orange" entity entry
for the rest of the session.
Creating session entities with fulfillment
You can create session entities with
fulfillment.
The
WebhookResponse
type contains a field called sessionEntityTypes
that is used to set session entities.
The following examples show how to set a fruit entity type's
entity entries to apple and orange for the current session.
const{sessionEntitiesHelper}=require('actions-on-google-dialogflow-session-entities-plugin')constapp=dialogflow().use(sessionEntitiesHelper())app.intent('input.welcome',(conv)=>{conv.ask('make your choice: apple or orange?');//Setthefruitsessionentityvaluesto'apple'and'orange'.conv.sessionEntities.add({name:'fruit',entities:[{value:'APPLE_KEY',synonyms:['apple','green apple','crabapple']},{value:'ORANGE_KEY',synonyms:['orange']}]});conv.sessionEntities.send();});
Creating session entities with the API
You create, manage, and update session entities using the
SessionEntityTypes
type.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eSession entities are specialized entities created during a Dialogflow session that can extend or replace existing custom entity types.\u003c/p\u003e\n"],["\u003cp\u003eThese session entities exist only for the duration of the session in which they were created, with all session data stored by Dialogflow for 20 minutes.\u003c/p\u003e\n"],["\u003cp\u003eSession entities can be created using fulfillment, through the \u003ccode\u003eWebhookResponse\u003c/code\u003e type's \u003ccode\u003esessionEntityTypes\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eThe Actions on Google client library includes a Session Entities plugin to simplify the process of creating and managing session entities within your code.\u003c/p\u003e\n"],["\u003cp\u003eSession entities can be created, updated, and managed using the \u003ccode\u003eSessionEntityTypes\u003c/code\u003e, however this method does not work with Google Assistant integration, requiring the fulfillment option.\u003c/p\u003e\n"]]],[],null,["# Session entities\n\nA *session* represents a conversation between a Dialogflow agent and an end-user.\nYou can create special entities, called *session entities*, during a session.\nSession entities can extend or replace custom entity types\nand only exist during the session that they were created for.\nAll session data, including session entities, is stored by Dialogflow for 20 minutes.\n\nFor example, if your agent has a `@fruit` entity type\nthat includes \"pear\" and \"grape\",\nthat entity type could be updated to include \"apple\" or \"orange\",\ndepending on the information your agent collects from the end-user.\nThe updated entity type would have the \"apple\" or \"orange\" entity entry\nfor the rest of the session.\n\nCreating session entities with fulfillment\n------------------------------------------\n\nYou can create session entities with\n[fulfillment](/dialogflow/docs/fulfillment-overview).\nThe\n[`WebhookResponse`](/dialogflow/docs/reference/common-types#webhookresponse)\ntype contains a field called `sessionEntityTypes`\nthat is used to set session entities.\n\nThe following examples show how to set a `fruit` entity type's\nentity entries to `apple` and `orange` for the current session.\n\n### Example WebhookResponse:\n\n```\n{\n \"fulfillmentMessages\": [\n {\n \"text\": {\n \"text\": [\n \"Choose apple or orange\"\n ]\n }\n }\n ],\n \"sessionEntityTypes\":[\n {\n \"name\":\"projects/project-id/agent/sessions/session-id/entityTypes/fruit\",\n \"entities\":[\n {\n \"value\":\"APPLE_KEY\",\n \"synonyms\":[\n \"apple\",\n \"green apple\",\n \"crabapple\"\n ]\n },\n {\n \"value\":\"ORANGE_KEY\",\n \"synonyms\":[\n \"orange\"\n ]\n }\n ],\n \"entityOverrideMode\":\"ENTITY_OVERRIDE_MODE_OVERRIDE\"\n }\n ]\n}\n```\n\n### Example using the Actions on Google client library:\n\nIf you are using the\n[Actions on Google client library](https://github.com/actions-on-google/actions-on-google-nodejs),\nyou can use the [Session Entities plugin](https://github.com/actions-on-google/dialogflow-session-entities-plugin-nodejs).\n\nYour code would look similar to the following: \n\n```gdscript\nconst { sessionEntitiesHelper } = require('actions-on-google-dialogflow-session-entities-plugin')\n\nconst app = dialogflow()\n .use(sessionEntitiesHelper())\n\napp.intent('input.welcome', (conv) =\u003e {\n conv.ask('make your choice: apple or orange?');\n // Set the fruit session entity values to 'apple' and 'orange'.\n conv.sessionEntities.add({\n name: 'fruit',\n entities: [{\n value: 'APPLE_KEY',\n synonyms: [\n 'apple', 'green apple', 'crabapple'\n ]\n }, {\n value: 'ORANGE_KEY',\n synonyms: ['orange']\n }]\n });\n conv.sessionEntities.send();\n});\n```\n\nCreating session entities with the API\n--------------------------------------\n\n| **Note:** Session entity API methods do not work with Google Assistant integration. Use the fulfillment option for Google Assistant integration.\n\nYou create, manage, and update session entities using the\n[`SessionEntityTypes`](/dialogflow/docs/reference/common-types#sessionentitytypes)\ntype."]]