You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何存储检索Dialogflow对话历史及转接人工时获取用户对话记录

Great question! Handling conversation history is critical for smooth handoffs to human support, so let’s break this down clearly.

Does Dialogflow Have a Built-in Conversation History Storage?

Yes, both Dialogflow ES (Essentials) and Dialogflow CX (Contact Center Edition) offer built-in conversation history features, though the exact workflows differ slightly:

For Dialogflow ES:

  • Enable it first: Head to your Agent’s settings (left menu > Settings > General), scroll to the "Conversation History" section, check the box to enable it, and set a retention period (how long you want records stored).
  • Access via Console: Use the left menu’s Conversation History tab to browse, filter (by date, user, intent, etc.), and export records as CSV or JSON for offline use.
  • Access via API: Use the Dialogflow API’s projects.locations.agents.conversations endpoints. For example:
    • projects.locations.agents.conversations.list to fetch all conversations in a time range
    • projects.locations.agents.conversations.get to retrieve details for a specific conversation (using its unique conversation ID)
      You’ll need a service account with the dialogflow.conversations.get permission to make these calls.

For Dialogflow CX:

  • Access via Console: Go to Analytics > Conversations in the left menu. Here you can view full conversation transcripts, filter by agent, user, or intent, and export data.
  • Access via API: Use the CX API’s projects.locations.agents.conversations endpoints, similar to ES, to programmatically pull conversation history.
Storing & Retrieving Conversation History (Built-in + Custom Options)

If the built-in storage doesn’t meet your needs (e.g., you need to integrate with your own CRM or custom support tool), you can set up custom storage using webhooks:

Custom Storage Workflow:

  1. Set up a Fulfillment Webhook: In Dialogflow, configure a webhook to trigger on every user interaction (you can set this globally or per intent).
  2. Capture Conversation Data: In your webhook service, extract key data from the incoming request body:
    • Conversation ID (unique identifier for the user’s chat session)
    • User input text/audio transcript
    • Agent’s response
    • Detected intent and parameters
    • Timestamp of the interaction
  3. Store in Your Database: Save this data to a database of your choice (Firestore, MySQL, MongoDB, etc.), using the conversation ID as a foreign key to group all messages from the same session.
  4. Retrieve When Needed: When you need to pull the history (e.g., for a support handoff), query your database using the conversation ID to fetch all related messages, sorted by timestamp.
Handoff to Human Support with Conversation History

Whether you use built-in or custom storage, the goal is to pass the full conversation context to your human support team seamlessly:

Using Built-in History:

When your Dialogflow agent detects a "handoff to human" intent (e.g., user says "I need to talk to someone"), trigger a fulfillment that:

  1. Grabs the current conversation ID from the request.
  2. Calls the Dialogflow API to fetch the full transcript for that conversation.
  3. Formats the transcript into a readable format (e.g., a timestamped list of "User: ..." and "Agent: ..." messages).
  4. Passes this formatted history, along with user details (if available), to your support platform (Zendesk, Freshdesk, or your custom tool).

Using Custom Storage:

For custom setups, the handoff workflow is simpler:

  1. In the handoff intent’s fulfillment, use the conversation ID to query your database for all messages in the session.
  2. Format the history into a user-friendly transcript.
  3. Push this data to your support system so the human agent can see exactly what the user discussed with the bot before the handoff.

Key Notes:

  • Data Privacy: Always comply with regulations like GDPR or CCPA. Ensure you have user consent to store conversation data, encrypt sensitive information, and delete records when they’re no longer needed.
  • Conversation ID Consistency: The conversation ID is your anchor for grouping messages—make sure you use the same ID across all interactions in a single user session, whether you’re using built-in or custom storage.

内容的提问来源于stack exchange,提问作者Rakhi Mittal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 07:59:25