---
title: Connect a WeCom Smart Bot to Leina
description: Create an API-mode WeCom smart bot with a long connection, enter
  Bot ID and Secret in Leina, and check business-data authorization.
lang: en
canonical_url: https://leina.ai/docs/wecom/
markdown_url: https://leina.ai/docs/wecom.md
updated: 2026-10-07
---

# Connect a WeCom Smart Bot to Leina

This guide covers **an API-mode smart bot using a long connection**, configured with Bot ID and Secret. Personal WeCom account sign-in is a separate option. Before setup, [compare the two connection methods](/ai-agent-for-wecom/).

## Before you start

- Access to WeCom's smart-bot creation flow and the permissions required by your organization.
- Access to the intended team and bot in [Leina Console](https://console.leina.ai/bots).
- An active Leina subscription or trial.
- Business-account authorization for any CRM, ERP, or document task you plan to run.

If creation or a required capability is unavailable, ask the person who administers WeCom for your organization. The steps below preserve the Chinese UI labels.

## Create the smart bot in WeCom

1. Open **工作台** (Workbench), then **智能机器人** (Smart Bot).
2. Select **创建机器人** (Create Bot), then **手动创建** (Manual Creation).
3. Under **更多设置** (More Settings), select **API 模式创建** (API Mode Creation).
4. Choose **使用长连接** (Use a Long Connection).

![Select API mode and a long connection in the smart-bot creation screen](/img/chat-platforms/wecom-api-mode.webp)

5. Choose **仅个人使用** (Personal Use) or **多人使用** (Multi-user Use), then authorize the WeCom capabilities your task needs.
6. Copy **Bot ID**, obtain **Secret**, and save the bot.

Personal or multi-user use controls the scope of this API bot. It does not sign in to a personal WeCom account or activate the separate personal-account option.

![The Get Secret entry and Save button in the long-connection settings](/img/chat-platforms/wecom-credentials.webp)

Use credentials from the bot you created; do not copy the Bot ID in the image.

## Connect it to Leina

1. Open [Bots](https://console.leina.ai/bots) in Leina Console and select the intended bot.
2. Open **企业微信机器人** (WeCom Bot).
3. Enter the **Bot ID** and **Secret** from WeCom.
4. Select **连接企业微信** (Connect WeCom). If an error appears, check the credentials and connection mode. Submitting the form alone does not establish a successful connection.

The connection form states that Secret is stored encrypted and its full value is not shown after connection. Enter it only in the connection form; do not paste it into task messages, shared documents, or support screenshots.

## Confirm the bot receives messages

Send the configured bot a WeCom message that needs no external data, such as “Hello, introduce yourself in one sentence.” Once it replies, test a business task.

If it does not reply, check the bot's active status in Leina, that the connection uses the intended Bot ID, and its WeCom usage scope. See “If setup or a task fails” below.

## Authorize business data and verify one task

Connecting the bot establishes the chat entry point. To work with business records, use [Connections](https://console.leina.ai/connections) to authorize the relevant App and check its supported actions.

Start with non-sensitive records whose expected result is known. Verify the task using the intended member and conversation, not only an administrator account. For example:

> Read the authorized project notes for the specified week. Return the completed work, open questions, and source links. Do not change the source records.

Check the returned sources and the conversation's participants before adding real workloads.

## Personal-account sign-in and external groups

Leina Console lists **个人账号接入** (Personal Account Access) separately from the smart-bot connections. Its personal WeCom option is described as supporting private/group chats, WeChat contacts, and external WeCom groups.

Personal-account activation has a separate charge; see [pricing](/pricing/). Access it through Personal Account Access in Leina Console; the Bot ID/Secret steps above apply only to the API-mode bot. Personal-account external-group support does not establish the same support for the API-mode bot.

## If setup or a task fails

| What you see | What to check |
| --- | --- |
| Smart-bot creation or a required capability is unavailable | Your organization's WeCom access and capability policy. |
| Leina cannot connect | You selected API mode and a long connection, saved the intended bot, and entered its matching Bot ID and Secret. |
| The bot is connected but paused | Its subscription or renewal status in Leina Console. |
| Chat works but business records are missing | The separate App connection, source account permissions, supported action, and member/group access. |
| You need an external customer group | Evaluate the personal-account option separately; do not assume the API-mode route has the same capabilities. |

For unresolved issues, send [support](/support/) the connection type, error text, and time of the attempt. Omit credentials and unrelated business data.

Read [permissions and data access](/docs/permissions/) before sharing a connection or sending results to a group. See [billing](/docs/billing/) for the difference between subscriptions and usage charges.

Steps were checked against Leina Console's existing five-step credential guide and connection form on October 7, 2026.
