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.
Retrieve chat message history, send messages, manage reactions, and search for chats/groups via the lark CLI.
--image and {{image}} placement--parent-id / --root-idSend message:
lark msg send --to user@example.com --text "Hello!"
Reply in thread:
lark msg send --to oc_12345 --parent-id om_abcdef --msg-type text --text "Replying here"
Read messages:
lark msg history --chat-id oc_12345 --limit 10
Find chats:
lark chat search "project team"
React / list / remove reaction:
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:
lark msg resource --message-id om_xxx --file-key img_v3_xxx --type image --output ./image.png
Ensure lark is in your PATH, or use the full path to the binary. Set the config directory if not using the default:
lark msg <command>
lark chat <command>
# Or with explicit config:
LARK_CONFIG_DIR=/path/to/.lark lark msg <command>
lark chat search "project" --limit 10
Available flags:
--limit: Maximum number of chats to retrieve (0 = no limit)Output fields include:
chats[] with chat_id, name, description, owner_id, external, chat_statuscount, querySend messages to users or group chats as the bot.
lark msg send --to ou_xxxx --text "Hello!"
Reply in thread:
lark msg send --to oc_xxxx --parent-id om_xxxx --msg-type text --text "Replying here"
Available flags:
--to (required): Recipient identifier (user ID, open_id, email, or chat_id)--to-type: Explicitly specify ID type (open_id, user_id, email, chat_id) - auto-detected if omitted--text: Message text content (markdown-lite). Use {{image}} to place images.--image: Image file path (repeatable)--msg-type: Message type: post (default) or text--parent-id: Parent message ID to reply in thread (optional)--root-id: Root message ID for thread replies (optional)Output:
{
"success": true,
"message_id": "om_dc13264520392913993dd051dba21dcf",
"chat_id": "oc_xxxxx",
"create_time": "2026-01-14T10:30:00+08:00"
}
lark msg history --chat-id oc_xxxxx --limit 50 --sort desc
Available flags:
--chat-id (required): Chat ID or thread ID--type: Container type - chat (default) or thread--start: Start time (Unix timestamp or ISO 8601)--end: End time (Unix timestamp or ISO 8601)--sort: Sort order - asc (default) or desc--limit: Maximum number of messages (0 = no limit)Output fields include:
messages[] with message_id, msg_type, content, sender, create_time, mentions, is_reply, thread_id, deletedcount, chat_idAdd a reaction to a message as the bot.
lark msg react --message-id om_dc13264520392913993dd051dba21dcf --reaction SMILE
Available flags:
--message-id (required): Message ID to react to--reaction (required): Reaction ID or emoji name--type: Reaction type (default: emoji)Output:
{
"success": true,
"message_id": "om_dc13264520392913993dd051dba21dcf",
"reaction_type": "emoji",
"reaction_id": "ZCaCIjUBVVWSrm5L-3ZTw...",
"emoji_type": "SMILE"
}
Notes:
SMILE, LAUGH).--parent-id are always created in a thread.lark msg react emojis
Use this command to list the supported emoji types for reactions.
Custom Emojis: Organization-specific custom emojis can be configured in .lark/config.yaml:
custom_emojis:
"7405453485858095136": "ez-pepe"
Custom emoji IDs will appear in the custom_emojis field of the output.
lark msg react list --message-id om_dc13264520392913993dd051dba21dcf --reaction SMILE --limit 50
Available flags:
--message-id (required): Message ID to list reactions for--reaction: Emoji type filter (e.g., SMILE)--limit: Maximum number of reactions to retrieve (0 = no limit)Output fields include:
message_id, reactions[], countlark msg react remove --message-id om_dc13264520392913993dd051dba21dcf --reaction-id ZCaCIjUBVVWSrm5L-3ZTw...
Available flags:
--message-id (required): Message ID to remove reaction from--reaction-id (required): Reaction ID to removeOutput fields include:
success, message_id, reaction_type, reaction_id, emoji_typeRecall/delete previously sent messages from chats.
lark msg recall om_dc13264520392913993dd051dba21dcf
Output fields include:
success, message_idDownload images, files, audio, and video from messages using msg resource:
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.pdf
Available flags:
--message-id (required): Message ID containing the resource--file-key (required): Resource key from message content (image_key or file_key)--type (required): image for images, file for files/audio/video--output (required): Output file pathOutput fields include:
success, message_id, file_key, output_path, content_type, bytes_writtenLimitations:
message_id and file_key must match\n for line breaks and \t for indentation in --text@{ou_xxx} to mention users in group chats{{image}} in text to place images in orderoc_; thread IDs start with thread_ or omt_lark msg react list to discover reaction_id for removal--to-type if neededtext - Plain text messagepost - Rich text postimage - Imagefile - File attachmentaudio - Audio messagemedia - Video/mediasticker - Sticker/emojiinteractive - Interactive cardshare_chat - Shared chatshare_user - Shared user contactIf a message has a thread_id, it is part of a thread (or is the root). To fetch replies:
lark msg history --chat-id oc_xxxxx --limit 10 --sort desc
lark msg history --chat-id omt_1a3b99f9d2cfd982 --type thread
Thread messages will have is_reply: true for replies (root message has is_reply: false).
All commands output JSON.
Errors return JSON:
{
"error": true,
"code": "ERROR_CODE",
"message": "Description"
}
Common error codes:
AUTH_ERROR - Need to run lark auth loginSCOPE_ERROR - Missing messages permissionsVALIDATION_ERROR - Missing required fields (e.g., chat-id)API_ERROR - Lark API issue (e.g., bot not in group, missing permissions)This skill requires the messages scope group. If you see a SCOPE_ERROR, add permissions:
lark auth login --add --scopes messages
To check current permissions:
lark auth status
Additional requirements:
For reading messages:
im:message:readonlyFor sending messages:
im:message or im:message:send_as_botFor reactions:
im:message.reactions:readim:message.reactions:write_onlyom_Edit PDFs with natural-language instructions using the nano-pdf CLI.
Control Sonos speakers (discover/status/play/volume/group).
Terminal Spotify playback/search via spogo (preferred) or spotify_player.
Capture frames or clips from RTSP/ONVIF cameras.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.
Category:tools