Integrate an agent with WeCom

Updated at:
Copy as MD

This topic describes how to connect an agent in AgentRun to WeCom. This integration allows you to interact with the agent in WeCom group chats or direct messages by mentioning (@) the bot.

Prerequisites

Step 1: Create a WeCom bot

1. Create the bot and get credentials

  1. Log in to the WeCom admin console.

  2. In the left-side navigation pane, choose Security and Management > Management Tools. Find Intelligent Bot and click Create Bot.

  3. In the dialog box that appears, click Create Manually.

  4. Scroll to the bottom of the page and click Create in API Mode to switch the creation mode.

  5. Configure the bot's visibility scope as needed. For the connection method, select Use long-lived connection and click Get Secret.

    You will need the Bot ID and bot secret to configure the WeCom integration in AgentRun. Store them securely.
  6. Click Save, enter a name and description for the bot, and then click OK.

2. Share the bot

  1. After the bot is created, click More in the upper-right corner and select Get Bot QR Code or Get Bot Link as needed.

  2. Send the QR code or link to WeCom users within the bot's visibility scope.

  3. Users can then scan the QR code or open the link in the WeCom mobile app to chat with the bot or add it to a group.

Step 2: Configure WeCom integration

  1. Log in to the AgentRun console.

  2. Click the name of the desired agent to go to its details page.

  3. Click the Integration and Publishing tab, click IM Integration, and then click Add IM Bot.

  4. In the Add IM Bot panel, set Robot Mode to Standard Bot, set Select Platform to WeCom Bot, and then configure the following parameters:

    Parameter

    Description

    Robot Name

    Enter a display name for the bot. Maximum 128 characters.

    Description

    (Optional) Enter a description for the bot. Maximum 256 characters.

    Robot Mode

    Select Standard Bot to process messages using an Agent Endpoint.

    Select Endpoint

    Select a published Agent Endpoint. The bot uses this endpoint to process messages.

    Select Protocol

    Select a protocol specification for message processing. If one does not exist, click Add Protocol to create one, or click Refresh Protocol List to update.

    WeCom Application ID

    The WeCom bot application ID (AgentId) from Step 1. You can get it from the WeCom Developer Center.

    WeCom Application Secret

    The WeCom bot secret from Step 1.

    Enable upon Creation

    Selected by default. The bot starts running immediately after creation. If cleared, the bot is created in a stopped state and can be enabled later from the list.

  5. Click Create Bot to complete the WeCom integration.

    Note

    After you enable the integration, AgentRun establishes a long-lived connection with WeCom, reserving a dedicated instance for this purpose. This instance incurs charges. For more information, see Billing Overview.

Step 3: Use the agent

After the configuration is complete, you can chat with the agent in WeCom group chats or direct messages.

Use in a group chat

  1. In WeCom, create a new group chat or open an existing one.

  2. In the group settings, add the bot that you created in Step 1.

  3. In the group chat, @ the bot and enter your question.

Use in a direct message

In the WeCom search bar, search for the bot's name, open the chat window, and send a message to start a conversation.