IM Channel Integration Guide
IM Channel Integration allows you to connect Wegent agents to instant messaging platforms, enabling users to interact with AI agents directly within their familiar chat tools.
π Table of Contentsβ
- Overview
- Architecture
- Using IM Channels
- Management Features
- User Mapping Mechanism
- Platform Integration Guides
- Troubleshooting
- Related Resources
π― Overviewβ
What is IM Channel Integration?β
IM Channel Integration connects Wegent agents to instant messaging platforms, allowing users to chat with AI agents directly in their preferred messaging apps without accessing the Wegent web interface.
Core Benefitsβ
| Benefit | Description |
|---|---|
| Familiar Environment | Use AI agents in the chat tools you already use daily |
| Real-time Responses | Get streaming AI responses through platform cards or message updates |
| Multi-turn Conversations | Maintain context across multiple messages |
| Team Collaboration | Share AI capabilities with your entire organization |
Supported Platformsβ
| Platform | Status | Features |
|---|---|---|
| DingTalk | β Available | Stream mode, AI Card streaming, multi-turn conversations |
| Telegram | β Available | Private chat, command flow, Chat/Task modes, streaming message updates |
| Discord | β Available | Private chat, command flow, Chat/Task modes |
| Weibo DM | β Available | Private chat, WebSocket connection, streaming message accumulation, Wework local task continuation |
| Feishu/Lark | π Planned | Coming soon |
| WeChat Work | π Planned | Coming soon |
π Architectureβ
Message Flowβ
The following diagram illustrates how messages flow through the IM integration system:
Key Componentsβ
| Component | Purpose |
|---|---|
| Channel Manager | Manages lifecycle of all IM channel connections |
| Channel Provider | Platform-specific connection handler (DingTalk, Telegram, Discord, etc.) |
| Message Handler | Processes incoming messages and routes to agents |
| Response Emitter | Sends AI responses back to IM platform (sync or streaming) |
π¬ Using IM Channelsβ
Basic Conversationβ
Simply send messages to the bot in your IM platform as you would in any chat:
User: What can you help me with?
Bot: I'm an AI assistant powered by Wegent. I can help you with...
Multi-turn Conversationsβ
The bot maintains conversation context within the same chat session:
User: I'm working on a React project
Bot: Great! I'd be happy to help with your React project...
User: How do I optimize performance?
Bot: For your React project, here are some performance optimization tips...
Starting a New Conversationβ
To clear context and start fresh, use the /new command:
User: /new
Bot: Started a new conversation. How can I help you?
Streaming Responsesβ
When platform streaming is enabled, you'll see responses appear in real time:
- Bot shows "Thinking..." indicator
- Response text streams in progressively
- Final response is displayed with formatting
DingTalk uses AI Card updates for streaming content. Telegram uses message updates to show streaming content and reasoning summaries.
Weibo DM uses one stable message for streaming accumulation: the backend creates a stable Weibo messageId, then later content chunks and completion events update the same DM message. Runtime status events, such as "analyzing the issue", provide progress context, so the Weibo channel does not add an extra "thinking" placeholder.
Private Chat Task Modeβ
In IM channels that support private chats, use commands to choose chat or task mode:
| Command | Description |
|---|---|
/new | Create a Chat, create a Task, or continue a recent Task |
/chat | Switch to Chat mode |
/task | Switch to Task mode and select a recent task |
/switch | Select a different current task |
/bind | Bind the current private chat to a task |
/status | View current private chat status |
/cancel | Cancel the current selection flow |
Weibo DM Task mode only supports local runtime tasks bound from Wework. First click Continue in private chat from the Wework local task, choose the Weibo private chat, and then continue sending messages in Weibo. If you use /task or /switch directly in Weibo without a bound local task, Wegent prompts you to return to Wework and choose a target private chat.
βοΈ Management Featuresβ
Channel Status Monitoringβ
View channel health in the admin panel:
| Status | Indicator | Description |
|---|---|---|
| Connected | π’ Green | Channel is active and receiving messages |
| Disconnected | π΄ Red | Channel is offline or experiencing errors |
| Disabled | βͺ Gray | Channel is manually disabled |
Channel Operationsβ
| Operation | Description |
|---|---|
| Enable/Disable | Toggle channel without deleting configuration |
| Restart | Reconnect to IM platform (useful after network issues) |
| Edit | Modify channel settings (leave secret empty to keep existing) |
| Delete | Remove channel configuration |
Updating Configurationβ
When editing a channel:
- Sensitive fields (Client Secret) are masked with
*** - Leave sensitive fields empty to keep existing values
- Enter new values to update credentials
Weibo DM Configurationβ
When creating a Weibo DM channel:
- In Admin Panel β IM Channels, choose Weibo.
- DM Weibo Longxia Assistant to get the App ID and App Secret.
- Enter the App ID and App Secret in Wegent.
- Usually leave the WebSocket endpoint and token endpoint empty so Wegent uses the default Weibo Open IM endpoints; override them only for a proxy or test environment.
- Select the default Agent and enable the channel.
When editing, leave App Secret empty to keep the existing value.
Monitoring Metricsβ
Available metrics for each channel:
- Uptime: How long the channel has been connected
- Last Error: Most recent error message (if any)
- Connection Time: When the channel was last connected
π₯ User Mapping Mechanismβ
Automatic User Creationβ
When an IM platform user interacts with the bot for the first time:
- System attempts to find existing Wegent user
- If not found, automatically creates a new user account
- User is linked to their IM platform identity
Default user creation:
- Username: IM platform user ID
- Email:
{user_id}@im-platform.com - Auth Source: Corresponding IM platform name
Enterprise User Mappingβ
For organizations with existing user directories (ERP, LDAP), custom user mappers can be configured:
Contact your system administrator to configure enterprise user mapping.
π Platform Integration Guidesβ
The following platforms have detailed integration configuration guides:
| Platform | Link |
|---|---|
| DingTalk | DingTalk Integration Guide |
β Troubleshootingβ
Connection Issuesβ
Channel shows "Disconnected"β
Possible causes:
- Invalid Client ID or Client Secret
- Network connectivity issues
- IM platform API service disruption
Solutions:
- Verify credentials in the open platform
- Check network connectivity from Wegent server
- Try restarting the channel
- Check IM platform service status
Messages not being receivedβ
Possible causes:
- Required message receiving or streaming capability is not enabled in the IM platform
- Robot permissions not configured
- Channel not enabled in Wegent
Solutions:
- Verify message receiving or streaming is enabled in IM app settings
- Check all required permissions are granted
- Ensure channel is enabled (toggle is on)
Response Issuesβ
Bot not respondingβ
Possible causes:
- Default Agent not configured
- Agent has no model assigned
- Rate limiting
Solutions:
- Verify a default Agent is selected for the channel
- Ensure the Agent has a working model configuration
- Check for rate limit errors in channel status
Slow or incomplete responsesβ
Possible causes:
- Platform streaming or message update issues
- Network latency
- Large response content
Solutions:
- Try disabling platform streaming temporarily
- Check network connectivity
- The system will fall back to sync mode if streaming fails
User Issuesβ
User not recognizedβ
Possible causes:
- User mapping configuration issues
- IM platform user info not accessible
Solutions:
- Check user permissions in IM app
- Verify user mapping configuration
- Contact administrator for enterprise user mapping
π Related Resourcesβ
Documentationβ
- Core Concepts - Understand Wegent's architecture
- Agent Settings - Configure agents for IM channels
- Configuring Models - Set up AI models
- DingTalk Integration Guide - Detailed DingTalk setup steps
External Resourcesβ
π¬ Get Helpβ
Need assistance?
- π Check FAQ
- π Submit GitHub Issue
- π¬ Join community discussions
Connect your AI agents to IM platforms and empower your team! π