Dialogflow CX Advanced
Manage advanced features in Google Dialogflow CX via REST API for deployment and external integrations.
Prerequisites
- - Google Cloud project with Dialogflow CX API enabled
- Service account or OAuth credentials with Dialogflow API access
- INLINECODE0 CLI authenticated OR bearer token
Authentication
Option 1: gcloud CLI (recommended)
CODEBLOCK0
Option 2: Service Account
CODEBLOCK1
API Base URL
CODEBLOCK2
Regional endpoints available:
- -
https://{region}-dialogflow.googleapis.com (e.g., us-central1, europe-west1)
Common Operations
List Environments
CODEBLOCK3
Create Environment
CODEBLOCK4
List Webhooks
CODEBLOCK5
Create Webhook
CODEBLOCK6
Key Resources
| Resource | Description |
|---|
| Environments | Deployment stages (draft, production) |
| Webhooks |
External fulfillment endpoints |
|
Continuous Testing | Ongoing health monitoring |
Quick Reference
For detailed API reference:
Scripts
- -
scripts/advanced.py — CLI wrapper for advanced operations
Usage
CODEBLOCK7
Tips
- - Use environments to separate development, staging, and production
- Webhooks enable external processing and integrations
- Continuous testing helps maintain conversation quality
Dialogflow CX 高级功能
通过 REST API 管理 Google Dialogflow CX 中的高级功能,用于部署和外部集成。
前提条件
- - 已启用 Dialogflow CX API 的 Google Cloud 项目
- 具有 Dialogflow API 访问权限的服务账号或 OAuth 凭据
- 已认证的 gcloud CLI 或持有 bearer token
身份认证
方式一:gcloud CLI(推荐)
bash
gcloud auth application-default login
TOKEN=$(gcloud auth print-access-token)
方式二:服务账号
bash
export GOOGLE
APPLICATIONCREDENTIALS=/path/to/service-account.json
TOKEN=$(gcloud auth application-default print-access-token)
API 基础地址
https://dialogflow.googleapis.com/v3beta1
可用的区域端点:
- - https://{region}-dialogflow.googleapis.com(例如:us-central1、europe-west1)
常用操作
列出环境
bash
curl -X GET \
https://dialogflow.googleapis.com/v3beta1/projects/${PROJECT
ID}/locations/${LOCATION}/agents/${AGENTID}/environments \
-H Authorization: Bearer ${TOKEN}
创建环境
bash
curl -X POST \
https://dialogflow.googleapis.com/v3beta1/projects/${PROJECT
ID}/locations/${LOCATION}/agents/${AGENTID}/environments \
-H Authorization: Bearer ${TOKEN} \
-H Content-Type: application/json \
-d {
displayName: production,
description: 生产环境
}
列出 Webhook
bash
curl -X GET \
https://dialogflow.googleapis.com/v3beta1/projects/${PROJECT
ID}/locations/${LOCATION}/agents/${AGENTID}/webhooks \
-H Authorization: Bearer ${TOKEN}
创建 Webhook
bash
curl -X POST \
https://dialogflow.googleapis.com/v3beta1/projects/${PROJECT
ID}/locations/${LOCATION}/agents/${AGENTID}/webhooks \
-H Authorization: Bearer ${TOKEN} \
-H Content-Type: application/json \
-d {
displayName: 订单履行,
genericWebService: {
uri: https://your-webhook.com/fulfill
}
}
关键资源
外部履行端点 |
|
持续测试 | 持续健康监控 |
快速参考
详细 API 参考:
脚本
- - scripts/advanced.py — 高级操作的 CLI 封装
使用方法
bash
python scripts/advanced.py list-environments --agent AGENT_NAME
python scripts/advanced.py list-webhooks --agent AGENT_NAME
提示
- - 使用环境来分离开发、预发布和生产环境
- Webhook 支持外部处理和集成
- 持续测试有助于维护对话质量