← 返回
开发者工具 Key 中文

Dialogflow Cx Conversations

Manage conversations and sessions in Google Dialogflow CX via REST API. Use for testing intents, handling user interactions, and managing conversation state....
通过 REST API 管理 Google Dialogflow CX 中的对话和会话,用于测试意图、处理用户交互以及管理会话状态。
yash-kavaiya
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 522
下载
💾 6
安装
1
版本
#latest

概述

Dialogflow CX Conversations

Manage conversations and sessions in Google Dialogflow CX via REST API for testing and interaction handling.

Prerequisites

  • Google Cloud project with Dialogflow CX API enabled
  • Service account or OAuth credentials with Dialogflow API access
  • gcloud CLI authenticated OR bearer token

Authentication

Option 1: gcloud CLI (recommended)

gcloud auth application-default login
TOKEN=$(gcloud auth print-access-token)

Option 2: Service Account

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
TOKEN=$(gcloud auth application-default print-access-token)

API Base URL

https://dialogflow.googleapis.com/v3beta1

Regional endpoints available:

  • https://{region}-dialogflow.googleapis.com (e.g., us-central1, europe-west1)

Common Operations

Detect Intent

curl -X POST \
  "https://dialogflow.googleapis.com/v3beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents/${AGENT_ID}/sessions/${SESSION_ID}:detectIntent" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "queryInput": {
      "text": {
        "text": "Hello"
      },
      "languageCode": "en"
    }
  }'

Match Intent (no state change)

curl -X POST \
  "https://dialogflow.googleapis.com/v3beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents/${AGENT_ID}/sessions/${SESSION_ID}:matchIntent" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "queryInput": {
      "text": {
        "text": "Hello"
      },
      "languageCode": "en"
    }
  }'

Create Test Case

curl -X POST \
  "https://dialogflow.googleapis.com/v3beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents/${AGENT_ID}/testCases" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "Greeting Test",
    "testCaseConversationTurns": [
      {
        "userInput": {
          "input": {
            "text": {
              "text": "Hi"
            }
          }
        },
        "virtualAgentOutput": {
          "textResponses": [
            {
              "text": ["Hello!"]
            }
          ]
        }
      }
    ]
  }'

Key Resources

| Resource | Description |

|----------|-------------|

| Sessions | Conversation instances with state |

| Detect Intent | Process user input and get responses |

| Test Cases | Automated conversation testing |

Quick Reference

For detailed API reference:

Scripts

  • scripts/conversations.py — CLI wrapper for conversation operations

Usage

python scripts/conversations.py detect-intent --agent AGENT_NAME --text "Hello"
python scripts/conversations.py match-intent --agent AGENT_NAME --text "Hello"

Tips

  • Session IDs can be any unique string (e.g., UUID)
  • Use detectIntent for full conversation flow, matchIntent for testing without state changes
  • Test cases help validate conversation logic before deployment

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 07:15 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Cx Agent Studio

yash-kavaiya
Google 客户体验代理工作室(CX Agent Studio)的使用指南和说明,适用于创建对话代理、编写或构建交互流程。
★ 0 📥 778
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 667 📥 323,821
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,734