Fixed workflow for sending Feishu IM files
Applicable scenarios
- The user explicitly requests to send
docx/pdf/xlsx/ppt as a Feishu chat attachment .
- The user mentions "cannot receive the file in Feishu" or "it was only written to the document and not pushed to the chat".
Mandatory rules (must be followed)
- Only use
feishu_media to send chat attachments; the action is fixed as upload_and_send_file。
- Prohibited to use
message 's filePath to send files to Feishu (that path is not the main path for Feishu attachments).
- Prohibited to use
feishu_doc 's upload_file instead of sending an attachment in the chat (it only writes the attachment into a document block).
- The parameter name must be
file_path(underscore), and it must be an absolute path readable at runtime.
- After sending, the reply must include the key fields of the send result:
ok、fileKey(at least fileKey)。
Execution steps
- Confirm that the artifact file actually exists (for example
output/report.docx)。
- Download/copy it to a locally readable absolute path (for example
/tmp/report.docx)。
- Call
feishu_media:
action: "upload_and_send_file"
to: for group chats use chat:<chat_id>; for private chats use open_id:<open_id>
file_path: /tmp/report.docx
file_name: report.docx(optional but recommended)
- Check the tool return; if it fails, return a clear error message and do not claim "sent".
Standard invocation example
{
"action": "upload_and_send_file",
"to": "chat:oc_xxx",
"file_path": "/tmp/report.docx",
"file_name": "report.docx"
}
Failure handling
- If it returns
schema is invalid: check whether filePath was mistakenly used or the parameter was placed at the wrong level, and change it to file_path。
- If an account/permission error is returned: indicate the specific account and permission issue, and keep the file path for retry.
- If the file does not exist: first go back to the artifact generation step to complete the file, then resend the attachment.