面向开发者和 AI
从一个请求开始。
面向 WhatsApp、Telegram 和 MAX 普通账号的统一 HTTP API。公开文档说明 API 约定;只有使用您自己的密钥才能获取您的账号列表。
1. 创建账号和连接
使用邮箱注册,通过邮件验证地址,然后登录 控制台。选择即时通讯平台,并使用该平台支持的二维码或手机号方式登录。Telegram 需要您自己的 application API credentials。其他可能需要的登录步骤会在控制台中显示。
2. 创建 API 密钥
在“个人资料 → API 密钥”中为项目创建独立密钥。默认允许读取;发送消息及其他修改操作需要 write 权限。密钥值仅显示一次。请将其保存在后端机密配置中,不要放在浏览器、Git 或 AI 提示词中。
3. 获取连接和完整命令目录
curl 'https://api-senden.ru/api/v1/integrations/manifest' \
--header 'Authorization: Bearer YOUR_API_KEY'响应包含 instances, connectedMessengers, commands 和 permissions. 连接仅属于您的工作空间,不包含已归档项。发送时请选择状态为 state: connected.
4. 选择聊天、发送并检查结果
通过以下接口获取真实聊天 ID: GET /api/v1/instances/{id}/chats。发送文字和文件使用 POST /api/v1/instances/{id}/messages 并使用一个固定的 Idempotency-Key。202 响应表示进入队列,不代表送达。可通过历史、SSE、webhook 和通知队列获取状态及入站消息。具体传输功能见下文。
对于 MAX,contacts.lookup 当前返回的是用户 ID,不能自动将其视为私聊 ID。请使用聊天列表中的 ID 作为目标。如果首次发送的结果尚不明确,不要换用新密钥再次发送。
Группы и переписка
Список /chats содержит доступные аккаунту чаты, а groups.get — информацию выбранной группы. Полнота снимка участников не гарантируется. groups.invite.preview 检查支持的社区地址,但不加入; groups.join требует write и один стабильный Idempotency-Key. Результат joined подтверждает членство, pending — запрос одобрения, unknown требует проверки без автоматического повтора. Ссылку приглашения храните как секрет; права и ограничения мессенджера сохраняются.
公开的 Telegram 频道或群组无需邀请:将 target 设为 @username 或 https://t.me/username。私人邀请仍使用 inviteLink。请仅提供一个字段。
Необязательный senderId в сообщении обозначает наблюдавшегося автора, храните его строкой. Поиск /messages?chatId=…&search=… 针对本地历史记录,而不是所有公开群组。收到的附件通过 attachments/prepare/content 操作下载,并检查来源账号及权限。旧的、已删除或受保护的附件可能不可用。
通过 API 和控制台传输文件
可靠文件上传:POST /uploads、PUT 完整字节,并在响应丢失后 GET 同一回执。发送 fileId 是独立命令,使用单独的 Idempotency-Key。上传不会发送消息;202 不表示已送达。完整指南:file-transfer.txt。
事件与 webhook 安全
使用 webhook 时,请验证 HMAC 签名,并以幂等方式处理事件。端点必须是公开的 HTTPS 地址;本地和私有网络会被阻止。SSE 用于提供事件流;从队列获取通知会创建 lease,并且需要 write 权限,之后还须通过 ack 确认。完整参数和请求格式见 OpenAPI。
送达、已读与状态订阅
请保存发送响应中的本地 message.id。message.state 表示服务内的处理状态,message.delivery 表示已观察到的回执。HTTP 202、queued、submitted 和 observed 不代表送达或已读;unknown 表示尚未收到确认。
在 status 事件中,用 data.messageId 关联本地 UUID,并将 data.providerId 另存为字符串。旧字段 data.id 可能是平台 ID。可通过 GET /api/v1/instances/{id}/messages/{messageId} 核对单条消息。scope=participant 和 participants 仅表示个别成员,不代表整个群组;participantsComplete=false。即使 participants 中有 read,总体 delivery.status 仍可能为 unknown。
- WhatsApp: 仅发布实际收到的原生 delivered/read/played;隐私设置可能限制回执。
- Telegram: sent/read 和至少一位接收者的原生出站语音 played;不提供独立 delivered 或读者身份/数量。
- MAX: 只有已知成员的读取时间与可信原生消息时间匹配时才确认该成员 read;不证明 delivered 或全群已读。含义不明的 chat_read 只是活动。
MAX read 表示某个成员的阅读位置已越过该消息,不代表其听过语音。readAt 是 read-through watermark 时间,不是打开消息或播放录音的准确时刻。暂不支持 MAX 原生 played。设备的 played ACK 是客户端自行报告的本地播放结果,不是平台 read/played 回执,也不能证明有人听到了声音。
Telegram:sent/read 来自原生出站阅读位置;不提供独立 delivered、读者名单/数量或全员已读证明。出站语音的 played 与 source=telegram_voice_listened 表示至少一位接收者的 is_listened=true,不包含其身份或准确播放时间。WhatsApp:read 不等于 played,私聊 played 必须有原生证据。固定版本的群回调只报告成员 delivered/read,不能单独区分 group played。隐私或回执缺失可能使结果保持 unknown。出站 /voice 支持三个平台;入站音频和设备 API 仍仅支持 MAX。
未收到状态时,请核对自己的 instanceId、本地 message.id、status 过滤器和 webhook/pull 路由;用已保存游标恢复 /events/SSE 并核对 GET message。Telegram 可将临时 providerId 替换为最终 ID,messageId 保持不变。使用服务端返回的 chatId/providerId,不要自行构造 WA PN/LID 别名。readAt/playedAt 缺失是合法的,包括 Telegram played;结果未知不能作为重新发送的依据。
在 notificationFilters 中加入 status 和 chat_read,并保留其他所需类型。webhookEnabled=true 时,新匹配事件进入 webhook;false 时进入 pull。这是二选一的分发模式。/events?after=… 与 SSE 可独立读取。用 after 或 Last-Event-ID 恢复 SSE,处理 id/data,处理成功后保存游标,并按 event.id 去重。积压批次满时,流以 retry:1000 结束,请从最后一个 ID 继续。
校验 webhook 原始字节的 HMAC SHA-256,并在持久处理后返回 2xx。pull 回执应在处理成功后、leaseExpiresAt 前确认。webhook 任务的 delivered 仅表示 HTTP 已交给您的处理器,不代表消息送达平台收件人。不要为获取状态而重复发送。密钥只保存在服务端,不放入 URL。
可直接使用的资料
不含密钥、二维码、会话或用户数据。运行客户端时只执行 discovery 请求。
Полный каталог: 85 HTTP-команд
这是统一的 API 命令目录;各原生命令的支持情况以及是否需要活动连接会单独注明。/methods 目录仅包含原生命令子集。
| 方法与路径 | 用途 | 支持情况 | 权限 |
|---|---|---|---|
GET/api/v1/health | 进程健康检查 | whatsapp, telegram, max | read |
GET/api/v1/status | Подключения, состояния и usage: тариф, сроки, счётчики и maxFileBytes | whatsapp, telegram, max | read |
POST/api/v1/instances | 创建连接 | whatsapp, telegram, max | write |
GET/api/v1/instances | 获取活动或已归档的连接 | whatsapp, telegram, max | read |
DELETE/api/v1/instances/{id} | 停止并归档连接,同时保留历史记录和会话 | whatsapp, telegram, max | write |
PATCH/api/v1/instances/{id} | 重命名连接 | whatsapp, telegram, max | write |
GET/api/v1/instances/{id} | 连接状态 | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/restore | 在限制范围内从归档恢复,不自动建立连接 | whatsapp, telegram, max | write |
POST/api/v1/instances/{id}/connect | 开始登录 | whatsapp, telegram, max | write |
POST/api/v1/instances/{id}/auth | 继续当前登录步骤 | whatsapp, telegram, max | write |
POST/api/v1/instances/{id}/stop | 停止并保留会话 | whatsapp, telegram, max | write |
POST/api/v1/instances/{id}/logout | 请求退出登录 | whatsapp, telegram, max | write |
GET/api/v1/instances/{id}/chats | 获取聊天列表 | whatsapp, telegram, max需要连接 | read |
GET/api/v1/instances/{id}/messages | 已保存的消息历史 | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/messages | 将文本或文件加入队列 | whatsapp, telegram, max | writeIdempotency-Key |
GET/api/v1/instances/{id}/messages/{messageId} | Получить сообщение по локальному UUID и сохранённые подтверждения | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/voice | Поставить нативное голосовое сообщение в очередь | whatsapp, telegram, max | writeIdempotency-Key |
POST/api/v1/instances/{id}/messages/{messageId}/voice | Загрузить голосовое MAX по UUID сообщения своего пространства | max需要连接 | write |
GET/api/v1/instances/{id}/messages/{messageId}/voice/content | Воспроизвести ранее загруженное голосовое MAX | max | read |
POST/api/v1/instances/{id}/messages/from-url | 安全下载 HTTPS 文件并将文档加入队列 | whatsapp, telegram, max | writeIdempotency-Key |
GET/api/v1/instances/{id}/settings | 连接与事件设置 | whatsapp, telegram, max | read |
PUT/api/v1/instances/{id}/settings | 修改设置 | whatsapp, telegram, max | write |
GET/api/v1/instances/{id}/queue | 持久化消息队列 | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/queue/clear | 取消所有 queued 消息 | whatsapp, telegram, max | write |
POST/api/v1/instances/{id}/queue/{messageId}/cancel | 取消一条 queued 消息 | whatsapp, telegram, max | write |
POST/api/v1/instances/{id}/queue/{messageId}/retry | 仅重试已确认的 failed 错误操作 | whatsapp, telegram, max | write |
GET/api/v1/instances/{id}/notifications/stats | 待处理和已处理的通知数量 | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/notifications/receive | 通过 lease 和等待获取通知 | whatsapp, telegram, max | write |
DELETE/api/v1/instances/{id}/notifications/{receiptId} | 确认当前回执已处理 | whatsapp, telegram, max | write |
GET/api/v1/instances/{id}/deliveries | webhook 投递结果 | whatsapp, telegram, max | read |
GET/api/v1/instances/{id}/deliveries/stats | webhook 任务计数 | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/deliveries/clear | 取消待处理、重试中和 dead-letter webhook | whatsapp, telegram, max | write |
GET/api/v1/instances/{id}/deliveries/{jobId}/attempts | webhook 尝试日志 | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/deliveries/{jobId}/retry | 重试 dead-letter 中的 webhook | whatsapp, telegram, max | write |
GET/api/v1/events | Сохранённые события с курсором | whatsapp, telegram, max | read |
GET/api/v1/stream | Поток событий SSE с возобновлением | whatsapp, telegram, max | read |
POST/api/v1/files | Загрузить файл: до 20 МБ на пробном тарифе, до 200 МБ на Pro | whatsapp, telegram, max | write |
GET/api/v1/files/{fileId} | 下载之前上传的本地文件 | whatsapp, telegram, max | read |
PUT/api/v1/config | 应用及网络连接设置 | whatsapp, telegram, max | write |
GET/api/v1/methods | 可用操作目录 | whatsapp, telegram, max | read |
GET/api/v1/integrations/manifest | 当前工作空间的连接、命令和可直接使用的集成文件,不含密钥或认证数据 | whatsapp, telegram, max | read |
GET/api/v1/integrations/files/{name} | 下载不含个人数据的集成模板或完整 ZIP 包 | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/operations/account.settings.get | 已连接账号的资料 | whatsapp, telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/contacts.list | 联系人列表 | whatsapp, telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/contacts.get | 联系人信息 | whatsapp, telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/contacts.lookup | 通过手机号或 ID 检查账号是否存在 | whatsapp, telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/contacts.create | 添加联系人 | telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/contacts.update | 编辑联系人 | telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/contacts.delete | 删除联系人 | telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/profile.avatar.get | 获取头像 | whatsapp需要连接 | read |
POST/api/v1/instances/{id}/operations/messages.history | 从即时通讯平台加载历史记录 | telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/messages.get | 从即时通讯平台获取消息 | telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/messages.read | 将消息标记为已读 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/messages.delete | 删除消息 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/messages.edit | 编辑消息文本 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/messages.forward | 转发选中的消息 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/messages.react | 修改消息回应 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/messages.contact | 发送联系人名片 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/messages.location | 发送位置 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/messages.poll | 发送投票 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/chats.typing | 显示正在输入指示 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/chats.archive | 归档聊天 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/chats.unarchive | 取消聊天归档 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/chats.expiration | 配置阅后即焚消息 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/chats.reactions | 获取可用的消息回应 | telegram需要连接 | read |
POST/api/v1/instances/{id}/operations/groups.get | 群组信息 | whatsapp, telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/groups.invite.preview | Проверить приглашение в группу без вступления | whatsapp, telegram, max需要连接 | read |
POST/api/v1/instances/{id}/operations/groups.join | 加入社区:公开 Telegram 或邀请 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.create | 创建群组 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.rename | 重命名群组 | whatsapp, telegram需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.members.add | 添加成员 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.members.remove | 移除成员 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.admins.add | 指定群组管理员 | whatsapp需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.admins.remove | 撤销群组管理员权限 | whatsapp需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.leave | 退出群组 | whatsapp, telegram, max需要连接 | writeIdempotency-Key |
POST/api/v1/instances/{id}/operations/groups.settings | 修改一项群组权限 | whatsapp需要连接 | writeIdempotency-Key |
GET/api/v1/instances/{id}/messages/{messageId}/attachments | List safe observed attachment metadata; no remote download. | whatsapp, telegram, max | read |
GET/api/v1/instances/{id}/messages/{messageId}/attachments/{attachmentId} | Read metadata and preparation state; suitable for polling. | whatsapp, telegram, max | read |
POST/api/v1/instances/{id}/messages/{messageId}/attachments/{attachmentId}/prepare | Prepare a private cached copy of an observed attachment. | whatsapp, telegram, max | read |
GET/api/v1/instances/{id}/messages/{messageId}/attachments/{attachmentId}/content | Stream only a ready local attachment as a download. | whatsapp, telegram, max | read |
HEAD/api/v1/instances/{id}/messages/{messageId}/attachments/{attachmentId}/content | Headers of a ready copy without a body or remote download. | whatsapp, telegram, max | read |
POST/api/v1/uploads | Reserve a durable upload intent; no messenger send. | whatsapp, telegram, max | writeIdempotency-Key |
GET/api/v1/uploads/{uploadId} | Recover own upload receipt and fileId after a lost response. | whatsapp, telegram, max | write |
PUT/api/v1/uploads/{uploadId}/content | Verify a full raw stream into one immutable fileId. | whatsapp, telegram, max | write |
GET/api/v1/files/{fileId}/metadata | Read own safe file metadata/tombstone, not a filesystem path. | whatsapp, telegram, max | read |
从构想到集成
连接您的第一个账号
创建账号、验证邮箱,然后从请求连接列表开始。