# WeCom AI Bot Trigger
Trigger workflows via WeCom (Enterprise WeChat) intelligent bot messages. Based on WebSocket long connection protocol — no public IP required, no message encryption/decryption needed.
# Features
- WebSocket Long Connection: No public IP required, no message encryption
- Auto Heartbeat: 30-second interval keep-alive
- Auto Reconnect: Exponential backoff strategy, unlimited reconnection
- Multiple Message Types: Text, image, voice, file, video, mixed
- Stream Reply: Supports streaming output for LLM scenarios
# Input Parameters
# Create WeCom AI Bot Credential
Go to App Development > Credential Management → Add Credential → select WeCom AI Bot type.
Required fields:
| Field | Description |
|---|---|
| Bot ID | Bot ID (obtained from WeCom admin console → Intelligent Bot page) |
| Secret | Long connection secret (obtained from WeCom admin console) |
# How to Get Bot ID and Secret
- Open the WeCom PC client
- Click Workbench on the left sidebar
- Under WeCom features, select Intelligent Bot
- Click Create Bot
- Scroll to the bottom and select API Mode to create
- For connection method, select: Use Long Connection
- After creation, you can find the Bot ID and Secret on the bot detail page
# Message Types
| Type | Description |
|---|---|
| text | Text message |
| image | Image message |
| voice | Voice message (auto speech-to-text) |
| file | File message |
| video | Video message |
| mixed | Rich text (mixed text and images) |
# Trigger Scope
Any Input
All user messages will trigger the workflow.
Command Input
Only specific commands trigger the workflow, e.g.,
/help,/query -k test. Command parameters are automatically parsed.Supported parameter types:
- Boolean
- Integer
- Float
- String
Example input:
/nmap -h 1.1.1.1 -p 22Output:
{ "cmdParameters": { "h": "1.1.1.1", "p": 22 }, "command": "/nmap -h 1.1.1.1 -p 22", "from": { "chatType": "single", "id": "user001", "username": "user001" }, "origin": "" }
# Debug Data
Debug data simulates the app's runtime output for workflow design testing.
Example:
{
"msgtype": "text",
"chattype": "single",
"chatid": "test_user_001",
"from": {"userid": "test_user_001"},
"text": {"content": "hello"}
}
# Output
{
"cmdParameters": {
"h": "1.1.1.1",
"p": 22
},
"command": "/test -h 1.1.1.1 -p 22",
"message": {
"text": "/test -h 1.1.1.1 -p 22",
"type": "text"
},
"from": {
"chatType": "single",
"id": "user001",
"username": "user001"
},
"origin": ""
}
- cmdParameters: Parsed command parameter key-value map
- command: Full user input text
- message
- text: Message text content
- type: Message type (text/image/voice/file/video/mixed)
- from
- chatType:
singlefor private chat,groupfor group chat - id: Sender's user ID
- username: Sender's display name
- chatType:
# Notes
- Credential Security: Bot ID and Secret are stored encrypted (AES) in credential management
- Single Connection: Each bot can only maintain one active WebSocket connection at a time; new connections kick old ones
- Reply Timeout: Welcome messages and template card updates must be sent within 5 seconds
- Stream Timeout: Streaming messages must complete within 10 minutes from the first send
- Rate Limit: Reply + proactive push share a quota of 30 messages/minute, 1000 messages/hour