會話
列出會話成員
列出 group 類型會話嘅成員。conversation_id 走 query 參數,用 cursor / limit 分頁。每項回傳 peer_id / display_name / avatar_url;role 只會係 member、admin 或 superadmin,其中 superadmin 代表群主或建立者。會話類型唔支援成員查詢嘅時候(例如一對一)會回傳 400。
https://api.unifyport.ai/v1/accounts/{account_id}/conversations/members支援渠道
呼叫前準備
在伺服器端使用資源所屬工作區的 X-Api-Key,執行範例前替換所有預留位置。
參數從哪裡取得
- account_id
- 從建立或查詢帳號的回應取得 data.id。帳號屬於 X-Api-Key 對應的工作區。 攞帳號
- conversation_id
- 想查嘅對話 —— 即係 List conversations 回返嘅 conversation_id 嗰個值。
請求參數
請求標頭
X-Api-Key工作區 API Key,工作區會由呢個標頭解析得出嚟。
路徑參數
account_id用嚟識別嗰條 conversations 路由嘅 ID。
查詢參數
conversation_id想查嘅對話 —— 即係 List conversations 回返嘅 conversation_id 嗰個值。
type對話類型(user、group 或者 channel),用嚟消除查詢嘅歧義。
enum: user, group, channel
cursor渠道不透明游標,要原樣傳返上一個回應嘅 next_cursor;唔填或留空由第一頁開始。偽造、過期或跨查詢重用嘅游標可能被忽略、重設為第一頁或回傳渠道錯誤,唔可以依賴統一嘅 400 回應。
limit單頁數量範圍 1..100;預設值睇各端點說明。
minimum: 1 · maximum: 100
請求內容
呢個介面唔需要 JSON 請求內容。
如何理解結果
依本介面的回應欄位與 HTTP 狀態判斷結果,再透過相關操作選擇下一步。
回應 200 OK
{
"request_id": "<REQUEST_ID>",
"data": {
"items": [
{
"peer_id": "user_example",
"display_name": "",
"avatar_url": "",
"role": "superadmin"
}
],
"next_cursor": "",
"has_more": false
}
}
回應內容
peer_id成員嘅渠道側穩定識別碼,請當作不透明字串儲存同使用。
username渠道有提供時回傳嘅成員 username。
display_name成員嘅顯示名稱;冇嘅話就係空字串。
avatar_url成員嘅頭像 URL;冇嘅話就係空字串。
role歸一化群組角色:群主或建立者係 superadmin,管理員係 admin,普通或未知角色係 member。
enum: member, admin, superadmin
joined_at渠道回報嘅成員加入時間。
format: date-time
extra渠道專屬嘅成員欄位,例如電話號碼。
next_cursor下一頁嘅 opaque cursor。攞返佢做 cursor 傳返入嚟;如果係空字串就代表冇下一頁喇。
has_more呢一頁之後仲有結果嗰陣會係 true。
回應
200200 OK
請求成功,回應內容嘅例子如上。
400請求錯誤
請求內容、路徑或者參數無效。
401未授權
X-Api-Key 請求標頭缺少或者無效。
403禁止存取
請求已識別,但唔允許執行呢個操作。
404搵唔到資源
搵唔到請求嘅資源;請結合 error.code 同目前操作核對。
409衝突
目前操作同現有嘅渠道帳號或者資源衝突。
500伺服器錯誤
服務遇到咗未預期嘅錯誤。
501渠道未實作
所選渠道未實作呢個操作。
502上游閘道錯誤
渠道轉接器或者上游渠道未能完成呢個操作。
失敗後如何處理
檢查 HTTP 狀態和 error.code/numeric_code,保留 request_id。依原因修正參數、繼續授權或檢查狀態。重試傳送及寫入前確認上次結果,避免重複操作。 錯誤碼參考
請按目前操作一併讀取 HTTP 狀態、error.code 同 error.numeric_code。數字碼以字串處理。保留 request_id 排查;佢唔係冪等鍵或任務識別碼。
- invalid_conversation_type · 37000 · 400
type 必須為 user、group 或 channel。
處理與重試: 按目前操作同渠道條件修正參數後再請求。重複提交相同嘅無效請求唔會解決錯誤。
示意 JSON;message 會隨實際原因變化 · 400 · 37000
{ "request_id": "req_example", "error": { "code": "invalid_conversation_type", "numeric_code": "37000", "message": "Field 'type' must be one of: user, group, channel" } }- invalid_request · 10000 · 400
檢查 JSON 請求內容與必填欄位。
處理與重試: 按目前操作同渠道條件修正參數後再請求。重複提交相同嘅無效請求唔會解決錯誤。
示意 JSON;message 會隨實際原因變化 · 400 · 10000
{ "request_id": "req_example", "error": { "code": "invalid_request", "numeric_code": "10000", "message": "Invalid request parameters" } }- invalid_target_workspace · 11003 · 400
工作區覆寫目標為空或格式無效。請移除覆寫請求標頭,改用目標工作區所屬嘅 API Key。
觸發條件: 適用於帶有 X-Workspace-Id 工作區覆寫請求標頭嘅請求。
處理與重試: 按目前操作同渠道條件修正參數後再請求。重複提交相同嘅無效請求唔會解決錯誤。
示意 JSON;message 會隨實際原因變化 · 400 · 11003
{ "request_id": "req_example", "error": { "code": "invalid_target_workspace", "numeric_code": "11003", "message": "Invalid target workspace" } }- provider_invalid_request · 30001 · 400
檢查渠道專屬欄位及格式。
處理與重試: 按目前操作同渠道條件修正參數後再請求。重複提交相同嘅無效請求唔會解決錯誤。
示意 JSON;message 會隨實際原因變化 · 400 · 30001
{ "request_id": "req_example", "error": { "code": "provider_invalid_request", "numeric_code": "30001", "message": "Provider rejected the request" } }- unsupported_conversation_type · 37001 · 400
渠道不支援此操作,請選擇能力表中支援的操作。
處理與重試: 選擇文件列為支援嘅渠道同動作。重複請求唔會增加能力或開通內測權限。
示意 JSON;message 會隨實際原因變化 · 400 · 37001
{ "request_id": "req_example", "error": { "code": "unsupported_conversation_type", "numeric_code": "37001", "message": "Operation not supported for this conversation type" } }- invalid_api_key · 11001 · 401
檢查 API Key 是否正確且已啟用。
處理與重試: 保留 request_id 同結構化錯誤碼,先排查目前操作,再決定下一步。
示意 JSON;message 會隨實際原因變化 · 401 · 11001
{ "request_id": "req_example", "error": { "code": "invalid_api_key", "numeric_code": "11001", "message": "Invalid API key" } }- missing_api_key · 11000 · 401
請加入 X-Api-Key 請求標頭。
處理與重試: 保留 request_id 同結構化錯誤碼,先排查目前操作,再決定下一步。
範例 · 401 · 11000
{ "request_id": "req_xxx", "error": { "code": "missing_api_key", "numeric_code": "11000", "message": "Missing X-Api-Key header" } }- workspace_override_forbidden · 11002 · 403
請求嘗試使用呢個 API Key 無權使用嘅工作區覆寫。請移除覆寫請求標頭,改用目標工作區所屬嘅 API Key。
觸發條件: 適用於帶有 X-Workspace-Id 工作區覆寫請求標頭嘅請求。
處理與重試: 保留 request_id 同結構化錯誤碼,先排查目前操作,再決定下一步。
示意 JSON;message 會隨實際原因變化 · 403 · 11002
{ "request_id": "req_example", "error": { "code": "workspace_override_forbidden", "numeric_code": "11002", "message": "Workspace override is not allowed" } }- conversation_not_found · 37002 · 404
渠道未找到此對話,請核對識別碼與所屬帳戶。
處理與重試: 核對目標識別碼、資源歸屬同目前工作區。唔好將已確認缺少或無法存取嘅目標當成暫時服務故障自動重試。
示意 JSON;message 會隨實際原因變化 · 404 · 37002
{ "request_id": "req_example", "error": { "code": "conversation_not_found", "numeric_code": "37002", "message": "Conversation not found" } }- target_workspace_not_found · 11004 · 404
覆寫指定嘅工作區不存在或不可用。請核對工作區歸屬,移除覆寫請求標頭並使用目標工作區 API Key;重複請求唔會增加存取權限。
觸發條件: 適用於帶有 X-Workspace-Id 工作區覆寫請求標頭嘅請求。
處理與重試: 核對目標識別碼、資源歸屬同目前工作區。唔好將已確認缺少或無法存取嘅目標當成暫時服務故障自動重試。
示意 JSON;message 會隨實際原因變化 · 404 · 11004
{ "request_id": "req_example", "error": { "code": "target_workspace_not_found", "numeric_code": "11004", "message": "Target workspace not found" } }- account_binding_not_found · 30006 · 409
帳戶尚無有效的渠道連線綁定,請檢查帳戶狀態。
處理與重試: 查詢授權及運行狀態,再按目標狀態同渠道支援選擇刷新、啟動或重連。連線問題本身唔證明已登出;執行依賴連線嘅業務操作前確認 running。
示意 JSON;message 會隨實際原因變化 · 409 · 30006
{ "request_id": "req_example", "error": { "code": "account_binding_not_found", "numeric_code": "30006", "message": "Account is not bound to an available server" } }- egress_configuration_pending · 20032 · 409
暫時無法確認或讀取平台預設網絡設定;唔代表帳號已登出。
觸發條件: 呢個操作使用平台分配嘅網絡容量或帳號固定嘅預設網絡設定。
處理與重試: 保留 request_id,再次寫入前核對帳號或建立結果。等容量或設定恢復,或聯絡支援;唔好自動反覆建立帳號、更換網絡或重啟帳號。
示意 JSON;message 會隨實際原因變化 · 409 · 20032
{ "request_id": "req_example", "error": { "code": "egress_configuration_pending", "numeric_code": "20032", "message": "Account network configuration is pending verification" } }- provider_not_ready · 30009 · 409
連線尚未就緒,請檢查授權及 runtime_status 後再決定是否重試。
處理與重試: 查詢授權及運行狀態,再按目標狀態同渠道支援選擇刷新、啟動或重連。連線問題本身唔證明已登出;執行依賴連線嘅業務操作前確認 running。
示意 JSON;message 會隨實際原因變化 · 409 · 30009
{ "request_id": "req_example", "error": { "code": "provider_not_ready", "numeric_code": "30009", "message": "Provider client is not ready" } }- provider_not_ready · 30014 · 409
呢個帳號所需嘅渠道實例缺失。呢個係運行實例可用性問題,唔證明授權已過期。
處理與重試: 查詢授權及運行狀態,再按目標狀態同渠道支援選擇刷新、啟動或重連。連線問題本身唔證明已登出;執行依賴連線嘅業務操作前確認 running。
適用渠道: WhatsApp
示意 JSON;message 會隨實際原因變化 · 409 · 30014
{ "request_id": "req_example", "error": { "code": "provider_not_ready", "numeric_code": "30014", "message": "Provider instance is missing" } }- provider_not_ready · 30015 · 409
渠道運行進程已停止。啟動前確認呢個係咪預期狀態;運行態停止本身唔等於已登出。
處理與重試: 查詢授權及運行狀態,再按目標狀態同渠道支援選擇刷新、啟動或重連。連線問題本身唔證明已登出;執行依賴連線嘅業務操作前確認 running。
適用渠道: WhatsApp
示意 JSON;message 會隨實際原因變化 · 409 · 30015
{ "request_id": "req_example", "error": { "code": "provider_not_ready", "numeric_code": "30015", "message": "Provider runtime is stopped" } }- list_conversation_members_failed · 20020 · 500
核對 account_id,並使用帳號所屬工作區的 X-Api-Key。此工作區下未找到的帳號無法使用目前 Key 存取。
觸發條件: 適用於帳號不存在嘅情況;保留原 HTTP 狀態同操作 code,透過 numeric_code 細分帳號缺失。
處理與重試: 核對目標識別碼、資源歸屬同目前工作區。唔好將已確認缺少或無法存取嘅目標當成暫時服務故障自動重試。
示意 JSON;message 會隨實際原因變化 · 500 · 20020
{ "request_id": "req_example", "error": { "code": "list_conversation_members_failed", "numeric_code": "20020", "message": "Account not found" } }- list_conversation_members_failed · 30010 · 500
渠道未能完成本次操作。message 可能喺「Provider operation failed:」後附原始原因;文字可以改動,唔係穩定嘅程式介面。
觸發條件: 適用於渠道未提供更具體失敗分類嘅情況,保留目前操作嘅錯誤。
處理與重試: 保留 request_id,核對目標識別碼同帳號存取範圍。查明原因後再試查詢;查詢失敗唔代表結果為空或資源不存在。
適用渠道: WhatsApp
示意 JSON;message 會隨實際原因變化 · 500 · 30010
{ "request_id": "req_example", "error": { "code": "list_conversation_members_failed", "numeric_code": "30010", "message": "Provider operation failed" } }- list_conversation_members_failed · 37005 · 500
列出會話成員:服務未能產生有效嘅查詢結果。
處理與重試: 保留 request_id,核對目標識別碼同帳號存取範圍。查明原因後再試查詢;查詢失敗唔代表結果為空或資源不存在。
示意 JSON;message 會隨實際原因變化 · 500 · 37005
{ "request_id": "req_example", "error": { "code": "list_conversation_members_failed", "numeric_code": "37005", "message": "Failed to list conversation members" } }- unsupported_by_provider · 30003 · 501
渠道不支援此操作,請選擇能力表中支援的操作。
處理與重試: 選擇文件列為支援嘅渠道同動作。重複請求唔會增加能力或開通內測權限。
範例 · 501 · 30003
{ "request_id": "req_xxx", "error": { "code": "unsupported_by_provider", "numeric_code": "30003", "message": "Operation not supported by this provider" } }- provider_adapter_not_found · 30004 · 502
渠道服務暫時無法使用,請檢查狀態或稍後再試;重試寫入操作前先確認上次結果。
處理與重試: 保留 request_id,核對目標識別碼同帳號存取範圍。查明原因後再試查詢;查詢失敗唔代表結果為空或資源不存在。
示意 JSON;message 會隨實際原因變化 · 502 · 30004
{ "request_id": "req_example", "error": { "code": "provider_adapter_not_found", "numeric_code": "30004", "message": "Provider adapter unavailable" } }- provider_unavailable · 30002 · 502
渠道服務暫時無法使用,請檢查狀態或稍後再試;重試寫入操作前先確認上次結果。
處理與重試: 保留 request_id,核對目標識別碼同帳號存取範圍。查明原因後再試查詢;查詢失敗唔代表結果為空或資源不存在。
範例 · 502 · 30002
{ "request_id": "req_example_provider_unavailable", "error": { "code": "provider_unavailable", "numeric_code": "30002", "message": "Provider service unavailable" } }- provider_unavailable · 30010 · 502
渠道未能完成本次操作。message 可能喺「Provider operation failed:」後附原始原因;文字可以改動,唔係穩定嘅程式介面。
處理與重試: 保留 request_id,核對目標識別碼同帳號存取範圍。查明原因後再試查詢;查詢失敗唔代表結果為空或資源不存在。
適用渠道: WhatsApp
範例 · 502 · 30010
{ "request_id": "req_example_operation_failed", "error": { "code": "provider_unavailable", "numeric_code": "30010", "message": "Provider operation failed: Example operation could not be completed" } }- provider_unavailable · 30021 · 502
本次請求時帳戶未連線至訊息平台。WhatsApp 新增聯絡人可傳回 500 / create_contact_failed / 30021。這不代表帳戶已登出,也不保證目前運行狀態仍為 disconnected;請先查詢目前狀態,再選擇復原操作。
處理與重試: 暫停依賴連線嘅業務操作。先調用 POST /v1/accounts/{account_id}/runtime/refresh,按最新狀態恢復,確認 runtime_status=running 後再請求業務介面。重發前確認上次寫入結果。
適用渠道: WhatsApp
範例 · 502 · 30021
{ "request_id": "req_example_connection_disconnected", "error": { "code": "provider_unavailable", "numeric_code": "30021", "message": "example operation: websocket not connected" } }