Create an external IM channel bound to an Identity and Template.
POST /api/v1/forward/channels
Creates a channel instance for an external messaging platform. The channel receives inbound IM messages and sends replies through the configured provider.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT or SAT> |
Content-Type | Yes | application/json |
Idempotency-Key | No | Optional idempotency key for unsafe requests. |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
identity_id | string | Conditional | Required for fixed mode; omit for pairing mode. |
identity_resolution.mode | string | No | Identity resolution mode: fixed (default) or pairing. |
template_id | string | Conditional | Required for fixed mode; omit for pairing mode. |
channel_type | string | Yes | Channel type. Currently supports wechat, wecom, feishu, and dingtalk. |
name | string | No | Channel display name. |
channel_config.credentials | object | Conditional | Channel runtime credentials. QR authorization channels may omit it. Direct credential channels use provider-specific fields: feishu uses app_id/app_secret, dingtalk uses client_id/client_secret, and wecom uses bot_id/secret. Credentials are not returned in plaintext. |
channel_config.response_options | object | No | Reply visibility settings. |
Example request
pairing mode creates only the transport connection without specifying an Identity or Template:
Example response
HTTP 201 Created
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Channel ID. Example prefix is channel_. |
type | string | Always channel. |
identity_id | string|null | Bound Forward Identity ID in fixed mode; null in pairing mode. |
identity_resolution.mode | string | Identity resolution mode: fixed or pairing. |
template_id | string|null | Bound Forward Template ID in fixed mode; null in pairing mode. |
channel_type | string | External channel type. |
enabled | boolean | Manual enable or disable switch. |
binding_status | string | unbound, bound, or expired. |
channel_config.response_options | object | Reply visibility settings. |
Error codes
| HTTP | Type | Trigger |
|---|---|---|
| 400 | invalid_request_error | Channel type is unsupported. |
| 400 | invalid_request_error | Identity resolution mode does not match identity_id/template_id combination. |
| 400 | invalid_request_error | Required credentials are missing. |
| 401 | authentication_error | PAT or SAT is invalid or expired. |
| 403 | permission_error | Channel quota exceeded. |
| 404 | not_found_error | Template does not exist or is not visible. |
| 404 | not_found_error | Identity does not exist or is not visible. |
| 409 | conflict_error | Identity is disabled. |
| 409 | conflict_error | Credential validation conflict. |
| 502 | api_error | Channel service unavailable. |
Notes
- New channels default to
enabled=true. - A channel can process inbound messages only when
enabled=trueandbinding_status="bound". fixedmode always uses the Identity and Template specified at creation time.pairingmode means the channel is only a transport connection; Identity and Template are bound per message scope via the Pairing API.identity_resolution.modecannot be changed after creation.- To pause inbound processing temporarily, prefer Update Channel with
enabled=false.