用戶概覽
用戶是指與 Agent/工作流程發起對話的最終用戶。GPTBots 允許開發者為不同用戶分配唯一的身份 ID。透過此用戶 ID (user_id),可在不同渠道間關聯用戶身份,實現跨渠道身份整合。開發者也能透過工具進行業務查詢,並管理用戶屬性與聊天記錄。
用戶 CDP(客戶數據平台)資訊儲存於每個 Agent/工作流程下,同一用戶在不同 Agent/工作流程間的數據是隔離的。
用戶體系示意圖
flowchart LR
subgraph Col1["來源平台"]
LC["Livechat"]
IC["Intercom"]
WG[" Widget "]
TG["Telegram"]
end
subgraph Col2_5["來源平台子渠道"]
tgb01["TGBOT01"]
tgb02["TGBOT02"]
end
subgraph Col2["匿名 ID"]
a1["lc0001"]
a2["ic0001"]
a3["wg0001"]
tga1["tb0001"]
tga2["tg0001"]
end
subgraph Col3["用戶 ID"]
U1["ABC123"]
U2["ABC456"]
end
subgraph Col4["對話 ID"]
c1["c001"]
c2["c002"]
c3["c003"]
c4["c004"]
c5["c005"]
end
subgraph Col5["Agent/工作流程"]
Bot["Agent
Workflow"]
end
LC -- 生成匿名 ID --> a1
IC -- 生成匿名 ID --> a2
WG -- 生成匿名 ID --> a3
TG -- 子渠道用戶 --> tgb01 & tgb02
tgb01 -- 生成匿名 ID --> tga1
tgb02 -- 生成匿名 ID --> tga2
a1 -- 設定 user_id --> U1
a2 -- 設定 user_id --> U1
a3 -- 設定 user_id --> U2
tga1 -- 設定 user_id --> U2
tga2 -- 設定 user_id --> U2
U1 -- 生成新對話 ID --> c1
U1 -- 生成新對話 ID --> c2
U2 -- 生成新對話 ID --> c3
U2 -- 使用現有對話 ID --> c4
c4 -- 如果過期(>60分鐘)
生成新對話 ID --> c5
c1 --> Bot
c2 --> Bot
c3 --> Bot
c4 --> Bot
c5 --> Bot
LC:::redStyle
IC:::blueStyle
WG:::greenStyle
TG:::purpleStyle
tgb01:::purpleStyle
tgb02:::purpleStyle
a1:::redStyle
a2:::blueStyle
a3:::greenStyle
tga1:::purpleStyle
tga2:::purpleStyle
U1:::userGray
U2:::userGray
c1:::redStyle
c2:::blueStyle
c3:::greenStyle
c4:::purpleStyle
c5:::purpleStyle
classDef userGray fill:#f5f5f5,stroke:#e6e6e6,color:#222
classDef redStyle fill:#ffd6d6,stroke:#ffbdbd,color:#222
classDef blueStyle fill:#dff0ff,stroke:#cfeaff,color:#222
classDef greenStyle fill:#ecffd9,stroke:#d5ffb3,color:#222
classDef purpleStyle fill:#f1e0ff,stroke:#e1c7ff,color:#222
style Col1 stroke:#757575
- 匿名 ID (
anonymous_id) 由 GPTBots 系統服務依據用戶來源平台自動生成。 - 設定
user_id為選填。開發者可依業務需求決定是否設定user_id,以實現跨渠道用戶身份關聯與屬性共享。
定義
用戶
用戶指與 Agent 進行互動的最終使用者。
用戶 ID (user_id)
由企業開發者為最終用戶分配的唯一標識符。開發者可經由 API 為 anonymous_id 設定 user_id。更多 UserId 使用情境與進階應用,請參考設定用戶 ID。
user_id優先於anonymous_id。- 一個
user_id可同時關聯多個anonymous_id。
匿名 ID (anonymous_id)
當用戶透過第三方平台(如 Telegram、WhatsApp、LINE 等)與 Agent 進行互動時,GPTBots 會以該平台的唯一用戶標識符作為 anonymous_id。詳細生成邏輯請參考[匿名 ID 生成邏輯](## Anonymous ID Generation Logic)。
例如:tg_user_id 代表 Telegram 用戶的唯一識別碼;slack_user_id 代表 Slack 用戶的唯一識別碼。
第三方平台
GPTBots 平台目前支援與多種第三方平台整合,包括 Intercom、Webchat、LiveChat、Telegram、WhatsApp 等。
對話 ID (conversation_id)
對話 ID (conversation_id) 由 Agent、對話類型及 user_id(或 anonymous_id)共同生成,是區隔不同業務場景的唯一標識(通常包含多個消息 ID)。
- 除 API 渠道生成外,其餘對話 ID 於 60 分鐘後自動過期。
- 對於第三方平台與 Widget 渠道,對話 ID 過期後,系統會自動生成新的對話 ID,並開始新的對話。
消息 ID (message_id)
消息 ID (message_id) 標識 Agent 與用戶間每次訊息交換,是對話的最小單位。
- 消息 ID 由 GPTBots 平台自動產生,開發者無法自定義。
- 每個消息 ID 隸屬於一個對話 ID,一個對話 ID 通常包含多個消息 ID。
對話類型
對話類型 (conversation_type) 用於標識用戶發起對話的場景,如 Workspace-Workflow、WhatsApp、API、Workspace-Search 等。
對話 ID 生成原則
當用戶透過第三方平台與 Agent 發起對話時,系統會根據用戶平台產生 anonymous_id,並自動依此建立 conversation_id,以承載用戶與 Agent 間的一輪對話。
- 使用 API 時,開發者需先產生
conversation_id,才能與 Agent/Workflow 互動。 - 非 API 渠道則由 GPTBots 自動產生
conversation_id。
匿名 ID 生成邏輯
匿名 ID 用於於各整合平台與渠道中唯一標識用戶。下表說明各平台匿名 ID 的生成規則:
| 平台/渠道 | 匿名 ID 邏輯 | 說明 |
|---|---|---|
| Telegram | anonymous_id = tg_user_id | tg_user_id:Telegram 用戶唯一識別碼 |
| Telegram 群聊 | anonymous_id = tg_chat_id + tg_user_id | tg_chat_id:群聊 ID;tg_user_id:用戶 ID |
| LINE | anonymous_id = line_user_id | LINE 用戶唯一識別碼 |
| LiveChat | anonymous_id = lc_thread_id | LiveChat 對話線程唯一識別碼 |
| Slack | anonymous_id = slack_user_id | slack_user_id:Slack 用戶唯一識別碼 |
| Slack 公共頻道 | anonymous_id = slack_team_id + slack_channel_id + slack_user_id | 組合團隊、頻道、用戶 ID 以唯一標識 |
| Intercom | anonymous_id = intercom_user_id | intercom_user_id:Intercom 用戶唯一識別碼 |
| DingTalk | anonymous_id = dd_user_id | DingTalk 用戶唯一識別碼 |
| DingTalk 群聊 | anonymous_id = dd_chat_id + dd_senderId | 組合群聊與發送者 ID 以唯一標識 |
| WhatsApp by Meta | anonymous_id = wa_user_id | WhatsApp 用戶唯一識別碼,通常為電話號碼(如 @c.us 後綴) |
| WhatsApp by EngageLab | anonymous_id = wa_user_id | 同上 |
| Discord | anonymous_id = discord_user_id | Discord 用戶唯一數字識別碼 |
| anonymous_id = instagram_user_id | Instagram 發訊者唯一識別碼 | |
| anonymous_id = facebook_user_id | Facebook 發訊者唯一識別碼 | |
| Sobot | anonymous_id = sobot_memberId | Sobot 用戶 ID |
| Sobot 群聊 @用戶 | anonymous_id = sobot_guildId + sobot_channelId + sobot_memberId | Sobot 群聊唯一標識符 |
| Zoho Sales IQ | anonymous_id = zoho_sales_iq_conversationId | Zoho Sales IQ 對話唯一識別碼 |
| 微信客服 | anonymous_id = wechat_customer_service_user_id | 微信客服用戶 ID |
GPTBots 內建渠道匿名 ID 邏輯
GPTBots 內建渠道匿名 ID 依瀏覽器指紋產生:
| 渠道 | 匿名 ID 邏輯 | 說明 |
|---|---|---|
| API | 無匿名 ID | 僅以 user_id 生成對話 ID |
| Workspace | anonymous_id = 瀏覽器指紋 ID | 依瀏覽器指紋產生隨機 ID;清除快取或無痕模式下可能變更 |
| Share | anonymous_id = 瀏覽器指紋 ID | 同上 |
| Iframe | anonymous_id = 瀏覽器指紋 ID | 同上 |
| AI 搜尋 | anonymous_id = 瀏覽器指紋 ID | 同上 |
| AI 搜尋(iframe) | anonymous_id = 瀏覽器指紋 ID | 同上 |
| Widget | anonymous_id = 瀏覽器指紋 ID | 同上 |
當用戶登入 GPTBots 平台時,系統會自動將 GPTBots 帳號 ID 設為
user_id,並與anonymous_id(瀏覽器指紋 ID)關聯。
對話類型與來源 ID
- 對話類型 (
conversation_type):標識用戶透過哪個整合渠道發起對話(如 Workspace、API、Iframe、WhatsApp、LINE 等),可用於依渠道類型篩選日誌資料。 - 來源 ID (
source_id):標識整合渠道的子類型(如不同 LINE Channel ID、不同 Telegram Bot ID),可用於依子渠道篩選日誌資料。
| 對話類型 | conversation_type | 說明 |
|---|---|---|
| 全部 | ALL | 來自所有整合渠道的對話(可用於資料篩選,例如查詢所有來源訊息) |
| Workspace - 搜尋 | C | 來自 Workspace Agent 的對話 |
| Workspace - Agent | CHAT | 來自 Workspace 搜尋的對話 |
| Workspace - Workflow | C_WORKFLOW | 來自 Workspace Workflow 的對話 |
| Workspace - 應用 | C_APPS | 來自 Workspace Market AI 應用的對話 |
| API | API | 來自 API 整合的對話 |
| Iframe | EMBED | 來自 Iframe 整合的對話 |
| Widget 氣泡 | WIDGET | 來自 Widget 整合的對話 |
| AI 搜尋 | AI_SEARCH | 來自 AI 搜尋整合的對話 |
| 分享 | SHARE | 來自分享整合的對話 |
| WhatsApp by Meta | WHATSAPP_META | 來自 WhatsApp by Meta 整合的對話 |
| WhatsApp by EngageLab | WHATSAPP_ENGAGELAB | 來自 WhatsApp by EngageLab 整合的對話 |
| DingTalk 機器人 | DINGTALK | 來自 DingTalk 機器人整合的對話 |
| Discord | DISCORD | 來自 Discord 整合的對話 |
| Slack | SLACK | 來自 Slack 整合的對話 |
| Zapier | ZAPIER | 來自 Zapier 整合的對話 |
| 微信客服 | WXKF | 來自微信客服整合的對話 |
| Telegram | TELEGRAM | 來自 Telegram 整合的對話 |
| LiveChat | LIVECHAT | 來自 LiveChat 整合的對話 |
| LINE | LINE | 來自 LINE 整合的對話(支援多渠道) |
| 來自 Instagram 整合的對話 | ||
| 來自 Facebook 整合的對話 | ||
| Sobot | SO_BOT | 來自 Sobot 整合的對話 |
| Zoho Sales IQ | ZOHO_SALES_IQ | 來自 Zoho Sales IQ 整合的對話 |
| Intercom | INTERCOM | 來自 Intercom 整合的對話 |
| Livedesk | LIVEDESK | 來自 Livedesk 整合的對話 |
⚠️ 注意:以上表格中的欄位值可作為透過 API: 獲取對話列表 查詢對話資料時的篩選條件。
對於如 LINE、Telegram 等支援多子渠道的第三方平台,"Agent-Log" 支援依對話類型進行二級篩選。
