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.
Công cụ giao diện dòng lệnh ghành động (CLI) giúp bạn tạo các
cấu trúc dự án và tệp, rồi triển khai chúng dưới dạng một dự án Actions (Hành động) trong Actions
Google Play. Để biết thông tin về cách sử dụng công cụ dòng lệnh trong các trường hợp phổ biến
sau khi cài đặt và thiết lập, hãy xem hướng dẫn sử dụng
thay thế.
Sau khi cài đặt, bạn có thể nhận được bản tóm tắt chức năng của công cụ này trong
ga:
gactions --help
Kết quả sau đây sẽ xuất hiện:
Command Line Interface for Google Actions SDK
Usage:
gactions [command]
Available Commands:
decrypt Decrypt client secret.
deploy Deploy an Action to the specified channel.
encrypt Encrypt client secret.
help Help about any command
init Initialize a directory for a new project.
login Authenticate gactions CLI to your Google account via web browser.
logout Log gactions CLI out of your Google Account.
pull This command pulls files from Actions Console into the local file system.
push This command pushes changes in the local files to Actions Console.
third-party-notices Prints license files of third-party software used.
version Prints current version of the CLI.
Flags:
-h, --help help for gactions
-v, --verbose Display additional error information
Use "gactions [command] --help" for more information about a command.
Cài đặt công cụ dòng lệnh gaction
Cài đặt công cụ giao diện dòng lệnh gHành động (CLI) bằng cách tải một
cài đặt gói, giải nén gói đó và định cấu hình đường dẫn thực thi.
Để cài đặt và định cấu hình gHành động, hãy làm theo các bước sau:
Giải nén gói đó vào vị trí bạn chọn rồi thêm tệp nhị phân vào
biến PATH của môi trường. Ngoài ra, hãy trích xuất gói vào một
vị trí đã có trong biến PATH (ví dụ: /usr/local/bin).
Trên Linux và Mac, hãy bật quyền thực thi nếu cần:
chmod +x PATH_TO/gactions
Chạy lệnh sau để xác thực CLI. Lệnh này
bắt đầu quy trình xác thực và yêu cầu trình duyệt web:
gactions login
Khi luồng hoàn tất, CLI sẽ tự động xác thực.
Tạo và thiết lập dự án
Trước khi có thể sử dụng công cụ dòng lệnh gaction, bạn phải tạo một dự án trong
bảng điều khiển Actions và cấp quyền truy cập cho các hành động khác vào dự án. Để tạo và thiết lập
cho một dự án, hãy làm như sau:
Nhấp vào New project (Dự án mới), nhập tên dự án rồi nhấp vào Create project (Tạo dự án).
Chọn một danh mục rồi nhấp vào Tiếp theo.
Chọn Dự án trống rồi nhấp vào Bắt đầu tạo bản dựng.
Bật Actions API trong bảng điều khiển Google Cloud bằng cách làm theo hướng dẫn sau:
các hướng dẫn trong bài viết Bật và tắt
API.
Thao tác này cho phép các gHành động tương tác với dự án của bạn.
Khởi chạy một mẫu
Tạo một thư mục trống, sau đó chạy gactions init SAMPLE_NAME
từ thư mục đó để nhập một dự án Actions mẫu. Bạn có thể dùng mẫu
dự án làm mô hình để tạo dự án của riêng bạn và để hiểu Hành động
cấu trúc của dự án.
Ví dụ: lệnh sau đây dẫn đến nội dung của hello-world
mẫu đang được thêm vào thư mục của bạn:
[[["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\u003eThe \u003ccode\u003egactions\u003c/code\u003e command-line interface (CLI) helps you create, manage, and deploy Google Actions projects.\u003c/p\u003e\n"],["\u003cp\u003eYou can download and install \u003ccode\u003egactions\u003c/code\u003e for Windows, Linux, or Mac OS, then authenticate it with your Google account.\u003c/p\u003e\n"],["\u003cp\u003eBefore using \u003ccode\u003egactions\u003c/code\u003e, create a project in the Actions console and enable the Actions API.\u003c/p\u003e\n"],["\u003cp\u003eUse \u003ccode\u003egactions init\u003c/code\u003e to initialize a new project based on a sample, providing a starting point for your development.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the user guide for detailed instructions and common usage scenarios after setting up the tool.\u003c/p\u003e\n"]]],[],null,["# gactions overview\n\nThe gactions command line interface (CLI) tool helps you create the required\nproject structure and files and deploy them as an Actions project in the Actions\nconsole. For information on using the command-line tool in common scenarios\nafter it's installed and set up, see the [user guide](/assistant/actionssdk/gactions/guide)\ninstead.\n\nOnce installed, you can get a summary of the tool's functionality in your\nterminal: \n\n```text\ngactions --help\n```\n\nThe following output appears: \n\n```\nCommand Line Interface for Google Actions SDK\n\nUsage:\n gactions [command]\n\nAvailable Commands:\n decrypt Decrypt client secret.\n deploy Deploy an Action to the specified channel.\n encrypt Encrypt client secret.\n help Help about any command\n init Initialize a directory for a new project.\n login Authenticate gactions CLI to your Google account via web browser.\n logout Log gactions CLI out of your Google Account.\n pull This command pulls files from Actions Console into the local file system.\n push This command pushes changes in the local files to Actions Console.\n third-party-notices Prints license files of third-party software used.\n version Prints current version of the CLI.\n\nFlags:\n -h, --help help for gactions\n -v, --verbose Display additional error information\n\nUse \"gactions [command] --help\" for more information about a command.\n```\n\nInstall the gactions command-line tool\n--------------------------------------\n\nInstall the gactions command line interface (CLI) tool by downloading an\ninstallation package, unpacking it, and configuring your execution path.\n\nTo install and configure gactions, follow these steps:\n\n1. Download the appropriate package for your operating system:\n\n | Platform | Package | Checksum |\n |----------|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|\n | Windows | [Download](https://dl.google.com/gactions/v3/release/gactions-sdk_windows.zip) | [SHA256](https://dl.google.com/gactions/v3/release/gactions-sdk_windows.zip.sha256) |\n | Linux | [Download](https://dl.google.com/gactions/v3/release/gactions-sdk_linux.tar.gz) | [SHA256](https://dl.google.com/gactions/v3/release/gactions-sdk_linux.tar.gz.sha256) |\n | Mac OS | [Download](https://dl.google.com/gactions/v3/release/gactions-sdk_darwin.tar.gz) | [SHA256](https://dl.google.com/gactions/v3/release/gactions-sdk_darwin.tar.gz.sha256) |\n\n2. Extract the package to a location of your choice and add the binary to your\n environment's `PATH` variable. Alternatively, extract the package to a\n location that's already in your `PATH` variable (for example, `/usr/local/bin`).\n\n3. On Linux and Mac, enable execute permissions if necessary:\n\n ```scdoc\n chmod +x PATH_TO/gactions\n ```\n4. Run the following command to authenticate the CLI. This command\n starts an authentication flow and requires a web browser:\n\n ```text\n gactions login\n ```\n\n When the flow is complete, the CLI automatically authenticates.\n\nCreate and set up a project\n---------------------------\n\n| **Note:** Actions project creation is not supported in the gactions CLI.\n\nBefore you can use the gactions command-line tool, you must create a project in\nthe Actions console and give gactions access to the project. To create and set\nup a project, do the following:\n\n1. Go to the [Actions console](https://console.actions.google.com).\n2. Click **New project** , enter a project name, and click **Create project**.\n3. Select a category and click **Next**.\n4. Select **Blank project** and click **Start building**.\n5. Enable the **Actions API** in the Google Cloud console by following the instructions in [Enable and disable\n APIs](https://support.google.com/googleapi/answer/6158841). This allows gactions to interact with your project.\n\nInitialize a sample\n-------------------\n\nCreate an empty directory, then run `gactions init `\u003cvar translate=\"no\"\u003eSAMPLE_NAME\u003c/var\u003e\nfrom that directory to import a sample Actions project. You can use the sample\nproject as a model to create your own project and to understand an Actions\nproject's structure.\n\nFor instance, the following command results in the contents of the `hello-world`\nsample being added to your directory: \n\n```text\ngactions init hello-world\n```"]]