> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryvox.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 위챗 채널

> 위챗 채널을 API로 만들 때 넣는 값, 쓸 수 있는 작업, 응답 필드를 볼 수 있어요.

`channel`이 `wechat`인 채널의 API 계약이에요. 연결 절차는 [위챗 연결과 운영](https://docs.tryvox.co/docs/operate/deploy/integrations/wechat/overview.md)에 있어요.

## 생성 요청

[채널 생성](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-생성.md)의 `params`에 아래 값을 넣어요. `name`, `agent` 같은 공통 필드는 채널 생성 페이지에 있어요.

| 필드 | 타입 | 필수 | 설명 |
| - | - | - | - |
| `app_id` | string | 필수 | 서비스 계정 AppID입니다. |
| `original_id` | string | 필수 | 원시 ID입니다(`gh_`로 시작). |
| `message_mode` | string | 필수 | 위챗 서버 설정의 메시지 암호화 모드입니다. `plaintext` 또는 `safe`입니다. |
| `app_secret` | string | 필수 | 서비스 계정 AppSecret입니다. 암호화해 저장하며 응답에 반환하지 않습니다. |
| `token` | string | 필수 | 위챗 서버 설정에 넣는 웹훅 서명용 Token입니다. 암호화해 저장하며 응답에 반환하지 않습니다. |
| `encoding_aes_key` | string \| null | 선택 | `safe` 모드에 필요한 EncodingAESKey입니다(영문·숫자 43자). 암호화해 저장하며 응답에 반환하지 않습니다. |

```json 요청 theme={null}
{
  "channel": "wechat",
  "name": "고객지원 위챗",
  "agent": {
    "agent_id": "44444444-4444-4444-8444-444444444444",
    "agent_version": "production"
  },
  "params": {
    "app_id": "wx00000000example0",
    "original_id": "gh_000000example",
    "message_mode": "safe",
    "app_secret": "EXAMPLE_WECHAT_APP_SECRET",
    "token": "EXAMPLE_WECHAT_TOKEN",
    "encoding_aes_key": "EXAMPLE000000000000000000000000000000000000"
  }
}
```

```json 201 응답 theme={null}
{
  "chat_channel": {
    "id": "77777777-7777-4777-8777-777777777777",
    "organization_id": "55555555-5555-4555-8555-555555555555",
    "status": "disabled",
    "status_detail": null,
    "operation_enabled": false,
    "name": "고객지원 위챗",
    "display_name": "고객지원 위챗",
    "agent": {
      "agent_id": "44444444-4444-4444-8444-444444444444",
      "agent_version": "production"
    },
    "initial_responder_type": "agent",
    "created_at": 1794351600000,
    "updated_at": 1794351600000,
    "allow_agent_response": true,
    "channel": "wechat",
    "details": {
      "last_received_at": null,
      "last_error_code": null,
      "last_error": null,
      "app_id": "wx00000000example0",
      "original_id": "gh_000000example",
      "message_mode": "safe",
      "webhook_url": "https://client-api.tryvox.co/wechat/9a9a9a9a-0000-4000-8000-000000000003/events",
      "verified_at": 1794351600000
    }
  },
  "verification": null
}
```

## 쓸 수 있는 작업

* [채널 생성](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-생성.md)
* [채널 목록 조회](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-목록-조회.md)
* [채널 조회](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-조회.md)
* [채널 수정](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-수정.md)
* [채널 인증 신청](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-인증-신청.md)
* [채널 활성화](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-활성화.md)
* [채널 비활성화](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-비활성화.md)
* [채널 연결 해제](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-연결-해제.md)

위챗 채널에는 채널 삭제, 채널 재연결을 쓸 수 없어요.

## 수정할 수 있는 값

[채널 수정](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-수정.md)의 `params`에 아래 값을 넣어요. 보내지 않은 값은 그대로예요.

| 필드 | 타입 | 설명 |
| - | - | - |
| `app_id` | string \| null | 새 서비스 계정 AppID입니다. |
| `original_id` | string \| null | 새 원시 ID입니다(`gh_`로 시작). |
| `message_mode` | string \| null | 새 메시지 암호화 모드입니다. `plaintext` 또는 `safe`입니다. |
| `app_secret` | string \| null | 새 AppSecret입니다. |
| `token` | string \| null | 새 웹훅 서명용 Token입니다. |
| `encoding_aes_key` | string \| null | 새 EncodingAESKey입니다(영문·숫자 43자). |

## 응답의 `details`

[채널 조회](https://docs.tryvox.co/api-reference/v3/chat-channels/채널-조회.md) 응답의 `details`에 아래 값이 있어요.

| 필드 | 타입 | 설명 |
| - | - | - |
| `last_received_at` | integer \| null | 이 채널로 고객 메시지를 마지막으로 받은 시각입니다(unix ms). 받은 적이 없으면 null입니다. |
| `last_error_code` | string \| null | 지원 종료 예정입니다. `last_error.code`와 같은 값이므로 `last_error`를 쓰세요. 최근 연결·운영 오류 코드이며, 없으면 null입니다. |
| `last_error` | LastError \| null | 최근 연결·운영 오류입니다. 없으면 null입니다. 모든 채널이 같은 구조로 반환합니다. `message`는 카카오만 채우고 다른 채널은 null입니다. |
| `app_id` | string | 서비스 계정 AppID입니다. |
| `original_id` | string | 원시 ID입니다(`gh_`로 시작). |
| `message_mode` | string | 위챗 서버 설정의 메시지 암호화 모드입니다. `plaintext` 또는 `safe`입니다. |
| `webhook_url` | string | 공급자 화면에 넣는 전체 웹훅 주소입니다. `https://client-api.tryvox.co`로 시작합니다. |
| `verified_at` | integer \| null | AppID와 AppSecret으로 위챗 액세스 토큰 발급에 마지막으로 성공한 시각입니다(unix ms). 웹훅이 도달했는지를 뜻하지는 않습니다. |

## 받는 메시지

글자만 읽어요. 읽지 않는 메시지의 처리는 [위챗 연결과 운영](https://docs.tryvox.co/docs/operate/deploy/integrations/wechat/overview.md#지원하는-메시지)에 있어요.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.