建立綁定 Identity 和 Template 的外部 IM Channel。
要求標頭
Header | 是否必填 | 說明 |
Authorization | 是 |
|
Content-Type | 是 |
|
Idempotency-Key | 否 | 有副作用請求可選的等冪鍵。 |
請求體參數
參數 | 類型 | 是否必填 | 說明 |
| string | 是 | Forward Identity ID,必須屬於當前調用方且已啟用。 |
| string | 是 | 收到訊息並建立 Session 時使用的 Forward Template ID。 |
| string | 是 | 渠道類型,當前支援 |
| string | 否 | Channel 展示名。 |
| boolean | 否 | 人工啟停開關,預設 |
| object | 條件必填 | 渠道運行憑據。掃碼授權類渠道可省略;直連憑據類渠道按 channel_type 傳入:feishu 為 app_id/app_secret,dingtalk 為 client_id/client_secret,wecom 為 bot_id/secret。憑據不明文回顯。 |
| object | 否 | 回複內容可見度配置。 |
樣本請求
curl -s -X POST 'https://api.qoder.com.cn/api/v1/forward/channels' \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"identity_id": "idn_019eabc123",
"template_id": "tmpl_support",
"channel_type": "feishu",
"name": "Support Feishu channel",
"enabled": true,
"channel_config": {
"credentials": {
"app_id": "...",
"app_secret": "..."
},
"response_options": {
"include_tool_calls": false,
"include_thinking": false
}
}
}'
樣本響應
HTTP 201 Created
{
"id": "channel_019eabc123",
"type": "channel",
"identity_id": "idn_019eabc123",
"template_id": "tmpl_support",
"channel_type": "feishu",
"name": "Support Feishu channel",
"enabled": true,
"binding_status": "bound",
"channel_config": {
"response_options": {
"include_tool_calls": false,
"include_thinking": false
}
},
"created_at": "2026-06-18T10:00:00Z",
"updated_at": "2026-06-18T10:00:00Z"
}
響應欄位
欄位 | 類型 | 說明 |
| string | Channel ID,首碼 |
| string | 固定為 |
| string | 綁定的 Forward Identity ID。 |
| string | 綁定的 Forward Template ID。 |
| string | 外部渠道類型。 |
| boolean | 人工啟停開關。 |
| string |
|
錯誤
HTTP | Type | 觸發條件 |
400 |
| 渠道類型不支援。 |
400 |
| 缺少必要憑據。 |
404 |
| Template 不存在或不可見。 |
404 |
| Identity 不存在或不可見。 |
409 |
| Identity 已停用。 |
409 |
| 憑證校正衝突。 |
502 |
| 渠道服務不可用。 |
401 |
| PAT 無效或已到期。 |
403 |
| 渠道數量超出配額上限。 |
備忘
enabled為可選入參,預設true;傳false可在綁定完成前暫不啟用。只有
enabled=true且binding_status=bound時才可處理上行訊息。如果只是臨時停止處理上行訊息,優先使用 Update Channel 設定
enabled=false。