evolution-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEvolution API
Evolution API
Open-source WhatsApp integration API supporting Baileys (WhatsApp Web) and official WhatsApp Business API (Cloud API). Built with Node.js + TypeScript + Express.js + Prisma.
开源WhatsApp集成API,支持Baileys(WhatsApp Web)和官方WhatsApp Business API(Cloud API)。基于Node.js + TypeScript + Express.js + Prisma构建。
Authentication
身份验证
All requests use the header. Two levels of keys exist:
apikey- Global API Key: Set via env var. Has full access to all instances.
AUTHENTICATION_API_KEY - Instance Token: Per-instance key returned on creation. Scoped to that instance only.
apikey: YOUR_API_KEYEvery request follows this pattern:
bash
curl --request <METHOD> \
--url https://<SERVER_URL>/<path>/{instanceName} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '<json-body>'所有请求都使用请求头,分为两种密钥等级:
apikey- 全局API密钥:通过环境变量设置,拥有所有实例的完整访问权限。
AUTHENTICATION_API_KEY - 实例令牌:创建实例时返回的单实例专属密钥,仅作用于该实例。
apikey: YOUR_API_KEY所有请求遵循以下格式:
bash
curl --request <METHOD> \
--url https://<SERVER_URL>/<path>/{instanceName} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '<json-body>'Instance Lifecycle
实例生命周期
Create Instance
创建实例
bash
POST /instance/create
{
"instanceName": "my-instance",
"integration": "WHATSAPP-BAILEYS",
"token": "optional-custom-token",
"qrcode": true,
"number": "5511999999999",
"rejectCall": true,
"msgCall": "I can't answer calls",
"groupsIgnore": true,
"alwaysOnline": true,
"readMessages": true,
"readStatus": true,
"syncFullHistory": true,
"webhook": {
"url": "https://your-server.com/webhook",
"byEvents": false,
"base64": true,
"headers": { "authorization": "Bearer token" },
"events": ["MESSAGES_UPSERT", "CONNECTION_UPDATE"]
}
}Response (201):
json
{
"instance": {
"instanceName": "my-instance",
"instanceId": "af6c5b7c-ee27-4f94-9ea8-192393746ddd",
"status": "created"
},
"hash": { "apikey": "generated-instance-token" },
"qrcode": { "base64": "data:image/png;base64,..." }
}The field accepts:
integration- — Free, based on WhatsApp Web (Baileys library)
WHATSAPP-BAILEYS - — Official Meta Cloud API (requires Facebook App setup)
WHATSAPP-BUSINESS
bash
POST /instance/create
{
"instanceName": "my-instance",
"integration": "WHATSAPP-BAILEYS",
"token": "optional-custom-token",
"qrcode": true,
"number": "5511999999999",
"rejectCall": true,
"msgCall": "I can't answer calls",
"groupsIgnore": true,
"alwaysOnline": true,
"readMessages": true,
"readStatus": true,
"syncFullHistory": true,
"webhook": {
"url": "https://your-server.com/webhook",
"byEvents": false,
"base64": true,
"headers": { "authorization": "Bearer token" },
"events": ["MESSAGES_UPSERT", "CONNECTION_UPDATE"]
}
}响应(201):
json
{
"instance": {
"instanceName": "my-instance",
"instanceId": "af6c5b7c-ee27-4f94-9ea8-192393746ddd",
"status": "created"
},
"hash": { "apikey": "generated-instance-token" },
"qrcode": { "base64": "data:image/png;base64,..." }
}integration- — 免费方案,基于WhatsApp Web(Baileys库)实现
WHATSAPP-BAILEYS - — 官方Meta Cloud API(需要配置Facebook应用)
WHATSAPP-BUSINESS
Connect Instance (get QR code)
连接实例(获取二维码)
GET /instance/connect/{instanceName}Returns QR code as base64 for scanning with WhatsApp mobile app.
GET /instance/connect/{instanceName}返回base64格式的二维码,可使用WhatsApp移动端扫描登录。
Check Connection State
检查连接状态
GET /instance/connectionState/{instanceName}Returns: , , or .
opencloseconnectingGET /instance/connectionState/{instanceName}返回值:(已连接)、(未连接)或(连接中)。
opencloseconnectingOther Instance Operations
其他实例操作
| Method | Endpoint | Description |
|---|---|---|
| GET | | List all instances |
| PUT | | Restart instance |
| DELETE | | Logout (keep instance) |
| DELETE | | Delete instance entirely |
| POST | | Set online/offline status |
| 请求方法 | 端点 | 描述 |
|---|---|---|
| GET | | 列出所有实例 |
| PUT | | 重启实例 |
| DELETE | | 退出登录(保留实例) |
| DELETE | | 彻底删除实例 |
| POST | | 设置在线/离线状态 |
Sending Messages
消息发送
Text Message
文本消息
bash
POST /message/sendText/{instanceName}
{
"number": "5511999999999",
"text": "Hello from Evolution API!",
"delay": 1200,
"linkPreview": true,
"mentionsEveryOne": false,
"mentioned": ["5511888888888@s.whatsapp.net"]
}Response (201):
json
{
"key": {
"remoteJid": "5511999999999@s.whatsapp.net",
"fromMe": true,
"id": "BAE594145F4C59B4"
},
"message": { "extendedTextMessage": { "text": "Hello from Evolution API!" } },
"messageTimestamp": "1717689097",
"status": "PENDING"
}Number format: Use full international format without sign. For groups, use the group JID (e.g., ).
+120363025486748009@g.usbash
POST /message/sendText/{instanceName}
{
"number": "5511999999999",
"text": "Hello from Evolution API!",
"delay": 1200,
"linkPreview": true,
"mentionsEveryOne": false,
"mentioned": ["5511888888888@s.whatsapp.net"]
}响应(201):
json
{
"key": {
"remoteJid": "5511999999999@s.whatsapp.net",
"fromMe": true,
"id": "BAE594145F4C59B4"
},
"message": { "extendedTextMessage": { "text": "Hello from Evolution API!" } },
"messageTimestamp": "1717689097",
"status": "PENDING"
}号码格式:使用不带号的完整国际格式。群组请使用群组JID(例如:)。
+120363025486748009@g.usReply / Quote a Message
回复/引用消息
Add to any send payload:
quotedjson
{
"number": "5511999999999",
"text": "This is a reply",
"quoted": {
"key": { "id": "ORIGINAL_MESSAGE_ID" },
"message": { "conversation": "Original message text" }
}
}在任意发送请求的payload中添加字段即可:
quotedjson
{
"number": "5511999999999",
"text": "This is a reply",
"quoted": {
"key": { "id": "ORIGINAL_MESSAGE_ID" },
"message": { "conversation": "Original message text" }
}
}Media Message
媒体消息
bash
POST /message/sendMedia/{instanceName}
{
"number": "5511999999999",
"mediatype": "image",
"mimetype": "image/png",
"caption": "Check this out",
"media": "https://example.com/image.png"
}mediatypeimagevideodocumentmediabash
POST /message/sendMedia/{instanceName}
{
"number": "5511999999999",
"mediatype": "image",
"mimetype": "image/png",
"caption": "Check this out",
"media": "https://example.com/image.png"
}mediatypeimagevideodocumentmediaAudio Message
音频消息
bash
POST /message/sendWhatsAppAudio/{instanceName}
{
"number": "5511999999999",
"audio": "https://example.com/audio.mp3"
}Audio is automatically converted to WhatsApp PTT (push-to-talk) format.
bash
POST /message/sendWhatsAppAudio/{instanceName}
{
"number": "5511999999999",
"audio": "https://example.com/audio.mp3"
}音频会自动转换为WhatsApp PTT(一键对讲)格式。
Other Message Types
其他消息类型
| Endpoint | Body fields | Notes |
|---|---|---|
| | |
| | |
| | Use empty string to remove |
| | |
| | |
| | |
| | |
| | Post to WhatsApp Status |
| 端点 | 请求体字段 | 备注 |
|---|---|---|
| | |
| | |
| | 传入空字符串可取消反应 |
| | |
| | |
| | |
| | |
| | 发布到WhatsApp动态 |
Webhook Configuration
Webhook配置
Set Webhook via API
通过API设置Webhook
bash
POST /webhook/set/{instanceName}
{
"webhook": {
"enabled": true,
"url": "https://your-server.com/webhook",
"webhookByEvents": false,
"webhookBase64": true,
"events": [
"MESSAGES_UPSERT",
"MESSAGES_UPDATE",
"CONNECTION_UPDATE",
"SEND_MESSAGE"
]
}
}When is , events are sent to (e.g., ).
webhookByEventstrue{url}/{EVENT_NAME}/webhook/MESSAGES_UPSERTbash
POST /webhook/set/{instanceName}
{
"webhook": {
"enabled": true,
"url": "https://your-server.com/webhook",
"webhookByEvents": false,
"webhookBase64": true,
"events": [
"MESSAGES_UPSERT",
"MESSAGES_UPDATE",
"CONNECTION_UPDATE",
"SEND_MESSAGE"
]
}
}当设为时,事件会发送到地址(例如:)。
webhookByEventstrue{url}/{EVENT_NAME}/webhook/MESSAGES_UPSERTGet Webhook Config
获取Webhook配置
GET /webhook/find/{instanceName}For the complete list of available events, see references/events.md.
GET /webhook/find/{instanceName}完整的可用事件列表请参考 references/events.md。
Chat Operations
聊天操作
| Method | Endpoint | Body | Description |
|---|---|---|---|
| POST | | | Verify numbers on WhatsApp |
| POST | | | Search messages |
| POST | | | List all chats |
| POST | | | Search contacts |
| POST | | | Mark as read |
| POST | | | Archive/unarchive chat |
| DELETE | | | Delete for everyone |
| POST | | | Edit sent message |
| POST | | | Show typing/recording |
| POST | | | Get media as base64 |
presencecomposingrecordingpaused| 请求方法 | 端点 | 请求体 | 描述 |
|---|---|---|---|
| POST | | | 验证号码是否为WhatsApp账号 |
| POST | | | 搜索消息 |
| POST | | | 列出所有聊天会话 |
| POST | | | 搜索联系人 |
| POST | | | 标记消息已读 |
| POST | | | 归档/取消归档聊天会话 |
| DELETE | | | 为所有人删除消息 |
| POST | | | 编辑已发送消息 |
| POST | | | 显示输入中/录音中状态 |
| POST | | | 获取媒体文件的base64格式 |
presencecomposingrecordingpausedGroup Management
群组管理
| Method | Endpoint | Body / Params | Description |
|---|---|---|---|
| POST | | | Create group |
| GET | | query: | List all groups |
| GET | | query param | Group details |
| GET | | query param | Get invite link |
| GET | | query param | List members |
| POST | | | Add/remove/promote/demote |
| POST | | | Lock/unlock group settings |
| POST | | | Set disappearing messages |
| DELETE | | | Leave group |
actionaddremovepromotedemote| 请求方法 | 端点 | 请求体/参数 | 描述 |
|---|---|---|---|
| POST | | | 创建群组 |
| GET | | 查询参数: | 列出所有群组 |
| GET | | 查询参数 | 获取群组详情 |
| GET | | 查询参数 | 获取群组邀请链接 |
| GET | | 查询参数 | 列出群成员 |
| POST | | | 添加/移除/提升/降级群成员 |
| POST | | | 锁定/解锁群组设置 |
| POST | | | 设置 disappearing messages(消失消息) |
| DELETE | | | 退出群组 |
群成员操作的可选值:(添加)、(移除)、(提升为管理员)、(降级为普通成员)。
actionaddremovepromotedemoteProfile Settings
个人资料设置
| Method | Endpoint | Description |
|---|---|---|
| POST | | Fetch profile info |
| POST | | Update display name |
| POST | | Update status text |
| POST | | Update avatar |
| DELETE | | Remove avatar |
| GET | | Get privacy settings |
| POST | | Update privacy |
| 请求方法 | 端点 | 描述 |
|---|---|---|
| POST | | 获取个人资料信息 |
| POST | | 更新显示名称 |
| POST | | 更新状态文本 |
| POST | | 更新头像 |
| DELETE | | 删除头像 |
| GET | | 获取隐私设置 |
| POST | | 更新隐私设置 |
Integrations
集成能力
Evolution API supports chatbot integrations configured per-instance:
| Integration | Endpoints prefix | Description |
|---|---|---|
| Typebot | | Conversational bot flows |
| Chatwoot | | Help desk / CRM |
| OpenAI | | AI-powered bots + audio transcription |
| Dify | | AI agent platform |
| n8n | | Workflow automation |
| Flowise | | LLM flow builder |
| EvoAI | | Evolution's own AI bot |
Each integration follows the CRUD pattern: , , , , , , .
createfindupdatedeletesettingschange-statusfetch-sessionEvolution API支持按实例配置聊天机器人集成:
| 集成工具 | 端点前缀 | 描述 |
|---|---|---|
| Typebot | | 对话式机器人流程 |
| Chatwoot | | 服务台/CRM |
| OpenAI | | AI驱动的机器人+音频转写 |
| Dify | | AI Agent平台 |
| n8n | | 工作流自动化 |
| Flowise | | LLM流程构建器 |
| EvoAI | | Evolution自带的AI机器人 |
每个集成都遵循CRUD模式:(创建)、(查询)、(更新)、(删除)、(设置)、(修改状态)、(获取会话)。
createfindupdatedeletesettingschange-statusfetch-sessionEvent Delivery Channels
事件投递渠道
Beyond webhooks, Evolution API can deliver events via:
- RabbitMQ —
POST /rabbitmq/set/{instance} - Amazon SQS —
POST /sqs/set/{instance} - WebSocket (Socket.io) —
POST /websocket/set/{instance} - Apache Kafka — Via environment variables
除了Webhook外,Evolution API还支持通过以下渠道投递事件:
- RabbitMQ —
POST /rabbitmq/set/{instance} - Amazon SQS —
POST /sqs/set/{instance} - WebSocket (Socket.io) —
POST /websocket/set/{instance} - Apache Kafka — 通过环境变量配置
Advanced References
高级参考
- Full endpoint table: See references/api-endpoints.md
- Environment variables (self-hosted): See references/environment-variables.md
- Webhook events catalog: See references/events.md
- 完整端点列表:参考 references/api-endpoints.md
- 环境变量(自托管场景):参考 references/environment-variables.md
- Webhook事件目录:参考 references/events.md