[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eUser storage allows you to store and retrieve user-specific data across conversations within your Action.\u003c/p\u003e\n"],["\u003cp\u003eYou can write, read, and clear user-stored data through webhook calls using the \u003ccode\u003euser.params\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eReferenced stored values in prompts and conditions using \u003ccode\u003e$user.params.PARAMETER_NAME\u003c/code\u003e and \u003ccode\u003euser.params.PARAMETER_NAME\u003c/code\u003e respectively.\u003c/p\u003e\n"],["\u003cp\u003eData stored in user storage for verified users is subject to their Web & App Activity settings and may expire; for unverified users, it's cleared at the conversation's end.\u003c/p\u003e\n"],["\u003cp\u003eUsers have the ability to view, reset, or completely remove their data stored by your Action.\u003c/p\u003e\n"]]],["User storage allows Actions to retain parameter values across sessions. Data is stored in the `user` object's `params` field during webhook calls, with consent required for certain data. To store, assign values to `conv.user.params.PARAMETER_NAME`; to retrieve, assign `conv.user.params.PARAMETER_NAME` to a variable; to clear, set the value to `null`. Stored values can be referenced in prompts and conditions using `$user.params.PARAMETER_NAME` and `user.params.PARAMETER_NAME`, respectively. Data expiry depends on the user's verification status and settings. Users can also view or clear their user storage data.\n"],null,["In a webhook call, you can store parameter values for a specific user across\nsessions in user storage. Your Action can then use those stored values later in\nprompts and conditions, and your webhook code can access values in user storage\nfor a specific user when necessary.\n\nThe state of user storage is passed in an `app.handle()` request and is stored\nin the [`user`](/assistant/conversational/reference/rest/v1/TopLevel/fulfill#User) object.\n| **Important: Obtain user consent prior to using user storage.** Some\n| countries have regulations that require developers to obtain consent from\n| the user before they can access or save certain information (like personal\n| information) in user storage.\n|\n| If you operate in one of these countries and you want to access or save\n| such information in user storage, you must first ask and obtain\n| consent from the user. Do so by creating a scene that asks for consent and\n| matches intents for *yes* and *no* responses.\n\nRead and write data across conversations\n\nTo update or set a new value in user storage, assign the value to the `params`\nfield of the `user` object in a webhook call. The following example sets\n\"exampleColor\" to \"red\" in user storage: \n\nNode.js \n\n```javascript\n// Assign color to user storage\napp.handle('storeColor', conv =\u003e {\n let color = 'red';\n conv.user.params.exampleColor = color;\n});\n \n```\n\nJSON \n\n```text\n{\n \"responseJson\": {\n \"session\": {\n \"id\": \"1234567890123456789\",\n \"params\": {}\n },\n \"prompt\": {\n \"override\": false\n },\n \"user\": {\n \"locale\": \"en-US\",\n \"params\": {\n \"verificationStatus\": \"VERIFIED\",\n \"exampleColor\": \"red\"\n }\n }\n }\n}\n \n```\n\nTo access data stored in user storage, assign it to a variable in a webhook\ncall. The following example retrieves a value from \"exampleColor\" in user\nstorage: \n\nNode.js \n\n```javascript\n// Retrieve color from user storage\napp.handle('getStoredColor', conv =\u003e {\n let color = conv.user.params.exampleColor;\n});\n \n```\n\nJSON \n\n```text\n{\n \"responseJson\": {\n \"session\": {\n \"id\": \"1234567890123456789\",\n \"params\": {}\n },\n \"prompt\": {\n \"override\": false\n },\n \"user\": {\n \"locale\": \"en-US\",\n \"params\": {\n \"verificationStatus\": \"VERIFIED\",\n \"exampleColor\": \"red\"\n }\n }\n }\n}\n \n```\n\nTo clear a previously saved value, set the value to `null` in a webhook call.\nThe following example clears the value of \"exampleColor\" in user storage: \n\nNode.js \n\n```javascript\n// Clear color from user storage\napp.handle('clearStoredColor', conv =\u003e {\n conv.user.params.exampleColor = null;\n});\n \n```\n\nJSON \n\n```text\n{\n \"responseJson\": {\n \"session\": {\n \"id\": \"1234567890123456789\",\n \"params\": {}\n },\n \"prompt\": {\n \"override\": false\n },\n \"user\": {\n \"locale\": \"en-US\",\n \"params\": {\n \"verificationStatus\": \"VERIFIED\"\n }\n }\n }\n}\n \n```\n\nReference stored values within prompts\n\nYou can reference values stored in user storage in a [prompt](/assistant/conversational/prompts). To reference the\nvalue, use `$user.params.`\u003cvar translate=\"no\"\u003ePARAMETER_NAME\u003c/var\u003e syntax, where\n\u003cvar translate=\"no\"\u003ePARAMETER_NAME\u003c/var\u003e is the name given in the webhook when the\nparameter was set.\n\nFor example, you previously stored a color value in user storage as the\nparameter `exampleColor`. To access that value in a prompt, you reference that\nvalue using `$user.params.exampleColor`: \n\nJSON \n\n```gdscript\n{\n \"candidates\": [{\n \"first_simple\": {\n \"variants\": [{\n \"speech\": \"Your favorite color is $user.params.exampleColor.\"\n }]\n }\n }]\n}\n \n```\n\nReference stored values within conditions\n\nYou can also reference values stored in user storage in [conditions](/assistant/conversational/conditions). To\nreference the value, use the `user.params.`\u003cvar translate=\"no\"\u003ePARAMETER_NAME\u003c/var\u003e\nsyntax, where \u003cvar translate=\"no\"\u003ePARAMETER_NAME\u003c/var\u003e is the name given in the\nwebhook when the parameter was set.\n\nFor example, you previously stored a color value in user storage as the\nparameter `exampleColor`, and you want to match it with the value \"red\" in a\ncondition. In your condition, you reference the stored value using\n`user.params.exampleColor`. Your condition expression then looks like this: \n\nCondition syntax \n\n```text\nuser.params.exampleColor == \"red\"\n \n```\n\nExpiration of user storage data\n\nFor verified users, data stored in user storage expires based on their\n[Web \\& App Activity](https://support.google.com/googlenest/answer/7382500) settings and can also be cleared by the Action itself.\nFor users who aren't verified, Assistant clears the contents of user storage at\nthe end of the conversation.\n\nActions on Google sets the user's verification status at the start of each\nconversation based on a variety of indicators when the conversation starts. As\none example, a user logged in to Google Assistant on their mobile device has a\nverification status of `VERIFIED`.\n\nThe following are possible reasons for a user to have a verification status of\n`GUEST`:\n\n- The user has [personal results](https://support.google.com/googlehome/answer/7684543) turned off.\n- The user disabled their [Web \\& App Activity](https://support.google.com/googlenest/answer/7382500). Keep in mind that some users may have this setting disabled at the domain level.\n- If a device has Voice Match enabled, and the match fails or the user invokes the Assistant without using their voice (such as a long press on a Nest Home device).\n- The user isn't signed in.\n\nAlways check the user's verification status before storing data with user\nstorage to prevent guest users from interacting with a feature that will fail\nfor them.\n\nVisibility to users\n\nAs a user, you can view data stored in your user storage for Actions you invoke.\nYou can also remove data stored in your user storage from a specific Action or\nstop the service from remembering you.\n\nTo view your stored data or to stop a service from remembering you, follow these\nsteps:\n\n1. Go to the [Assistant directory](https://assistant.google.com/explore).\n2. Find and select the Action you want to view or clear your user storage for.\n3. Scroll to the bottom of the page:\n - To view the contents of your user storage, click **\\[View stored data\\]**.\n - To reset data stored in your user storage for the service, click **Reset**.\n - To remove data stored in your user storage and stop the service from remembering you, click **Stop *action_name* from remembering me**."]]