messages
Original:🇺🇸 English
Translated
Retrieve chat message history, send messages, and manage reactions in Lark - get messages from group chats, private chats, threads, send messages to users or chats, and add/list/remove reactions. Use when user asks about chat messages, conversation history, what was discussed in a group, or wants to send a message or react.
2installs
Sourceyjwong/lark-cli
Added on
NPX Install
npx skill4agent add yjwong/lark-cli messagesTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Messages Skill
Retrieve chat message history, send messages, manage reactions, and search for chats/groups via the CLI.
lark🤖 Capabilities and Use Cases
- Send markdown-lite messages with links and mentions
- Send images with and
--imageplacement{{image}} - Reply to messages and threads with /
--parent-id--root-id - Message recall/delete for cleanup
- Add/list/remove emoji reactions
- Browse emoji catalog reference
- Read chat history (chat or thread)
- Download message resources (images/files/audio/video)
- Find chats by name or member
- Use clear, flag-based CLI with consistent JSON output
🚀 Quick Reference
Send message:
bash
lark msg send --to user@example.com --text "Hello!"Reply in thread:
bash
lark msg send --to oc_12345 --parent-id om_abcdef --msg-type text --text "Replying here"Read messages:
bash
lark msg history --chat-id oc_12345 --limit 10Find chats:
bash
lark chat search "project team"React / list / remove reaction:
bash
lark msg react --message-id om_123456789abcdef --reaction SMILE
lark msg react list --message-id om_123456789abcdef
lark msg react remove --message-id om_123456789abcdef --reaction-id ZCaCIjUBVVWSrm5L-3ZTw...Download resource:
bash
lark msg resource --message-id om_xxx --file-key img_v3_xxx --type image --output ./image.pngRunning Commands
Ensure is in your PATH, or use the full path to the binary. Set the config directory if not using the default:
larkbash
lark msg <command>
lark chat <command>
# Or with explicit config:
LARK_CONFIG_DIR=/path/to/.lark lark msg <command>Commands Reference
Search for Chats/Groups
bash
lark chat search "project" --limit 10Available flags:
- : Maximum number of chats to retrieve (0 = no limit)
--limit
Output fields include:
- with
chats[],chat_id,name,description,owner_id,externalchat_status - ,
countquery
Send Messages
Send messages to users or group chats as the bot.
bash
lark msg send --to ou_xxxx --text "Hello!"Reply in thread:
bash
lark msg send --to oc_xxxx --parent-id om_xxxx --msg-type text --text "Replying here"Available flags:
- (required): Recipient identifier (user ID, open_id, email, or chat_id)
--to - : Explicitly specify ID type (
--to-type,open_id,user_id,email) - auto-detected if omittedchat_id - : Message text content (markdown-lite). Use
--textto place images.{{image}} - : Image file path (repeatable)
--image - : Message type:
--msg-type(default) orposttext - : Parent message ID to reply in thread (optional)
--parent-id - : Root message ID for thread replies (optional)
--root-id
Output:
json
{
"success": true,
"message_id": "om_dc13264520392913993dd051dba21dcf",
"chat_id": "oc_xxxxx",
"create_time": "2026-01-14T10:30:00+08:00"
}Get Chat History
bash
lark msg history --chat-id oc_xxxxx --limit 50 --sort descAvailable flags:
- (required): Chat ID or thread ID
--chat-id - : Container type -
--type(default) orchatthread - : Start time (Unix timestamp or ISO 8601)
--start - : End time (Unix timestamp or ISO 8601)
--end - : Sort order -
--sort(default) orascdesc - : Maximum number of messages (0 = no limit)
--limit
Output fields include:
- with
messages[],message_id,msg_type,content,sender,create_time,mentions,is_reply,thread_iddeleted - ,
countchat_id
React to Message
Add a reaction to a message as the bot.
bash
lark msg react --message-id om_dc13264520392913993dd051dba21dcf --reaction SMILEAvailable flags:
- (required): Message ID to react to
--message-id - (required): Reaction ID or emoji name
--reaction - : Reaction type (default:
--type)emoji
Output:
json
{
"success": true,
"message_id": "om_dc13264520392913993dd051dba21dcf",
"reaction_type": "emoji",
"reaction_id": "ZCaCIjUBVVWSrm5L-3ZTw...",
"emoji_type": "SMILE"
}Notes:
- Reactions are added as the bot/app. The bot must be in the chat to react.
- Emoji types must match the Lark emoji catalog (e.g., ,
SMILE).LAUGH - Replies sent with are always created in a thread.
--parent-id
Emoji Catalog Reference
bash
lark msg react emojisUse this command to list the supported emoji types for reactions.
Custom Emojis: Organization-specific custom emojis can be configured in :
.lark/config.yamlyaml
custom_emojis:
"7405453485858095136": "ez-pepe"Custom emoji IDs will appear in the field of the output.
custom_emojisList Message Reactions
bash
lark msg react list --message-id om_dc13264520392913993dd051dba21dcf --reaction SMILE --limit 50Available flags:
- (required): Message ID to list reactions for
--message-id - : Emoji type filter (e.g.,
--reaction)SMILE - : Maximum number of reactions to retrieve (0 = no limit)
--limit
Output fields include:
- ,
message_id,reactions[]count
Remove Message Reaction
bash
lark msg react remove --message-id om_dc13264520392913993dd051dba21dcf --reaction-id ZCaCIjUBVVWSrm5L-3ZTw...Available flags:
- (required): Message ID to remove reaction from
--message-id - (required): Reaction ID to remove
--reaction-id
Output fields include:
- ,
success,message_id,reaction_type,reaction_idemoji_type
Recall Messages
Recall/delete previously sent messages from chats.
bash
lark msg recall om_dc13264520392913993dd051dba21dcfOutput fields include:
- ,
successmessage_id
Downloading Resource Files
Download images, files, audio, and video from messages using :
msg resourcebash
lark msg resource --message-id om_xxx --file-key img_v3_xxx --type image --output ./image.png
lark msg resource --message-id om_xxx --file-key file_v2_xxx --type file --output ./document.pdfAvailable flags:
- (required): Message ID containing the resource
--message-id - (required): Resource key from message content (
--file-keyorimage_key)file_key - (required):
--typefor images,imagefor files/audio/videofile - (required): Output file path
--output
Output fields include:
- ,
success,message_id,file_key,output_path,content_typebytes_written
Limitations:
- Maximum file size: 100MB
- Emoji resources cannot be downloaded
- Resources from card, merged, or forwarded messages are not supported
- The and
message_idmust matchfile_key
Tips
- Use for line breaks and
\nfor indentation in\t--text - Use to mention users in group chats
@{ou_xxx} - Use in text to place images in order
{{image}} - Chat IDs start with ; thread IDs start with
oc_orthread_omt_ - Use to discover
lark msg react listfor removalreaction_id - The CLI auto-detects recipient type; override with if needed
--to-type
Message Types
- - Plain text message
text - - Rich text post
post - - Image
image - - File attachment
file - - Audio message
audio - - Video/media
media - - Sticker/emoji
sticker - - Interactive card
interactive - - Shared chat
share_chat - - Shared user contact
share_user
Reading Thread Replies
If a message has a , it is part of a thread (or is the root). To fetch replies:
thread_idbash
lark msg history --chat-id oc_xxxxx --limit 10 --sort desc
lark msg history --chat-id omt_1a3b99f9d2cfd982 --type threadThread messages will have for replies (root message has ).
is_reply: trueis_reply: falseOutput Format
All commands output JSON.
Error Handling
Errors return JSON:
json
{
"error": true,
"code": "ERROR_CODE",
"message": "Description"
}Common error codes:
- - Need to run
AUTH_ERRORlark auth login - - Missing messages permissions
SCOPE_ERROR - - Missing required fields (e.g., chat-id)
VALIDATION_ERROR - - Lark API issue (e.g., bot not in group, missing permissions)
API_ERROR
Required Permissions
This skill requires the scope group. If you see a , add permissions:
messagesSCOPE_ERRORbash
lark auth login --add --scopes messagesTo check current permissions:
bash
lark auth statusAdditional requirements:
For reading messages:
- The bot must be in the group chat
- Group chat reads require the "Read all messages in associated group chat" permission
- Private chat reads require
im:message:readonly
For sending messages:
- Requires or
im:messageim:message:send_as_bot - The bot must be added to group chats before it can send messages to them
For reactions:
- List reactions requires
im:message.reactions:read - Add/remove reactions requires
im:message.reactions:write_only
Notes
- Messages are sent as the bot/app
- Messages are sorted by creation time ascending by default
- Time filters do not work for thread container type
- Message IDs typically start with
om_