Loading...
Loading...
Search Feishu cloud docs, messages, and apps. Use this when users request "search docs", "search messages", "search apps", "find docs", "look up", "search docs", "find Feishu docs", or "are there any docs about xxx". Also applicable for: users wanting to find Feishu docs or Wiki on a specific topic, retrieve message records by keywords, or find internal apps. The search API must use a User Access Token, and this skill includes a complete pre-authentication check process.
npx skill4agent add riba2534/feishu-cli feishu-cli-searchfeishu-cli auth status -o jsonlogged_in=falseaccess_token_valid=trueaccess_token_valid=falserefresh_token_valid=trueaccess_token_valid=falserefresh_token_valid=false# Step A: Generate authorization URL (maximum scope)
feishu-cli auth login --print-url --scopes \
"offline_access \
search:docs:read search:message drive:drive.search:readonly \
wiki:wiki:readonly \
calendar:calendar:read calendar:calendar.event:read \
calendar:calendar.event:create calendar:calendar.event:update \
calendar:calendar.event:reply calendar:calendar.free_busy:read \
task:task:read task:task:write \
task:tasklist:read task:tasklist:write \
im:message:readonly im:message.group_msg:get_as_user im:chat:read contact:user.base:readonly \
drive:drive.metadata:readonly"Scope Naming Note: Feishu OAuth scope naming is not fully consistent.has thesearch:docs:readsuffix, while:readdoes not. This is defined by the Feishu platform and not a typo.search:message
auth_url# Step B: Exchange callback URL for Token
feishu-cli auth callback "<Callback URL provided by user>" --state "<state output from Step A>"~/.feishu-cli/token.jsonsearch:docs:readfeishu-cli search docs "keywords" [options]| Parameter | Type | Default | Description |
|---|---|---|---|
| string | All | Filter by document type (comma-separated, lowercase) |
| int | 20 | Number of results returned (0-50) |
| int | 0 | Offset (offset + count < 200) |
| string | — | Open ID of file owner (comma-separated) |
| string | — | Group ID where the file is located (comma-separated) |
| string | — | Output in JSON format |
| Type | Description | Type | Description |
|---|---|---|---|
| Legacy doc | | New version doc |
| Spreadsheet | | Slides |
| Base (multi-dimensional table) | | Mind note |
| File | | Wiki doc |
| Shortcut |
# Basic search
feishu-cli search docs "product requirements"
# Search only new version docs and Wiki
feishu-cli search docs "technical solution" --docs-types docx,wiki
# Search spreadsheets
feishu-cli search docs "data report" --docs-types sheet
# Get more results with pagination
feishu-cli search docs "quarterly report" --count 50
# Pagination query: Get first page (20 results)
feishu-cli search docs "quarterly report" --count 20 --offset 0
# Pagination query: Get second page
feishu-cli search docs "quarterly report" --count 20 --offset 20
# Output in JSON format (suitable for program parsing)
feishu-cli search docs "product requirements" -o json{
"Total": 35367,
"HasMore": true,
"ResUnits": [
{
"DocsToken": "C29IdflghosjksxWKvNutR3UsXe",
"DocsType": "docx",
"Title": "Product Requirements Document - Q2",
"OwnerID": "ou_46bb48e13f9ff5cfd4b60edae00678cd",
"URL": "https://feishu.cn/docx/C29IdflghosjksxWKvNutR3UsXe"
}
]
}DocsTokenfeishu-cli doc getdoc exportsearch:messagefeishu-cli search messages "keywords" [options]| Parameter | Type | Description |
|---|---|---|
| string | Limit to specific group chats (comma-separated) |
| string | Limit to specific sender IDs (comma-separated) |
| string | Limit to specific mentioned user IDs (comma-separated) |
| string | Message type: |
| string | Chat type: |
| string | Sender type: |
| string | Start time (Unix timestamp in seconds) |
| string | End time (Unix timestamp in seconds) |
| int | Number of results per page (default 20) |
| string | Pagination token (returned from previous page) |
| string | Output in JSON format |
# Search messages
feishu-cli search messages "launch"
# Search private chat messages (search-chats cannot find p2p sessions, use this instead)
feishu-cli search messages "hello" --chat-type p2p_chat
# Search file messages in group chats
feishu-cli search messages "weekly report" --chat-type group_chat --message-type file
# Search bot messages
feishu-cli search messages "alert" --from-type bot
# Limit to time range
feishu-cli search messages "project" --start-time 1704067200 --end-time 1704153600
# Limit to specific groups
feishu-cli search messages "meeting" --chat-ids oc_xxx,oc_yyyNote: The group chat search API () cannot find p2p private sessions. To find private chat content, usesearch-chats.search messages --chat-type p2p_chat
{
"MessageIDs": ["om_xxx", "om_yyy"],
"PageToken": "ea9dcb2f...",
"HasMore": true
}MessageIDsfeishu-cli msg get <message_id>feishu-cli search apps "keywords" [options]| Parameter | Type | Description |
|---|---|---|
| int | Number of results per page (default 20) |
| string | Pagination token |
| string | Output in JSON format |
feishu-cli search apps "approval"
feishu-cli search apps "OKR" --page-size 50| Issue | Cause | Solution |
|---|---|---|
| "Missing User Access Token" | Never logged in | Execute the two-step login process |
| "User Access Token has expired" | Both access and refresh tokens have expired | Log in again |
| Permission error 99991679 mentions app search | App search permission not enabled, or the scope is unavailable in the Developer Admin Console | Confirm if the corresponding permission is enabled in the Feishu Developer Admin Console |
Permission error 99991679 mentions | | Log in again and add the |
| No search results | Keywords do not match or no access to the docs | Try broader keywords, or check doc permissions |
| offset + count exceeds 200 | Feishu API limit | Maximum of 200 results can be retrieved via pagination |
feishu-cli-auth