消息概述
消息是指飞书内的即时消息,用于满足企业或用户日常工作中的沟通需要、帮助团队提升信息处理效率和顺畅交流。飞书开放平台针对即时消息提供了一系列 OpenAPI,使用这些 OpenAPI 你可以实现多种能力。例如:
- 向指定用户或群聊发送不同类型的消息,例如文本、富文本、图片、文件、卡片、视频、音频以及表情等。
- 在需要处理紧急需求时加急消息,提醒消息接收者查看消息内容。
- 把聊天过程中的重要消息标记为 Pin,被 Pin 的消息在当前会话内全员可见,方便成员随时查看重要消息。
典型场景
开放平台提供了包含消息与群组业务的集成方案,详情可参见:
接入流程
消息 API 的基本接入流程如下图所示,如需了解详细的 API 接入流程,参见流程概述。

Note说明:
- 你的应用必须启用机器人能力才可以调用消息 API。如需了解应用机器人,可参见应用机器人概述。
- 如果你希望使用 Webhook 方式发送消息,则需要使用群自定义机器人,该类型机器人只能在群组内添加,且只能向该群组发送不可交互的消息。详细说明参见自定义机器人使用指南。
- 应用机器人支持添加到外部群或与外部用户单聊,具体配置操作参考机器人支持外部群和外部用户单聊。
开发教程
体验场景化教程,了解如何运用消息与群组 API 助力企业高效通讯。
场景一:机器人自动拉群报警

场景二:向指定部门进行消息群发

场景三:新人入群欢迎机器人

场景四:卡片交互机器人

资源介绍
消息业务域以资源为中心进行开放。资源的关系图如下,消息本身包含了文本、图片、文件、卡片以及表情等多种类型,这些不同类型的消息均可以发送至指定的用户或群组。

