Google Business Messages 功能將於 2024 年 7 月 31 日終止服務。請按
這裡瞭解詳情。
從機器人改為線上服務專員
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
使用者與服務專員溝通時,他們的期望取決於服務專員如何設定
,以及負責接收郵件的人員。每次服務專員時
傳送訊息,該號碼判斷是自動語音轉錄 (BOT
) 還是真人服務專員
(HUMAN
)
代表
撰寫了訊息使用者會在對話中看到這項資訊,
協助使用者瞭解在任何特定網站上,預期會發生哪種互動方式
最終點子
如果服務專員同時支援 BOT
和 HUMAN
的代表,就務必
兩者切換時,就能提供背景資訊。從 BOT
切換為
HUMAN
代表,請傳送 REPRESENTATIVE_JOINED
事件早於
從 HUMAN
代表傳送訊息,並且將所有訊息正確加上標籤
觀看真人服務專員的訊息,格式為 HUMAN
代表。當
真人服務專員離開對話,傳送 REPRESENTATIVE_LEFT
事件。這些
頁框事件能讓使用者知道,他們可以提出更複雜的問題,而且
預期能得到更任意形式的回覆
在這個對話流程中,使用者第一次與自動互動會經過
以 BOT
代表身分傳送訊息,但真人服務專員加入的作答者
以 HUMAN
代表的身分傳送訊息。即時
服務專員的訊息是由「REPRESENTATIVE_JOINED
」和「REPRESENTATIVE_LEFT
」組成
事件。

