All Products
Search
Document Center

Seri Qoder CN:Buat channel

Last Updated:Jul 04, 2026

Buat channel IM eksternal yang terikat pada suatu Identity dan Template.

Header permintaan

Header

Wajib

Deskripsi

Authorization

Ya

Bearer <PAT>

Content-Type

Ya

application/json

Idempotency-Key

Tidak

Kunci idempotensi opsional untuk permintaan tidak aman.

Isi permintaan

Parameter

Tipe

Wajib

Deskripsi

identity_id

string

Ya

ID Forward Identity. Harus dimiliki oleh pemanggil dan dalam keadaan aktif.

template_id

string

Ya

ID Forward Template yang digunakan saat channel membuat session.

channel_type

string

Ya

Tipe channel. Nilai yang didukung: wechat, wecom, feishu, dan dingtalk.

name

string

Tidak

Nama tampilan channel.

channel_config.credentials

object

Bersyarat

Wajib untuk channel berbasis token atau kredensial aplikasi. Channel otorisasi QR dapat mengosongkannya dan mengaktifkan nanti.

channel_config.response_options

object

Tidak

Pengaturan visibilitas balasan.

Contoh permintaan

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",
    "channel_config": {
      "credentials": {
        "app_key": "...",
        "app_secret": "..."
      },
      "response_options": {
        "include_tool_calls": false,
        "include_thinking": false
      }
    }
  }'

Contoh respons

HTTP 201 Created

{
  "id": "ci_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"
}

Bidang respons

Bidang

Tipe

Deskripsi

id

string

ID channel. Contoh awalan adalah ci_.

type

string

Selalu channel.

identity_id

string

ID Forward Identity yang terikat.

template_id

string

ID Forward Template yang terikat.

channel_type

string

Tipe channel eksternal.

enabled

boolean

Saklar aktif/nonaktif manual.

binding_status

string

unbound, bound, atau expired.

channel_config.response_options

object

Pengaturan visibilitas balasan.

Kesalahan

HTTP

Tipe

Kode

Pemicu

400

invalid_request_error

channel_type_unsupported

Tipe channel tidak didukung.

401

authentication_error

TOKEN_INVALID

PAT tidak valid atau telah kedaluwarsa.

404

not_found_error

channel_template_not_found

Template tidak ada atau tidak terlihat.

404

not_found_error

channel_identity_not_found

Identity tidak ada atau tidak terlihat.

409

conflict_error

channel_identity_disabled

Identity dinonaktifkan.

409

conflict_error

channel_auth_required

Kredensial atau otorisasi QR yang diperlukan tidak tersedia.

502

api_error

channel_auth_failed

Otorisasi channel dasar gagal.

Catatan

  • user_id diturunkan secara internal dari otentikasi dan tidak pernah diekspos.

  • Channel baru secara default memiliki nilai enabled=true.

  • Channel hanya dapat memproses pesan inbound jika enabled=true dan binding_status="bound".

  • Penghapusan atau pengarsipan channel tidak didukung. Nonaktifkan channel melalui Update channel sebagai gantinya.