“Hey Google, talk to ExampleAction to check my order.”
“Hey Google,跟 ExampleAction 一起显示今天的特惠活动。”
操作软件包 JSON 文件可能如下所示:
{"actions":[{"name":"MAIN","intent":{"name":"actions.intent.MAIN"},"fulfillment":{"conversationName":"ExampleAction"}},{"name":"BUY","intent":{"name":"com.example.ExampleAction.BUY","parameters":[{"name":"color","type":"org.schema.type.Color"}],"trigger":{"queryPatterns":["find some $org.schema.type.Color:color sneakers","buy some blue suede shoes","get running shoes"]}},"fulfillment":{"conversationName":"ExampleAction"}},{"name":"ORDER_STATUS","intent":{"name":"com.example.ExampleAction.ORDER_STATUS","trigger":{"queryPatterns":["check on my order","see order updates","check where my order is"]}},"fulfillment":{"conversationName":"ExampleAction"}},{"name":"DAILY_DEALS","intent":{"name":"com.example.ExampleAction.DAILY_DEALS","trigger":{"queryPatterns":["hear about daily deals","buying some daily deals","get today's deals"]}},"fulfillment":{"conversationName":"ExampleAction"}}],"conversations":{"ExampleAction":{"name":"ExampleAction","url":"https://www.example.com/ExampleAction"}}}
构建和部署 fulfillment webhook
调用项目中的 Action 时,Actions on Google 会调用
执行方式向用户发起对话以完成 Action。
[null,null,["最后更新时间 (UTC):2025-07-24。"],[[["\u003cp\u003eActions on Google allows you to build custom Actions, extending Google Assistant's functionality through conversational interfaces for various tasks.\u003c/p\u003e\n"],["\u003cp\u003eThe Actions SDK offers a way to develop these Actions, requiring you to define intents, fulfillment logic, and query patterns within an Action package.\u003c/p\u003e\n"],["\u003cp\u003eWhile the Actions SDK is available, using Dialogflow is strongly recommended for a more streamlined development experience, especially for handling natural language understanding (NLU).\u003c/p\u003e\n"],["\u003cp\u003eOnce your Action package and fulfillment are set up, they can be uploaded and managed through the Actions console before submitting for review and release to users.\u003c/p\u003e\n"]]],["Actions on Google utilizes *Actions* to extend Google Assistant's functionality. Developers use the Actions SDK and the `gactions` CLI to create *Action packages*, which map user *intents* to *fulfillments*. Intents, triggered by user phrases, define conversation entry points. Fulfillment then processes the intent. Developers build and deploy fulfillment webhooks to process user input and respond accordingly. The *Action package* is uploaded to the Actions console, which helps manage and approve the Action.\n"],null,["# Actions SDK overview (Dialogflow)\n\nActions on Google lets you extend the functionality of Google Assistant with\n***Actions***. Actions let users get things done through a conversational interface\nthat can range from a quick command to turn on some lights or a longer\nconversation, such as playing a trivia game.\n\nThe Actions SDK is a method of developing conversation fulfillment without\nusing Dialogflow. When using the Actions SDK, you use an Action package to\nmap intents to their fulfillment. You must also provide query patterns in the\nAction package in order to define example phrases your users might say.\n| **Caution:** Using the Actions SDK requires you to build or provide your own NLU solution. Although both Dialogflow and the Actions SDK are covered in the custom Actions documentation, we **highly** recommend using Dialogflow. The development experience changes significantly for Conversational Actions depending on what you use for conversation fulfillment.\n\ngactions CLI\n------------\n\nWhen developing with the Actions SDK, you use the `gactions` command line\ninterface (CLI) to test and update your Actions project. The [`gactions` CLI](/assistant/df-asdk/actions-sdk/gactions-cli)\nalso helps you create and manage the Action package for your Conversational Action.\n\nCreate Actions in your Action package\n-------------------------------------\n\nYou create Actions in your Action package by mapping intents to fulfillment.\nAn Action defines an entry point to start conversations with a unique\nidentifier called an *intent*. Intents map to fulfillments, which process the\nintent.\n\nFor example, say you wanted to build a project that contained Actions to\npurchase some goods, check the status of orders, and to show some daily deals.\nYou can define intents that are triggered by saying:\n\n- *\"Hey Google, talk to ExampleAction.\"*\n- *\"Hey Google, talk to ExampleAction to buy some shoes.\"*\n- *\"Hey Google, talk to ExampleAction to check on my order.\"*\n- *\"Hey Google, talk to ExampleAction to show me today's deals.\"*\n\nThe Action package JSON file might look something like this: \n\n {\n \"actions\": [\n {\n \"name\": \"MAIN\",\n \"intent\": {\n \"name\": \"actions.intent.MAIN\"\n },\n \"fulfillment\": {\n \"conversationName\": \"ExampleAction\"\n }\n },\n {\n \"name\": \"BUY\",\n \"intent\": {\n \"name\": \"com.example.ExampleAction.BUY\",\n \"parameters\": [{\n \"name\": \"color\",\n \"type\": \"org.schema.type.Color\"\n }],\n \"trigger\": {\n \"queryPatterns\": [\n \"find some $org.schema.type.Color:color sneakers\",\n \"buy some blue suede shoes\",\n \"get running shoes\"\n ]\n }\n },\n \"fulfillment\": {\n \"conversationName\": \"ExampleAction\"\n }\n },\n {\n \"name\": \"ORDER_STATUS\",\n \"intent\": {\n \"name\": \"com.example.ExampleAction.ORDER_STATUS\",\n \"trigger\": {\n \"queryPatterns\": [\n \"check on my order\",\n \"see order updates\",\n \"check where my order is\"\n ]\n }\n },\n \"fulfillment\": {\n \"conversationName\": \"ExampleAction\"\n }\n },\n {\n \"name\": \"DAILY_DEALS\",\n \"intent\": {\n \"name\": \"com.example.ExampleAction.DAILY_DEALS\",\n \"trigger\": {\n \"queryPatterns\": [\n \"hear about daily deals\",\n \"buying some daily deals\",\n \"get today's deals\"\n ]\n }\n },\n \"fulfillment\": {\n \"conversationName\": \"ExampleAction\"\n }\n }\n ],\n \"conversations\": {\n \"ExampleAction\": {\n \"name\": \"ExampleAction\",\n \"url\": \"https://www.example.com/ExampleAction\"\n }\n }\n }\n\nBuild and deploy a fulfillment webhook\n--------------------------------------\n\nWhen an Action in your project is invoked, Actions on Google calls your\nfulfillment to start a conversation with users to fulfill the Action.\n\nIn every request to your fulfillment webhook, you receive the user input as a\ntext string. To process the intent, you typically parse the text input and\nreturn a response. This back and forth exchange happens until your Action's\nconversation ends.\n\nUpload your Action package\n--------------------------\n\nOnce you [create your Action package](/assistant/df-asdk/actions-sdk/define-actions) and [deploy its fulfillment](/assistant/df-asdk/deploy-fulfillment),\nyou can upload your Action package to the Actions console. The [Actions console](//console.actions.google.com/)\nuses Action projects to group your Conversational Action with metadata like its review\nstatus and display name in the Assistant directory. The project also lets you\ndefine metadata about your Action and manage and track your Action through the\napproval process.\n\nOnce you have a project, you can upload your Action package that defines all\nyour Actions using the [`gactions` CLI](/assistant/df-asdk/actions-sdk/gactions-cli).\n\nSubmit your project for approval and make it available to users\n---------------------------------------------------------------\n\nSamples\n-------\n\nTo explore completed projects, view the Node.js and Java [Actions SDK samples](/assistant/df-asdk/samples/github#actions-sdk)."]]