Summary
When creating a Feishu/Lark approval instance with an attachmentV2 widget, files uploaded through lark-cli api POST /open-apis/approval/v4/files/upload are accepted and can be attached to the approval, but the approval UI displays them as unknown file because the original filename/extension is not preserved in the created approval instance.
There is also a mismatch between instances/preview and instances:
instances/preview accepts object-shaped attachmentV2.value entries that include code, name, and type.
instances rejects the same object-shaped values with Widget value is not string.
This makes it hard for agents/scripts to create approval instances with user-friendly attachment names.
Environment
lark-cli version 1.0.22
- macOS
- Command path:
lark-cli api ...
- Approval API:
/open-apis/approval/v4/files/upload, /open-apis/approval/v4/instances/preview, /open-apis/approval/v4/instances
Reproduction
- Upload a PDF attachment and include
name and type in multipart form fields:
lark-cli api POST /open-apis/approval/v4/files/upload \
--as bot \
--file path/to/invoice.pdf \
--data '{"type":"attachment","name":"invoice.pdf"}' \
--format json
The upload succeeds and returns a file code.
- Use the returned
code in an approval attachmentV2 widget:
{
"id": "widget_attachment",
"type": "attachmentV2",
"value": ["<uploaded-file-code>"]
}
- Create the approval instance:
lark-cli api POST /open-apis/approval/v4/instances \
--as bot \
--data - \
--format json < approval_request.json
The instance is created successfully, but the approval UI shows the attachment as unknown file instead of invoice.pdf.
Preview vs Create Mismatch
The preview endpoint accepts object-shaped values:
{
"id": "widget_attachment",
"type": "attachmentV2",
"value": [
{
"code": "<uploaded-file-code>",
"name": "invoice.pdf",
"type": "attachment"
}
]
}
This request succeeds against:
lark-cli api POST /open-apis/approval/v4/instances/preview --as bot --data -
But the create endpoint rejects the same payload:
lark-cli api POST /open-apis/approval/v4/instances --as bot --data -
Error:
Widget value is not string. index= 5, widget type= attachmentV2.
Expected Behavior
One of the following would make the workflow reliable:
files/upload preserves the uploaded filename/extension so approval UI displays invoice.pdf instead of unknown file.
instances accepts the same object-shaped attachmentV2.value that instances/preview accepts, including name and type.
lark-cli documents the limitation and provides a recommended way to create approval attachments with visible filenames.
Actual Behavior
- Uploaded attachments can be attached to approval instances.
- Approval UI displays the attachment as
unknown file.
- Supplying a filename in
files/upload --data '{"name":"..."}' does not appear to affect the displayed filename.
- Supplying object-shaped attachment values passes preview but fails create.
Workaround
For image-like attachments, converting a PDF to PNG and uploading it as type=image avoids the worst UX because the image is previewable, but this is not a good replacement for preserving the original filename for PDFs and other documents.
Summary
When creating a Feishu/Lark approval instance with an
attachmentV2widget, files uploaded throughlark-cli api POST /open-apis/approval/v4/files/uploadare accepted and can be attached to the approval, but the approval UI displays them asunknown filebecause the original filename/extension is not preserved in the created approval instance.There is also a mismatch between
instances/previewandinstances:instances/previewaccepts object-shapedattachmentV2.valueentries that includecode,name, andtype.instancesrejects the same object-shaped values withWidget value is not string.This makes it hard for agents/scripts to create approval instances with user-friendly attachment names.
Environment
lark-cli version 1.0.22lark-cli api .../open-apis/approval/v4/files/upload,/open-apis/approval/v4/instances/preview,/open-apis/approval/v4/instancesReproduction
nameandtypein multipart form fields:lark-cli api POST /open-apis/approval/v4/files/upload \ --as bot \ --file path/to/invoice.pdf \ --data '{"type":"attachment","name":"invoice.pdf"}' \ --format jsonThe upload succeeds and returns a file
code.codein an approvalattachmentV2widget:{ "id": "widget_attachment", "type": "attachmentV2", "value": ["<uploaded-file-code>"] }lark-cli api POST /open-apis/approval/v4/instances \ --as bot \ --data - \ --format json < approval_request.jsonThe instance is created successfully, but the approval UI shows the attachment as
unknown fileinstead ofinvoice.pdf.Preview vs Create Mismatch
The preview endpoint accepts object-shaped values:
{ "id": "widget_attachment", "type": "attachmentV2", "value": [ { "code": "<uploaded-file-code>", "name": "invoice.pdf", "type": "attachment" } ] }This request succeeds against:
But the create endpoint rejects the same payload:
Error:
Expected Behavior
One of the following would make the workflow reliable:
files/uploadpreserves the uploaded filename/extension so approval UI displaysinvoice.pdfinstead ofunknown file.instancesaccepts the same object-shapedattachmentV2.valuethatinstances/previewaccepts, includingnameandtype.lark-clidocuments the limitation and provides a recommended way to create approval attachments with visible filenames.Actual Behavior
unknown file.files/upload --data '{"name":"..."}'does not appear to affect the displayed filename.Workaround
For image-like attachments, converting a PDF to PNG and uploading it as
type=imageavoids the worst UX because the image is previewable, but this is not a good replacement for preserving the original filename for PDFs and other documents.