Feishu CLI Messaging Commands

Send messages, manage group chats, search conversations, reply to threads, and download media — all from the command line or through AI Agent automation.

Instant Messaging from the Terminal

The Feishu CLI messenger module provides 10 shortcut commands for comprehensive instant messaging control. Send text, markdown, images, and files to group chats or individual users. Manage group creation, search message history, and handle media downloads — all from the command line or through AI Agent automation. Every shortcut maps directly to the Lark Open Platform IM API, giving you full programmatic access to Feishu/Lark messaging.

+messages-send — Send Messages to Chats or Users

Send text, markdown, images, files, video, or audio to any group chat or individual user. The bot identity is used by default. You can target a group chat with --chat-id or a specific user with --user-id.

# Send plain text to a group chat $ lark-cli im +messages-send --chat-id "oc_xxx" --text "Hello team"
# Send markdown to an individual user $ lark-cli im +messages-send --user-id "ou_xxx" --markdown "**Important update**: Deploy completed successfully."
# Send an image file $ lark-cli im +messages-send --chat-id "oc_xxx" --image ./screenshot.png
# Send a file attachment $ lark-cli im +messages-send --chat-id "oc_xxx" --file ./report.pdf
# Send raw JSON content with an idempotency key $ lark-cli im +messages-send --chat-id "oc_xxx" --content '{"text":"Custom payload"}' --idempotency-key "unique-key-001"

Supported Parameters

ParameterDescription
--chat-idTarget group chat ID (oc_xxx format)
--user-idTarget user ID for direct messages (ou_xxx format)
--textSend plain text message
--markdownSend markdown-formatted message
--imageSend an image file (local path)
--fileSend a file attachment (local path)
--videoSend a video file (local path)
--audioSend an audio file (local path)
--contentSend raw JSON content payload
--idempotency-keyUnique key to prevent duplicate sends

Identity: Bot identity only (--as bot). The sender name displays as the bot’s configured name.

+messages-reply — Reply to Threads

Reply to a specific message by its message ID. Supports all the same content types as +messages-send. Replies appear as threaded responses in the conversation.

# Reply with text $ lark-cli im +messages-reply --message-id "om_xxx" --text "Got it, thanks!"
# Reply with a markdown message $ lark-cli im +messages-reply --message-id "om_xxx" --markdown "Resolved in commit `a1b2c3d`"

+messages-search — Search Message History

Full-text search across message history. Filter by chat, sender, and date range. Requires user identity — bot identity is not supported for search.

# Search for messages containing "quarterly report" in a specific chat $ lark-cli im +messages-search --query "quarterly report" --chat-id "oc_xxx"
# Search with sender and date filters $ lark-cli im +messages-search --query "deployment" --sender "ou_xxx" --start "2026-03-01" --end "2026-03-30"
# Paginate through results $ lark-cli im +messages-search --query "bug fix" --page-token "next_page_token_abc"

Parameters

ParameterDescription
--querySearch query string (required)
--chat-idLimit search to a specific chat
--senderFilter by sender user ID
--startStart date for date range filter
--endEnd date for date range filter
--page-tokenPagination token for next page

Identity: User identity only. Bot identity cannot perform message searches.

+chat-messages-list — List Messages in a Chat

Retrieve all messages from a group chat or P2P conversation within a date range. Use --chat-id for group chats or --user-id for direct message history.

# List messages from a group chat in March 2026 $ lark-cli im +chat-messages-list --chat-id "oc_xxx" --start "2026-03-01" --end "2026-03-30"
# List P2P messages with a specific user $ lark-cli im +chat-messages-list --user-id "ou_xxx" --start "2026-03-01" --end "2026-03-30"

+chat-create — Create a New Group Chat

Programmatically create group chats with a name, description, and initial members. Uses bot identity.

# Create a group chat with two initial members $ lark-cli im +chat-create --name "Project Alpha" --description "Team discussion" --users "ou_xxx,ou_yyy"
# Create a chat with just a name $ lark-cli im +chat-create --name "Daily Standup"

+chat-search — Search for Group Chats

Search for group chats by name or keyword. Useful for finding the right chat ID before sending messages.

# Search for chats containing "engineering" $ lark-cli im +chat-search --query "engineering"

+chat-update — Update Chat Settings

Modify a group chat’s name, description, or other settings after creation.

# Update a chat's name and description $ lark-cli im +chat-update --chat-id "oc_xxx" --name "New Name" --description "Updated description"

+messages-resources-download — Download Message Attachments

Download images, files, and other media attached to messages. Requires the message ID, file key, and resource type.

# Download an image from a message $ lark-cli im +messages-resources-download --message-id "om_xxx" --file-key "xxx" --type image
# Download a file attachment $ lark-cli im +messages-resources-download --message-id "om_xxx" --file-key "yyy" --type file

+threads-messages-list — List Messages in a Thread

Retrieve all replies within a specific message thread. Threads are identified by their thread ID (ot_xxx format).

# List all messages in a thread $ lark-cli im +threads-messages-list --thread "ot_xxx"

+messages-mget — Batch Retrieve Messages

Fetch multiple messages by their IDs in a single request. Efficient for retrieving specific messages without listing an entire chat.

# Batch get multiple messages by ID $ lark-cli im +messages-mget --message-ids "om_xxx,om_yyy"

Bot vs User Identity

Feishu CLI messaging commands operate under two identity modes. Understanding the difference is important for choosing the right approach.

FeatureBot IdentityUser Identity
Send messagesYesNo
Reply to messagesYesNo
Search messagesNoYes
Create group chatsYesNo
List chat messagesYesYes
Download mediaYesYes

When using bot identity, the sender name is the bot’s configured display name. To resolve human-readable sender names in listed messages, you may need to cross-reference user IDs with the contact API.

All Messaging Shortcut Commands

ShortcutDescriptionRiskKey Parameters
+messages-sendSend a message to a chat or userLow--chat-id, --user-id, --text, --markdown, --image, --file
+messages-replyReply to a specific messageLow--message-id, --text, --markdown
+messages-searchFull-text search across messagesSafe--query, --chat-id, --sender, --start, --end
+chat-messages-listList messages in a chatSafe--chat-id, --user-id, --start, --end
+chat-createCreate a new group chatMedium--name, --description, --users
+chat-searchSearch for group chatsSafe--query
+chat-updateUpdate chat name or descriptionMedium--chat-id, --name, --description
+messages-resources-downloadDownload message attachmentsSafe--message-id, --file-key, --type
+threads-messages-listList messages in a threadSafe--thread
+messages-mgetBatch retrieve messages by IDSafe--message-ids

Related Feishu CLI Guides