- 使用者開始和代理程式對話。
使用者開始輸入回覆後,系統會將輸入事件傳送到
代理程式。
{
"agent": "brands/1111/agents/2222",
"conversationId": "3333",
"customAgentId": "live-agent-handoff",
"requestId": "1234567890",
"userStatus": {
"isTyping": "true",
"createTime": "2020-10-02T15:01:23.045123456Z",
},
"sendTime": "2020-10-02T15:01:24.045123456Z",
}
使用者傳送「您好:我遇到問題」以訊息的形式說明
{
"agent": "brands/1111/agents/2222",
"conversationId": "3333",
"customAgentId": "live-agent-handoff",
"requestId": "123123123",
"message": {
"messageId": "4444",
"name": "conversations/12345/messages/67890",
"text": "Hi, I have a problem",
"createTime": "2020-10-02T15:05:23.045123456Z",
},
"context": {
"entryPoint": "PLACESHEET",
"userInfo": {
"displayName": "Michael",
"userDeviceLocale": "en",
},
"resolvedLocale": "en",
}
"sendTime": "2020-10-02T15:05:24.045123456Z",
}
服務專員傳送「感謝您與我們聯絡。我會在有直播活動
有專員可以與您進行即時通訊。」以訊息格式來自 BOT
代表。
curl -X POST "https://businessmessages.googleapis.com/v1/conversations/3333/messages" \
-H "Content-Type: application/json" \
-H "`oauth2l header --json path/to/service/account/key.json businessmessages`" \
-d "{
'messageId': '5555',
'text': 'Thanks for contacting us. I'll pass this along when a live agent is available to chat with you.',
'representative': {
'avatarImage': 'https://live.agent/bot-avatar.jpg',
'displayName': 'Hello World Agent',
'representativeType': 'BOT'
}
}"
有真人服務專員提供。
代理程式會先傳送 REPRESENTATIVE_JOINED
事件,再傳送第一個事件
傳送的訊息
curl -X POST "https://businessmessages.googleapis.com/v1/conversations/12345/events?eventId=6666" \
-H "Content-Type: application/json" \
-H "`oauth2l header --json /path/to/service/account/key.json businessmessages`" \
-d "{
'eventType': 'REPRESENTATIVE_JOINED',
'representative': {
'avatarImage': 'https://live.agent/human-avatar.jpg',
'displayName': 'Jane Doe',
'representativeType': 'HUMAN',
},
}"
服務專員會傳送「我瞭解您發生問題。需要什麼協助嗎?」以訊息的形式
聯絡 HUMAN
代表。
curl -X POST "https://businessmessages.googleapis.com/v1/conversations/3333/messages" \
-H "Content-Type: application/json" \
-H "`oauth2l header --json path/to/service/account/key.json businessmessages`" \
-d "{
'messageId': '7777',
'text': 'I see you have a problem. How can I help?',
'representative': {
'avatarImage': 'https://live.agent/human-avatar.jpg',
'displayName': 'Jane Doe',
'representativeType': 'HUMAN'
}
}"
即時服務專員和使用者交換訊息,直到使用者的要求遭拒為止
符合條件。所有由真人服務專員撰寫的訊息,都會來自
HUMAN
代表。
真人服務專員離開REPRESENTATIVE_LEFT
對話。
curl -X POST "https://businessmessages.googleapis.com/v1/conversations/12345/events?eventId=6666" \
-H "Content-Type: application/json" \
-H "`oauth2l header --json /path/to/service/account/key.json businessmessages`" \
-d "{
'eventType': 'REPRESENTATIVE_LEFT',
'representative': {
'avatarImage': 'https://live.agent/human-avatar.jpg',
'displayName': 'Jane Doe',
'representativeType': 'HUMAN',
},
}"
除非收到訊息,否則服務專員會傳送所有後續訊息與 BOT
代表
另一位真人服務專員加入對話。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-09-11 (世界標準時間)。
[null,null,["上次更新時間:2024-09-11 (世界標準時間)。"],[[["\u003cp\u003eBusiness Messages allows agents to specify whether a message is composed by a bot (\u003ccode\u003eBOT\u003c/code\u003e) or a human agent (\u003ccode\u003eHUMAN\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eWhen switching between bot and human representatives, agents should use \u003ccode\u003eREPRESENTATIVE_JOINED\u003c/code\u003e and \u003ccode\u003eREPRESENTATIVE_LEFT\u003c/code\u003e events to provide context to the user.\u003c/p\u003e\n"],["\u003cp\u003eThese events signal to users that a live agent is available and they can expect more complex interactions and freeform responses.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eBOT\u003c/code\u003e and \u003ccode\u003eHUMAN\u003c/code\u003e representative types and framing events enhances user experience by setting clear expectations for the conversation flow.\u003c/p\u003e\n"]]],[],null,["# Handoff from bot to live agent\n\nWhen users communicate with agents, their expectations are set by how the agent\npresents itself and who composes the messages they receive. Each time an agent\nsends a message, it can identify whether an automated (`BOT`) or live agent\n(`HUMAN`)\n[representative](/business-communications/business-messages/guides/how-to/message/send#representatives)\ncomposed the message. Users see this information within the conversation, and it\nhelps users understand what sorts of interactions they might expect at any given\npoint in time.\n\nIf an agent supports both `BOT` and `HUMAN` representatives, it's important to\nprovide context when switching between the two. When switching from a `BOT` to a\n`HUMAN` representative, send a `REPRESENTATIVE_JOINED`\n[event](/business-communications/business-messages/guides/how-to/message/events) before\nsending messages from the `HUMAN` representative, and properly label all\nfollowing messages from live agents as from `HUMAN` representatives. When the\nlive agent leaves the conversation, send a `REPRESENTATIVE_LEFT` event. These\nframing events inform users that they can ask more complicated questions and can\nexpect more freeform responses.\n\nIn this conversation flow, the user's first interactions are with an automated\nresponder that sends messages as a `BOT` representative, but a live agent joins\nthe conversation and sends messages as a `HUMAN` representative. The live\nagent's messages are framed by `REPRESENTATIVE_JOINED` and `REPRESENTATIVE_LEFT`\nevents.\n\n1. The user begins the conversation with the agent.\n2. Once the user begins typing a response, they send a typing event to the\n agent.\n\n {\n \"agent\": \"brands/1111/agents/2222\",\n \"conversationId\": \"3333\",\n \"customAgentId\": \"live-agent-handoff\",\n \"requestId\": \"1234567890\",\n \"userStatus\": {\n \"isTyping\": \"true\",\n \"createTime\": \"2020-10-02T15:01:23.045123456Z\",\n },\n \"sendTime\": \"2020-10-02T15:01:24.045123456Z\",\n }\n\n3. The user sends \"Hi, I have a problem\" as a message.\n\n {\n \"agent\": \"brands/1111/agents/2222\",\n \"conversationId\": \"3333\",\n \"customAgentId\": \"live-agent-handoff\",\n \"requestId\": \"123123123\",\n \"message\": {\n \"messageId\": \"4444\",\n \"name\": \"conversations/12345/messages/67890\",\n \"text\": \"Hi, I have a problem\",\n \"createTime\": \"2020-10-02T15:05:23.045123456Z\",\n },\n \"context\": {\n \"entryPoint\": \"PLACESHEET\",\n \"userInfo\": {\n \"displayName\": \"Michael\",\n \"userDeviceLocale\": \"en\",\n },\n \"resolvedLocale\": \"en\",\n }\n \"sendTime\": \"2020-10-02T15:05:24.045123456Z\",\n }\n\n4. The agent sends \"Thanks for contacting us. I'll pass this along when a live\n agent is available to chat with you.\" as a message from a `BOT`\n representative.\n\n curl -X POST \"https://businessmessages.googleapis.com/v1/conversations/3333/messages\" \\\n -H \"Content-Type: application/json\" \\\n -H \"`oauth2l header --json path/to/service/account/key.json businessmessages`\" \\\n -d \"{\n 'messageId': '5555',\n 'text': 'Thanks for contacting us. I'll pass this along when a live agent is available to chat with you.',\n 'representative': {\n 'avatarImage': 'https://live.agent/bot-avatar.jpg',\n 'displayName': 'Hello World Agent',\n 'representativeType': 'BOT'\n }\n }\"\n\n5. A live agent becomes available.\n\n6. The agent sends a `REPRESENTATIVE_JOINED` event before sending the first\n message from the live agent.\n\n curl -X POST \"https://businessmessages.googleapis.com/v1/conversations/12345/events?eventId=6666\" \\\n -H \"Content-Type: application/json\" \\\n -H \"`oauth2l header --json /path/to/service/account/key.json businessmessages`\" \\\n -d \"{\n 'eventType': 'REPRESENTATIVE_JOINED',\n 'representative': {\n 'avatarImage': 'https://live.agent/human-avatar.jpg',\n 'displayName': 'Jane Doe',\n 'representativeType': 'HUMAN',\n },\n }\"\n\n7. The agent sends \"I see you have a problem. How can I help?\" as a message\n from a `HUMAN` representative.\n\n curl -X POST \"https://businessmessages.googleapis.com/v1/conversations/3333/messages\" \\\n -H \"Content-Type: application/json\" \\\n -H \"`oauth2l header --json path/to/service/account/key.json businessmessages`\" \\\n -d \"{\n 'messageId': '7777',\n 'text': 'I see you have a problem. How can I help?',\n 'representative': {\n 'avatarImage': 'https://live.agent/human-avatar.jpg',\n 'displayName': 'Jane Doe',\n 'representativeType': 'HUMAN'\n }\n }\"\n\n8. The live agent and the user exchange messages until the user's request is\n fulfilled. All messages composed by the live agent are sent from a\n `HUMAN` representative.\n\n9. The agent sends a `REPRESENTATIVE_LEFT` event when the live agent leaves the\n conversation.\n\n curl -X POST \"https://businessmessages.googleapis.com/v1/conversations/12345/events?eventId=6666\" \\\n -H \"Content-Type: application/json\" \\\n -H \"`oauth2l header --json /path/to/service/account/key.json businessmessages`\" \\\n -d \"{\n 'eventType': 'REPRESENTATIVE_LEFT',\n 'representative': {\n 'avatarImage': 'https://live.agent/human-avatar.jpg',\n 'displayName': 'Jane Doe',\n 'representativeType': 'HUMAN',\n },\n }\"\n\n10. The agent sends all subsequent messages with `BOT` representatives unless\n another live agent joins the conversation."]]