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.
Dự án Actions sẽ gộp tất cả Hành động của bạn vào một vùng chứa duy nhất. Bạn
xuất bản dự án này lên Actions on Google để Trợ lý Google biết cách khám phá
và gọi ra trải nghiệm trò chuyện của bạn.
Hình 1. Cấu trúc dự án hành động
Bạn sẽ sử dụng các thành phần cấp thấp sau đây để xây dựng dự án Actions:
Phần Cài đặt và tài nguyên xác định siêu dữ liệu của dự án
và các tài nguyên như biểu tượng dự án. Google sử dụng thông tin này để xuất bản
Hành động của bạn sang thư mục Trợ lý để người dùng có thể khám phá và gọi
chúng.
Ý định thể hiện một nhiệm vụ cần thực hiện, chẳng hạn như một số
hoạt động đầu vào của người dùng hoặc một sự kiện của hệ thống cần xử lý. Loại phổ biến nhất
ý định bạn sẽ sử dụng là ý định của người dùng. Các ý định này cho phép bạn khai báo hoạt động huấn luyện
cụm từ được mở rộng tự nhiên bằng NLU (hiểu ngôn ngữ tự nhiên)
để thêm nhiều cụm từ tương tự khác. NLU sử dụng thông tin tổng hợp của
các cụm từ này để huấn luyện một mô hình ngôn ngữ mà Trợ lý sử dụng để khớp với người dùng
đầu vào. Trong một cuộc trò chuyện, nếu một số hoạt động đầu vào của người dùng khớp với ngôn ngữ của ý định
mô hình, môi trường thời gian chạy của Trợ lý sẽ gửi ý định đến Hành động của bạn để Trợ lý có thể
sẽ xử lý dữ liệu đó và phản hồi người dùng.
Loại cho phép bạn trích xuất dữ liệu có cấu trúc từ hoạt động đầu vào của người dùng. Theo
khi chú thích các cụm từ huấn luyện bằng loại, NLU có thể trích xuất các cụm từ có cấu trúc, có liên quan
cho bạn, vì vậy bạn không phải phân tích cú pháp đầu vào mở.
Scenes xử lý ý định và là người thực thi logic chính cho
Hành động của bạn. Chúng có thể lấp đầy chỗ trống, đánh giá logic có điều kiện, trả về
lời nhắc cho người dùng và thậm chí là gọi điện đến các dịch vụ web bên ngoài để thực hiện
logic kinh doanh. Cùng với ý định, các cảnh sẽ mang đến cho bạn một cách hiệu quả để
phát hiện hoạt động đầu vào cụ thể của người dùng hoặc các sự kiện của hệ thống và thực hiện các sự kiện tương ứng
logic.
Lời nhắc xác định phản hồi tĩnh hoặc động mà bạn sử dụng để
trả lời người dùng.
Webhook cho phép bạn uỷ quyền thêm công việc cho các dịch vụ web
(phương thức thực hiện), chẳng hạn như xác thực dữ liệu hoặc tạo câu lệnh. Hành động của bạn
giao tiếp với phương thức thực hiện của bạn thông qua một giao thức webhook dựa trên JSON.
Canvas tương tác giúp bạn tạo quảng cáo
và trải nghiệm phong phú với các ứng dụng web sử dụng HTML, CSS và JavaScript.
Tạo một dự án
Bạn phải tạo một dự án trong bảng điều khiển Actions trước khi có thể phát triển cho
Trợ lý Google. Cách tạo dự án:
Nhập tên cho dự án của bạn rồi nhấp vào Create Project (Tạo dự án).
Trong màn hình Bạn muốn tạo loại hành động nào?, hãy chọn
một danh mục thể hiện tốt nhất dự án của bạn, rồi nhấp vào Tiếp theo.
Trong màn hình Bạn muốn tạo ứng dụng như thế nào, hãy chọn cách tạo
và nhấp vào Bắt đầu xây dựng. Ví dụ: bạn có thể bắt đầu bằng một nhãn trống
dự án hoặc với một mẫu.
Xác định thông tin dự án
Các chế độ cài đặt và tài nguyên của dự án xác định thông tin về dự án của bạn như
hỗ trợ về tính năng và nền tảng, ngôn ngữ được hỗ trợ, tên hiển thị, nội dung mô tả,
biểu trưng và nhiều nội dung khác. Bảng sau đây mô tả các chế độ cài đặt và tài nguyên chính
mà bạn cung cấp. Actions on Google sử dụng thuộc tính này
thông tin để triển khai và xuất bản dự án lên Trợ lý
thư mục.
Tên
Mô tả
Thông tin trong thư mục
Cung cấp thông tin để Actions on Google có thể xuất bản
dự án vào thư mục Trợ lý. Bao gồm siêu dữ liệu và nội dung mô tả chi tiết
về tài nguyên dự án và hình ảnh cho biểu trưng và ảnh biểu ngữ.
Nhắm mục tiêu theo vị trí
Định cấu hình ngôn ngữ mà Hành động của bạn sử dụng.
Khả năng của nền tảng
Định cấu hình các nền tảng hiển thị Hành động của bạn.
Thông tin chi tiết về công ty
Nêu rõ thông tin liên hệ của công ty.
Xác minh thương hiệu
Kết nối một trang web hoặc ứng dụng Android mà bạn sở hữu để nhận thêm lợi ích
chẳng hạn như tên lời gọi dành riêng và liên kết trang web trong Hành động.
Bản phát hành
Thiết lập các bản phát hành thử nghiệm và phát hành công khai cho Hành động của bạn
để thử nghiệm và sản xuất.
Đường liên kết đến Trợ lý
Cho phép người dùng gọi Hành động từ các thuộc tính web của bạn.
Cách xác định thông tin dự án:
Kiểm thử dự án trong trình mô phỏng
Bảng điều khiển Actions cung cấp một trình mô phỏng để xem trước Actions của bạn. Chiến lược phát hành đĩa đơn
trình mô phỏng cho phép bạn xem thông tin gỡ lỗi, thiết lập khả năng của thiết bị, mô phỏng
ngôn ngữ, v.v.
Hình 3. Các khu vực chính của trình mô phỏng: (1) hoạt động đầu vào của người dùng,
(2) chế độ xem thiết bị, (3) chế độ và chế độ cài đặt, và (4) nhật ký trò chuyện.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eAn Actions project enables the creation of conversational experiences for Google Assistant by packaging all actions into a single container for publishing.\u003c/p\u003e\n"],["\u003cp\u003eBuilding an Actions project involves utilizing components such as intents, types, scenes, prompts, webhooks and more for defining user interactions and logic.\u003c/p\u003e\n"],["\u003cp\u003eDefining project information in the Actions console, including directory information, locales and surfaces, is crucial for publishing and deploying to the Assistant directory.\u003c/p\u003e\n"],["\u003cp\u003eThe Actions console simulator provides a comprehensive environment for testing projects with features such as debugging, device settings, and locale simulation.\u003c/p\u003e\n"]]],[],null,["# Build projects\n\nActions Builder Actions SDK \n\nAn Actions project packages all of your Actions into a single container. You\npublish this project to Actions on Google so Google Assistant knows how to discover\nand invoke your conversational experiences.\n**Figure 1**. Actions project structure\n\nYou use the following low-level components to build your Actions project:\n\n- [**Settings and resources**](#define_project_information) define project metadata\n and resources like project icons. Google uses this information to publish\n your Actions to the Assistant directory, so that users can discover and invoke\n them.\n\n- [**Intents**](../intents) represent a task to be carried out, such as some\n user input or a system event that needs processing. The most common type of\n intent you'll use are user intents. These intents let you declare training\n phrases that are naturally expanded by the NLU (natural language understanding)\n engine to include many more, similar phrases. The NLU uses the aggregation of\n these phrases to train a language model that the Assistant uses to match user\n input. During a conversation, if some user input matches the intent's language\n model, the Assistant runtime sends the intent to your Action, so that it can\n process it and respond to the user.\n\n- [**Types**](../types) let you extract structured data from user input. By\n annotating training phrases with types, the NLU can extract relevant, structured\n data for you, so you don't have to parse open-ended input.\n\n- [**Scenes**](../scenes) process intents and are the main logic executors for\n your Actions. They can do slot-filling, evaluate conditional logic, return\n prompts to the user, and even call on external web services to carry out\n business logic. In combination with intents, scenes give you a powerful way to\n detect specific user input or system events and to carry out corresponding\n logic.\n\n- [**Prompts**](../prompts) define static or dynamic responses that you use to\n respond back to users.\n\n- [**Webhooks**](../webhooks) let you delegate extra work to web services\n (fulfillment), such as validating data or generating prompts. Your Actions\n communicate with your fulfillment through a JSON-based, webhook protocol.\n\n- [**Interactive Canvas**](/assistant/interactivecanvas) lets you create rich\n and immersive experiences with web apps that utilize HTML, CSS, and JavaScript.\n\nCreate a project\n----------------\n\nYou must create a project in the Actions console before you can develop for\nGoogle Assistant. To create a project:\n\n1. Go to the [Actions console](//console.actions.google.com/).\n2. Click **New project**.\n3. Enter a name for your project and click **Create Project** .\n4. In the **What kind of Action do you want to build?** screen, select a category that best represents your project and click **Next**.\n5. In the **How do you want to build it** screen, select a way to build and click **Start building**. For example, you can start with an empty project or with a sample.\n\n| **Key Point:** If you are building for Interactive Canvas, follow these additional steps:\n|\n| 1. If you did not select the **Game** card on the **What type of Action\n| do you want to build?** screen, click **Deploy** in the top navigation. Under **Additional Information** , select the **Games \\& fun** category. Click **Save**.\n| 2. Click **Develop** in the top navigation of the Actions console.\n| 3. Click **Interactive Canvas** in the left navigation.\n| 4. Under **Does your Action use Interactive Canvas?** , select **Yes**.\n| 5. **Optional** : Enter your web app URL into the **Set your default web app URL** field. This action adds a default `Canvas` response with the URL field to your Main invocation.\n| 6. Click **Save**.\n\n\u003cbr /\u003e\n\nDefine project information\n--------------------------\n\n| **Note:** See the [Directory information](/assistant/console/directory-information) documentation for more details on how to manage project information.\n\nYour project's settings and resources define information about your project like\nfeature and surface support, supported locales, display name, description,\nlogos, and more. The following table describes the main settings and resources\nyou provide. Actions on Google uses this\ninformation to deploy and publish your project to the [Assistant\ndirectory](//assistant.google.com/explore).\n\n| Name | Description |\n|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Directory information | Provides information so that Actions on Google can publish your project to the Assistant directory. Includes metadata and desecriptions about your project and image resources for logos and banner images. |\n| Location targeting | Configures the locales that your Actions are available in. |\n| Surface capabilities | Configures the surfaces that your Actions are available on. |\n| Company details | Specifies contact information for your company. |\n| Brand verification | Connect a website or Android app that you own to gain extra benefits such as reserved invocation names and website linking within your Actions. |\n| Release | Configures different testing and production releases for your Action for testing and production. |\n| Assistant links | Let users invoke your Actions from your web properties. |\n\nTo define project information:\n\nTest projects in the simulator\n------------------------------\n\n| **Note:** See the [Actions simulator](/assistant/console/simulator) documentation for complete information about testing your projects.\n\nThe Actions console provides a simulator to preview your Actions in. The\nsimulator lets you see debug information, set device capabilities, simulate\nlocale, and more.\n**Figure 3.** The main areas of the simulator: (1) user input, (2) device view, (3) options and settings, and (4) conversation log.\n\nTo test a project:"]]