消息相关资源或操作介绍如下表:
| 资源或操作 | 介绍 |
|---|---|
| 消息 | 消息即是指飞书聊天中的消息。通过消息 API 可以实现: - 向指定用户或群聊发送包括文本、富文本、卡片、图片、视频以及文件等多种类型的消息。 - 回复、编辑、撤回、转发某一条消息。 - 查看消息已读情况、会话历史消息、消息内容等。 |
| 上传图片 | 如需通过消息 API 发送图片,则需要通过 API 上传图片并获取图片 Key,然后使用图片 Key 发送消息。同时支持根据图片 Key 将图片下载到本地。 |
| 上传文件 | 如需通过消息 API 发送文件,则需要通过 API 上传文件并获取文件 Key,然后使用文件 Key 发送消息。同时支持根据文件 Key 将文件下载到本地。 |
| 表情回复 | 在指定消息上回复飞书表情。 |
| 加急消息 | 针对一些紧急情况,你可以加急指定消息。根据加急方式不同,消息接收者可能会收到应用内的加急、短信加急以及电话加急。 |
| Pin 消息 | Pin 消息用于将众多消息内的重要消息聚合在一起,被 Pin 的消息在当前会话中对所有成员可见,方便成员随时查看被 Pin 的重要消息。 |
| 卡片 | 卡片能够将结构化的内容以卡片形式嵌入至聊天消息、群置顶消息、链接预览等飞书协作场景中。了解更多参见飞书卡片概述。通过消息 API,你可以更新飞书卡片或向特定人发送卡片。 |
| URL 预览 | URL 预览是指在租户内,将指定的 URL 解析为文本或卡片的形式进行展示,方便消息接收者预览 URL 对应的内容。了解更多参见链接预览开发指南。通过消息 API,你可以更新 URL 预览。 |
方法列表
以下提供消息业务域所包含的所有 API 与事件列表
Note 文中表格涉及的 商店 是指商店应用,自建 是指企业自建应用。应用类型说明参见应用类型简介。
消息管理
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[发送消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create) POST/open-apis/im/v1/messages > 给指定用户或者会话发送消息,支持发送文本、富文本、卡片、群名片、个人名片、图片、视频、音频、文件、表情包。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token | ✓ | ✓ |
[批量发送消息](https://open.larkoffice.com/document/ukTMukTMukTM/ucDO1EjL3gTNx4yN4UTM) POST /open-apis/message/v4/batch_send/ > 给多个用户或者多个部门发送消息,支持发送文本、富文本、卡片、群名片、个人名片、图片、视频、音频、文件、表情包。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 im:message:send_multi_users 给多个用户批量发消息 im:message:send_multi_depts 给一个或多个部门的成员批量发消息 | tenant_access_token | ✓ | ✓ |
[回复消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/reply) POST /open-apis/im/v1/messages/:message_id/reply > 回复指定消息,支持文本、富文本、卡片、群名片、个人名片、图片、视频、文件等多种消息类型。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token | ✓ | ✓ |
[编辑消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/update) PUT /open-apis/im/v1/messages/:message_id > 编辑已发送的消息内容,当前支持编辑文本、富文本消息。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 im:message:update 更新消息 | tenant_access_token | ✓ | ✓ |
[撤回消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/delete) DELETE /open-apis/im/v1/messages/:message_id >将某一条消息撤回。例如,机器人撤回机器人自己发送的消息、群主撤回群内消息。 | im:message 获取与发送单聊、群组消息 im:message:recall 撤回消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token user_access_token | ✓ | ✓ |
[批量撤回消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/batch_message/delete) DELETE /open-apis/im/v1/batch_messages/:batch_message_id >批量撤回通过批量发送消息接口发送的消息。 | im:message:send_multi_depts 给一个或多个部门的成员批量发消息 im:message:send_multi_users 给多个用户批量发消息 | tenant_access_token | ✓ | ✓ |
[转发消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/forward) POST /open-apis/im/v1/messages/:message_id/forward >向用户、群聊或话题转发一条指定的消息。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token | ✓ | ✓ |
[合并转发消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/merge_forward) POST /open-apis/im/v1/messages/merge_forward >将来自同一个群聊中的多条消息合并,并转发给指定的用户、群聊或话题。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token | ✓ | ✓ |
[转发话题](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/thread/forward) POST /open-apis/im/v1/threads/:thread_id/forward >向用户、群组或话题转发一个话题。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token | ✓ | ✓ |
[查询消息已读信息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/read_users) GET /open-apis/im/v1/messages/:message_id/read_users >消息发送后,可以通过该接口查询消息接收者是否已读消息。 | im:message 获取与发送单聊、群组消息 im:message:readonly 获取单聊、群组消息 | tenant_access_token | ✓ | ✓ |
[获取会话历史消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/list) GET /open-apis/im/v1/messages >获取会话(包括单聊、群组)的历史消息。 | im:message 获取与发送单聊、群组消息 im:message:readonly 获取单聊、群组消息 | tenant_access_token | ✓ | ✓ |
[获取消息中的资源文件](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-resource/get) GET /open-apis/im/v1/messages/:message_id/resources/:file_key >获取消息中的资源文件,包括音频,视频,图片和文件。暂不支持表情包资源下载。当前仅支持 100M 以内的资源文件的下载。 | im:message 获取与发送单聊、群组消息 im:message:readonly 获取单聊、群组消息 | tenant_access_token | ✓ | ✓ |
[获取指定消息的内容](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/get) GET /open-apis/im/v1/messages/:message_id >通过消息 ID(message_id)查询消息内容。 | im:message 获取与发送单聊、群组消息 im:message:readonly 获取单聊、群组消息 | tenant_access_token | ✓ | ✓ |
[查询批量消息推送和阅读人数](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/batch_message/read_user) GET /open-apis/im/v1/batch_messages/:batch_message_id/read_user >调用批量发送消息接口后,可以通过该接口查询批量消息推送的总人数和阅读消息的人数。 | im:message:send_multi_depts 给一个或多个部门的成员批量发消息 im:message:send_multi_users 给多个用户批量发消息 | tenant_access_token | ✓ | ✓ |
[查询批量消息整体进度](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/batch_message/get_progress) GET /open-apis/im/v1/batch_messages/:batch_message_id/get_progress >调用批量发送消息接口后,可通过该接口获取批量消息发送的进度、撤回进度。 | im:message:send_multi_depts 给一个或多个部门的成员批量发消息 im:message:send_multi_users 给多个用户批量发消息 | tenant_access_token | ✓ | ✓ |
[添加跟随气泡](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/push_follow_up) POST /open-apis/im/v1/messages/:message_id/push_follow_up >展示在机器人消息下方的气泡,用户点击气泡或者新消息到达后,气泡消失。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token | ✓ | ✓ |
事件列表
| 事件 (Event) | 权限要求(满足任一) | 事件类型 | 商店 | 自建 |
|---|---|---|---|---|
[接收消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/receive) > 机器人接收到用户发送的消息后触发此事件。 | im:message.group_at_msg 获取用户在群组中@机器人的消息 im:message.group_at_msg:readonly 接收群聊中@机器人消息事件 im:message.group_msg 获取群组中所有消息(敏感权限) im:message.p2p_msg:readonly 读取用户发给机器人的单聊消息 im:message.p2p_msg 获取用户发给机器人的单聊消息 | im.message.receive_v1 | ✓ | ✓ |
[消息已读](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/message_read) > 用户阅读机器人发送的单聊消息后触发此事件。 | im:message 获取与发送单聊、群组消息 im:message:readonly 获取单聊、群组消息 | im.message.message_read_v1 | ✓ | ✓ |
[撤回消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/recalled) > 消息被撤回后出发此事件。 | im:message 获取与发送单聊、群组消息 im:message:readonly 获取单聊、群组消息 | im.message.recalled_v1 | ✓ | ✓ |
图片信息
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[上传图片](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create) POST/open-apis/im/v1/images > 上传图片接口,支持上传 JPEG、PNG、WEBP、GIF、TIFF、BMP、ICO 格式图片。 | im:resource 获取与上传图片或文件资源 | tenant_access_token | ✓ | ✓ |
[下载图片](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/get) GET /open-apis/im/v1/images/:image_key > 下载图片资源,只能下载当前应用所上传的图片,且图片类型需要为 message(即用于发送消息的图片)。 | 无 | tenant_access_token | ✓ | ✓ |
文件信息
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[上传文件](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create) POST/open-apis/im/v1/files > 上传文件,可以上传视频,音频和 doc、xls、ppt 等常见文件类型。 | im:resource 获取与上传图片或文件资源 | tenant_access_token | ✓ | ✓ |
[下载文件](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/get) GET /open-apis/im/v1/files/:file_key > 下载文件接口,只能下载应用自己上传的文件。 | 无 | tenant_access_token | ✓ | ✓ |
消息卡片
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[更新应用发送的消息卡片](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/patch) PATCH/open-apis/im/v1/messages/:message_id > 由当前应用发送过的卡片,可以调用该接口更新卡片的内容。 | im:message 获取与发送单聊、群组消息 im:message:send_as_bot 以应用的身份发消息 im:message:update 更新消息 | tenant_access_token user_access_token | ✓ | ✓ |
[延迟更新消息卡片](https://open.larkoffice.com/document/ukTMukTMukTM/uMDO1YjLzgTN24yM4UjN) POST /open-apis/interactive/v1/card/update > 用户与卡片交互完成后,可选择使用该接口延后更新卡片内容。 | 无 | tenant_access_token | ✓ | ✓ |
[发送仅特定人可见的消息卡片](https://open.larkoffice.com/document/ukTMukTMukTM/uETOyYjLxkjM24SM5IjN) POST /open-apis/ephemeral/v1/send > 用于机器人在群会话中发送指定用户可见的消息卡片,指定用户查看到的卡片上方会展示“仅对你可见”。 | 无 | tenant_access_token | ✓ | ✓ |
[删除仅特定人可见的消息卡片](https://open.larkoffice.com/document/ukTMukTMukTM/uITOyYjLykjM24iM5IjN) POST /open-apis/ephemeral/v1/delete > 在群会话中删除特定人可见的卡片。通过该接口删除卡片后,不会留下该卡片消息的任何痕迹。 | 无 | tenant_access_token | ✓ | ✓ |
表情回复
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[添加消息表情回复](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/create) POST/open-apis/im/v1/messages/:message_id/reactions > 给指定消息添加指定类型的表情回复。 | im:message 获取与发送单聊、群组消息 im:message.reactions:write_only 发送、删除消息表情回复 | tenant_access_token user_access_token | ✓ | ✓ |
[获取消息表情回复](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/list) GET /open-apis/im/v1/messages/:message_id/reactions > 获取指定消息的特定类型表情回复列表。 | im:message.reactions:read 查看消息表情回复 im:message:readonly 获取单聊、群组消息 | tenant_access_token user_access_token | ✓ | ✓ |
[删除消息表情回复](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/delete) DELETE /open-apis/im/v1/messages/:message_id/reactions/:reaction_id > 删除指定消息的表情回复。 | im:message 获取与发送单聊、群组消息 im:message.reactions:write_only 发送、删除消息表情回复 | tenant_access_token user_access_token | ✓ | ✓ |
事件列表
| 事件 (Event) | 权限要求(满足任一) | 事件类型 | 商店 | 自建 |
|---|---|---|---|---|
[新增消息表情回复](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/events/created) > 消息被添加某一个表情回复后触发此事件。 | im:message.reactions:read 查看消息表情回复 im:message:readonly 获取单聊、群组消息 | im.message.reaction.created_v1 | ✓ | ✓ |
[删除消息表情回复](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/events/deleted) > 消息被删除某一个表情回复后触发此事件。 | im:message.reactions:read 查看消息表情回复 im:message:readonly 获取单聊、群组消息 | im.message.reaction.deleted_v1 | ✓ | ✓ |
消息加急
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[发送应用内加急](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/urgent_app) PATCH/open-apis/im/v1/messages/:message_id/urgent_app > 机器人发送消息后,可以调用该接口向目标用户发送应用内加急。 | im:message.urgent 发送应用内加急消息 | tenant_access_token | ✓ | ✓ |
[发送短信加急](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/urgent_sms) PATCH /open-apis/im/v1/messages/:message_id/urgent_sms > 机器人发送消息后,可以调用该接口向目标用户发送应用内加急和短信加急。 | im:message.urgent:sms 发送短信加急消息 | tenant_access_token | ✓ | ✓ |
[发送电话加急](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/urgent_phone) PATCH /open-apis/im/v1/messages/:message_id/urgent_phone > 机器人发送消息后,可以调用该接口向目标用户发送应用内加急和电话加急。 | im:message.urgent:phone 发送电话加急消息 | tenant_access_token | ✓ | ✓ |
Pin
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[Pin 消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/pin/create) POST/open-apis/im/v1/pins > Pin 一条指定的消息,被 Pin 的消息在当前会话中对所有成员可见,方便成员随时查看。 | im:message 获取与发送单聊、群组消息 im:message.pins:write_only 添加、 取消 Pin 消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token user_access_token | ✓ | ✓ |
[移除 Pin 消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/pin/delete) DELETE /open-apis/im/v1/pins/:message_id > 移除被 Pin 的消息。 | im:message 获取与发送单聊、群组消息 im:message.pins:write_only 添加、 取消 Pin 消息 im:message:send_as_bot 以应用的身份发消息 | tenant_access_token user_access_token | ✓ | ✓ |
[获取群内 Pin 消息](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/pin/list) GET /open-apis/im/v1/pins > 在指定群内,获取指定时间范围内的所有 Pin 消息。 | im:message 获取与发送单聊、群组消息 im:message.pins:read 查看 Pin 消息 im:message:readonly 获取单聊、群组消息 | tenant_access_token user_access_token | ✓ | ✓ |
URL 预览
API 列表
| 方法 (API) | 权限要求(满足任一) | 访问凭证(选择其一) | 商店 | 自建 |
|---|---|---|---|---|
[更新 URL 预览](https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/group/im-v2/url_preview/batch_update) POST/open-apis/im/v2/url_previews/batch_update > 该接口用于主动更新 URL 预览,调用后会重新触发一次客户端拉取,需要回调服务返回更新后的数据。 | im:url_preview.update 更新 URL 预览 | tenant_access_token | ✓ | ✓ |
