Skip to main content

Creating a Bot

First, log in to the WeCom Admin Console. Homepage Click Security And Management in the left sidebar, then click Intelligent Bot under Management Tool. As shown: Intelligent Bot Click Create Bot and select Manual Creation, scroll to the bottom of the page, click Create via API Mode, and enter the page: Create via API Mode

Long Connection Configuration

Enable Long Connection API Mode

In the WeCom Admin Console, go to the Intelligent Bot configuration page, enable “API Mode” and select “Long Connection”: Long Connection Mode

Obtaining Credentials

After enabling the Long Connection API mode, you need to obtain the following credentials to establish the connection:
CredentialDescription
BotIDThe unique identifier of the intelligent bot, used to identify the bot
SecretThe dedicated key for long connections, used for identity verification
Note:
  • The Secret is a dedicated key for long connections, which is different from the Token/EncodingAESKey used in the callback URL mode
  • Please keep the Secret safe and avoid leaking it
  • Mode switching impact: API mode can only use one method (long connection or callback URL). Switching to “Callback URL” mode will invalidate existing long connections; conversely, switching from “Callback URL” to “Long Connection” mode will make the original callback URL no longer effective

Configuring the Bot

Start the LangBot main program, select the adapter WeCom Intelligent Bot, and fill in the configuration items. Enter the BotID, Secret, and bot name from the long connection into the fields, click save and enable.
The bot name must match the name of the newly created bot, otherwise the bot will not respond in group chats.
Long Connection Configuration

URL Callback Configuration

Click to randomly generate Token and EncodingAESKey, then fill in the basic bot information above. Pay attention to setting the visibility scope. Parameter Retrieval Click My Company in the left sidebar and save the Company ID at the bottom.

Configuring Callback URL

Start the LangBot main program, select the adapter WeCom Intelligent Bot, and fill in the configuration items.
Among them, the token is Token, the Encoding-AESKey is EncodingAESKey, and the Bot ID can be filled in as xxx (or filled in randomly, it will be changed later). After filling in, click
Save, and Enable the robot.
WeCom Intelligent Bot Adapter On the LangBot homepage, enable and select the corresponding bot, click to enter the configuration page, copy the Webhook callback address
We recommend that you first refer to Configure HTTP Reverse Proxy to configure the LangBot callback address.
Webhook Callback Address Return to the WeCom robot configuration page and fill the copied webhook address into URL Callback. If the creation is successful, it will jump to the details page. If the message Request URL Failed appears, please double-check whether the above steps have been completed one by one. Details page after successful creation:\ Creation Successful Copy the Bot ID and bot name from the WeCom robot details page, return to the LangBot management page, change the Bot ID of the deployed intelligent robot to the copied ID, fill in the bot name, and restart the robot.

Enable Streaming

A streaming toggle has been added for locally deployed models or models that do not support streaming. Streaming Toggle

Start Using

Enter WeCom, click , as shown: Add Bot Click Company-Created, select the created bot, and enter the chat interface. Similarly, if you want to invite the bot to a group chat, click the add member button in the group chat and add the bot from there.

Effect Images

Effect Image 1