Kể từ ngày 13 tháng 6 năm 2023, Hành động trò chuyện không còn được dùng nữa. Để biết thêm thông tin, hãy xem phần Hành động trò chuyện ngừng hoạt động.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Mô hình gọi chỉ định cách người dùng gọi các Hành động trong dự án của bạn.
Khi người dùng gọi ra một Hành động, họ sẽ bắt đầu một cuộc trò chuyện với Hành động đó, tức là
được xác định theo mô hình cuộc trò chuyện của bạn. Bạn có thể xác định lệnh gọi
theo các cách sau:
Lệnh gọi chính – Đây
là lệnh gọi bắt buộc duy nhất cho dự án Actions của bạn. Người dùng nói một cụm từ
tương tự như "Ok Google, hãy trò chuyện với <display name>" để khớp với ý định này,
mà bạn thường xử lý bằng cách chào người dùng bằng tin nhắn chào mừng.
Lệnh gọi đường liên kết sâu –
Đây là những lệnh gọi không bắt buộc cho phép bạn xác định các cụm từ huấn luyện trong một
đối tượng có ý định tùy chỉnh để người dùng có thể liên kết sâu đến một phần cụ thể của ứng dụng
cuộc trò chuyện. Người dùng có thể nói một cụm từ tương tự như "Ok Google, hãy trò chuyện với
<tên hiển thị> thành <deep link cụm từ>" để khớp với các loại
ý định (ví dụ: "Ok Google, hãy nói với Thông tin về Google để tìm công ty
sự thật")
Ý định tích hợp –
Đây là những lệnh gọi không bắt buộc cho phép bạn tận dụng các lệnh gọi do hệ thống xác định
các mô hình gọi. Bằng cách khai báo tính năng hỗ trợ cho ý định tích hợp, người dùng có thể
khám phá và gọi dự án Actions của bạn mà không cần phải chỉ định
tên hiển thị. Ví dụ: người dùng có thể nói "Ok Google, chơi trò chơi" và
Trợ lý Google có thể hiển thị Hành động của bạn dưới dạng một lựa chọn gọi.
Hình 1. Mô hình lệnh gọi bao gồm mọi ý định
đủ điều kiện để bắt đầu cuộc trò chuyện bằng Hành động của bạn.
Tạo lệnh gọi chính
Mỗi dự án Actions đều có một lệnh gọi chính mặc định đóng vai trò là lệnh gọi mặc định
điểm truy cập vào dự án Actions của bạn.Mô hình ngôn ngữ cho lệnh gọi này
được liên kết với tên hiển thị của dự án, nên người dùng chỉ cần nói
cụm từ tương tự như "Ok Google, hãy trò chuyện với <display name>" để sử dụng
lời gọi. Khi người dùng gọi Hành động của bạn theo cách này, Trợ lý
thời gian chạy khớp với ý định của hệ thống actions.intent.MAIN.
Cách tạo lệnh gọi chính:
Tạo lời gọi liên kết sâu
Để tạo lệnh gọi liên kết sâu, bạn phải tạo ý định chung của người dùng thông qua quá trình huấn luyện
các cụm từ xác định hoạt động đầu vào của người dùng mà bạn muốn thiết lập cho đường liên kết sâu.
Người dùng nói tên hiển thị của bạn cùng với cụm từ đường liên kết sâu sẽ hiển thị
lời gọi liên kết sâu (ví dụ: "Ok Google, nói chuyện với <display
tên> thành <deep link snippet>")
Tạo lời gọi ngầm ẩn
Lời gọi ngầm ẩn cho phép người dùng gọi Hành động của bạn mà không cần sử dụng
tên hiển thị. Để tìm các Hành động phù hợp, Google sử dụng các tín hiệu như người dùng
yêu cầu Trợ lý làm một việc gì đó tương tự như một khẩu lệnh gọi yêu cầu
ý định đã định cấu hình của bạn hoặc khi người dùng đang ở trong bối cảnh mà Hành động của bạn
là phù hợp.
Xử lý sự kiện gọi
Khi Trợ lý khớp với một trong các ý định chung của bạn, Trợ lý sẽ kích hoạt một sự kiện mà bạn
có thể xử lý bằng trình xử lý. Các phần sau đây mô tả những gì trình xử lý của bạn
có thể thực hiện (bạn có thể chọn một hoặc bất kỳ kết hợp nào trong số ba cách).
Kích hoạt webhook
Trình xử lý ý định của bạn có thể uỷ quyền cho một dịch vụ web bằng cách kích hoạt một sự kiện webhook.
Cách kích hoạt webhook và yêu cầu dịch vụ web xử lý lệnh gọi:
Câu lệnh
Trình xử lý ý định của bạn có thể phản hồi bằng một lời nhắc tĩnh. Thông thường, lời nhắc về
ý định gọi ra chào đón người dùng, định hướng cho họ cách sử dụng Hành động, hoặc
phản hồi và cung cấp thông tin mà người dùng cần ngay lập tức (Thao tác một lần).
Cách xử lý việc so khớp ý định gọi bằng lời nhắc:
Chuyển sang một cảnh
Trình xử lý ý định của bạn có thể chuyển đổi sang một cảnh để xử lý lệnh gọi trùng khớp
ý định. Điều này mang lại cho bạn sự linh hoạt nhất để thực hiện logic. Để chuyển sang
một cảnh:
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eActions Builder allows you to define how users initiate conversations with your Actions using an invocation model.\u003c/p\u003e\n"],["\u003cp\u003eYou can use a main invocation, deep link invocations, or built-in intents to enable users to trigger your Actions.\u003c/p\u003e\n"],["\u003cp\u003eWhen an Action is invoked, you can handle the event through webhooks, static prompts, or transitions to specific scenes within your conversation model.\u003c/p\u003e\n"],["\u003cp\u003eDeep link invocations allow users to jump to specific parts of your Action by using targeted phrases in their requests.\u003c/p\u003e\n"],["\u003cp\u003eImplicit invocation allows users to trigger your Action without needing to know your project's display name, relying on contextual cues and system intents.\u003c/p\u003e\n"]]],["Invocation models define how users start conversations with Actions. Key invocation types include: **Main invocation**, triggered by \"Ok Google, talk to [display name]\"; **Deep link invocations**, using custom phrases like \"talk to [display name] to [deep link phrase]\"; and **Built-in intents**, allowing invocation without the display name, such as \"Ok Google, play a game\". Upon invocation, a handler can trigger a webhook, respond with a prompt, or transition to a scene for further logic processing.\n"],null,["# Build invocation models\n\nActions Builder Actions SDK\n\nAn invocation model specifies how users invoke the Actions in your project.\nWhen users invoke an Action, they begin a conversation with it, which is\ndefined by your [conversation model](/assistant/conversational/build/conversation). You can define invocations\nin the following ways:\n\n- [**Main invocation**](/assistant/conversational/build/main-invocation) - This\n is the only required invocation for your Actions project. Users say a phrase\n similar to *\"Ok Google, talk to \\\u003cdisplay name\\\u003e\"* to match this intent,\n which you typically handle by greeting the user with a welcome message.\n\n- [**Deep link invocations**](/assistant/conversational/build/deep-link-invocations) -\n These are optional invocations that let you define training phrases in a\n custom intent, so users can deep link into a specific part of your\n conversation. Users can say a phrase similar to *\"Ok Google, talk to\n \\\u003cdisplay name\\\u003e to \\\u003cdeep link phrase\\\u003e\"* to match these types of\n intents (for example, *\"Ok Google, talk to Facts about Google to get company\n facts\"*)\n\n- [**Built-in intents**](/assistant/conversational/build/built-in-intents) -\n These are optional invocations that let you take advantage of system-defined\n invocation models. By declaring support for a built-in intent, users can\n discover and invoke your Actions project without having to specify your\n display name. For example, users can say *\"Ok Google, play a game\"*, and\n Google Assistant can present your Action as an option for invocation.\n\n**Figure 1.** An invocation model consists of all the intents that are eligible to start conversations with your Actions. **Note:** Only intents that are defined in your invocation model are eligible for matching during invocation. User intents in your [conversation model](#conversation_model) aren't eligible for invocation.\n\nCreate the main invocation\n--------------------------\n\nEvery Actions project has a default, main invocation that acts as the default\nentry point into your Actions project.The language model for this invocation\nis associated with your project's display name, so users just need to say a\nphrase similar to *\"Ok Google, talk to \\\u003cdisplay name\\\u003e\"* to use this\ninvocation. When users invoke your Actions in this manner, the Assistant\nruntime matches the `actions.intent.MAIN` system intent.\n\nTo create the main invocation:\n\nCreate deep link invocations\n----------------------------\n\nTo build deep link invocations, you create global user intents with training\nphrases that define the user input that you want to set for the deep link.\nUsers say your display name in combination with the deep link phrase to carry\nout a deep link invocation (for example, *\"Ok Google, talk to \\\u003cdisplay\nname\\\u003e to \\\u003cdeep link phrase\\\u003e\"*)\n| **Note:** Intents that are associated with deep link invocations are also valid for matching during a conversation.\n\nCreate implicit invocations\n---------------------------\n\n| **Note:** Currently, only the `actions.intent.PLAY_GAME` system intent is supported. You must register for this intent in order to be eligible for implicit invocation if you built a game.\n\nImplicit invocation lets users invoke your Action without using your project's\ndisplay name. To find matching Actions, Google uses signals such as users\ntelling Assistant to do something that's similar to an invocation phrase for one\nof your configured intents, or when the user is in a context where your Actions\nwould be appropriate.\n\nHandle invocation events\n------------------------\n\nWhen Assistant matches one of your global intents, it triggers an event that you\ncan process with a handler. The following sections describe what your handler\ncan carry out (you can choose one or any combination of the three).\n\n### Trigger a webhook\n\nYour intent handler can delegate to a web service by triggering a webhook event.\nTo trigger a webhook and have a web service handle the invocation:\n| **Note:** See the [webhooks](../webhooks) documentation for more information on what you can do in your fulfillment.\n\n### Prompts\n\nYour intent handler can respond with a static prompt. Typically, prompts for\ninvocation intents welcome the user, orient them on how to use the Action, or\nrespond with the information the user needs immediately (one-shot Actions).\n\nTo handle an invocation intent match with a prompt:\n| **Note:** See the [prompts](../prompts) documentation for more information on what you can do with prompts.\n\n### Transition to a scene\n\nYour intent handler can transition to a scene to process the matched invocation\nintent. This gives you the most flexibility to carry out logic. To transition to\na scene:\n| **Note:** See the [scenes](/assistant/conversational/scenes) and [conversation models](/assistant/conversational/build/conversation) documentation for more information on how to build scenes."]]