larksuite / larksuite/cli

feat(im/task): 支持发送原生「任务卡片」消息(带按钮的 msg_type: todo)

Open
#2,297 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domain/im domain/task
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

背景

在飞书客户端里可以把一个任务「分享」到会话,对方收到的是一张原生任务卡片 —— 带任务标题、负责人、截止时间,以及「完成 / 查看」等可交互按钮,点一下就能操作。这类消息的 msg_typetodo

但这个能力在 CLI / OpenAPI 上完全不可用。

现状

im +messages-send 不接受 todo 类型:

$ lark-cli im +messages-send --chat-id oc_xxx --msg-type todo --content '{"task_id":"<guid>"}' --dry-run --as user
{
  "ok": false,
  "error": {
    "type": "validation",
    "subtype": "invalid_argument",
    "message": "invalid value \"todo\" for --msg-type, allowed: text, post, image, file, audio, media, interactive, share_chat, share_user",
    "param": "--msg-type"
  }
}

底层 OpenAPI 也拒绝该类型,msg_type: todo 属于客户端专有格式。

目前的替代方案很难用:只能在消息里贴一条 applink 纯链接

https://applink.feishu.cn/client/todo/detail?guid=<guid>&suite_entity_num=t123456

这是一条普通文本链接 —— 没有标题预览、没有负责人和截止时间、没有任何可点的操作按钮,接收方必须跳出会话才知道这是什么任务。对于「建完任务同步到群里」这种极高频的场景(尤其是 Agent 自动建任务后通知相关人),体验差距非常大。

期望

支持发送原生任务卡片,任一形式均可:

  1. im +messages-send 增加 --msg-type todo,content 传 {"task_id": "<task_guid>"}
  2. 或在 task 域下提供快捷命令,例如 task +share --task-guid <guid> --chat-id oc_xxx
  3. 至少提供一个能生成等效交互卡片(interactive)的内置模板,把任务标题 / 负责人 / 截止时间 / 跳转按钮组装好

环境

  • lark-cli version: 1.0.85
  • 相关命令:im +messages-sendtask tasks create

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the im +messages-send command and its --msg-type validation, then compare the task tasks create flow and the documented OpenAPI behavior for msg_type todo. Determine whether native todo messages are actually available to this CLI or require an interactive-card fallback. Done means one supported task-sharing path is implemented and verified for task title, assignee, deadline, and action or navigation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.