POST /api/v1/forward/channels
外部メッセージングプラットフォーム向けのチャネルインスタンスを作成します。チャネルは受信 IM メッセージを受け取り、設定されたプロバイダーを通じて返信を送信します。
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT> |
Content-Type | Yes | application/json |
Idempotency-Key | No | 安全でないリクエスト向けの任意のべき等性キー。 |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
identity_id | string | Yes | Forward Identity ID。呼び出し元に属し、有効になっている必要があります。 |
template_id | string | Yes | チャネルがセッションを作成する際に使用する Forward Template ID。 |
channel_type | string | Yes | チャネルタイプ。現在は wechat、wecom、feishu、dingtalk をサポートします。 |
name | string | No | チャネルの表示名。 |
channel_config.credentials | object | Conditional | チャネルの実行時認証情報。QR 認可チャネルでは省略できます。直接認証情報を使うチャネルはプロバイダー固有のフィールドを使用します。feishu は app_id/app_secret、dingtalk は client_id/client_secret、wecom は bot_id/secret を使用します。認証情報は平文では返されません。 |
channel_config.response_options | object | No | 返信の表示設定。 |
Example request
Example response
HTTP 201 CreatedResponse fields
| Field | Type | Description |
|---|---|---|
id | string | チャネル ID。プレフィックスの例は channel_ です。 |
type | string | 常に channel。 |
identity_id | string | 紐づけられた Forward Identity ID。 |
template_id | string | 紐づけられた Forward Template ID。 |
channel_type | string | 外部チャネルタイプ。 |
enabled | boolean | 手動での有効化・無効化スイッチ。 |
binding_status | string | unbound、bound、または expired。 |
channel_config.response_options | object | 返信の表示設定。 |
Errors
| HTTP | Type | Code | Trigger |
|---|---|---|---|
| 400 | invalid_request_error | channel_type_unsupported | チャネルタイプがサポートされていません。 |
| 404 | not_found_error | channel_template_not_found | Template が存在しないか、参照できません。 |
| 404 | not_found_error | channel_identity_not_found | Identity が存在しないか、参照できません。 |
| 409 | conflict_error | channel_identity_disabled | Identity が無効になっています。 |
| 409 | conflict_error | channel_auth_required | 必要な認証情報または QR 認可が不足しています。 |
| 502 | api_error | channel_auth_failed | 基盤となるチャネルの認可に失敗しました。 |
Notes
- 新規チャネルはデフォルトで
enabled=trueになります。 - チャネルが受信メッセージを処理できるのは、
enabled=trueかつbinding_status="bound"の場合のみです。 - 受信処理を一時的に停止するには、Update Channel で
enabled=falseを指定することをおすすめします。