larksuite / larksuite/cli

[Feature Request] 支持本人向已有跨租户联系人发私信,并完善 230038 诊断

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

Nobody has claimed this yet.

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

Description

Feature request

希望 lark-cli 支持通过已授权用户身份(UAT / --as user),向与本人已有联系、已有单聊的跨租户外部联系人发送普通私信;若当前开放平台尚未支持,请明确能力边界、是否存在可启用配置,并提供准确的 230038 诊断与恢复指引。

使用场景

我们需要向不同组织的学员分别发送个人档案链接和进度通知:

  • 每位接收者只收到自己的链接;文档协作权限已另行授予。
  • 飞书客户端中与这些外部联系人的既有单聊可正常发消息。
  • 希望以本人身份通过 CLI 自动完成,而不是桌面点击。
  • 文档授权通知、文档评论、机器人消息和本人私信不是同一种交付,不能静默互相替换。

当前结果与复现

macOS arm64;CLI 1.0.63 和官方校验和核验过的 1.0.91 均实测失败。已阅读 1.0.92 发布说明和发送实现,但尚未对 1.0.92 进行实际发送测试。

lark-cli im +messages-send \
  --as user \
  --user-id '<EXTERNAL_CONTACT_OPEN_ID>' \
  --text '经本人授权的档案通知正文及该收件人的文档链接' \
  --idempotency-key '<UNIQUE_REQUEST_ID>'

返回:

{
  "ok": false,
  "identity": "user",
  "error": {
    "type": "api",
    "subtype": "unknown",
    "code": 230038,
    "message": "cross tenant p2p chat operate forbid."
  }
}

退出码为 1。已验证:

  1. auth status --verify 有效;服务端 /authen/v1/user_info 返回预期发送者。
  2. auth scopes 确认应用已启用 im:messageim:message.send_as_user;用户授权也包含二者。
  3. 使用原始 POST /open-apis/im/v1/messages?receive_id_type=open_id,同样返回 230038。
  4. 使用既有 p2p chat_id,以及回复既有消息,另返回 230027。
  5. 外部会话的消息读取可成功;没有用读取成功推断发送成功。

公开材料已去掉真实姓名、open_id、chat_id、app_id、文档链接及消息正文。可在官方指定的私密支持渠道提供 log_id。

希望官方确认/支持

  1. 核心能力:已建立联系的跨租户用户之间,UAT 发送私信是否存在受支持的 API、应用配置或开放计划?如果需要平台团队配合,希望关联该平台需求。
  2. CLI 诊断:为 230038 增加明确分类与说明,区分跨租户接口边界、缺 scope、授权失效;避免误导用户无限重复登录。
  3. 不改变发送语义:不要自动改成 bot 身份、文档评论或桌面自动化。需要改变身份/渠道时明确告知,由调用方选择。
  4. 完成证据:发送成功返回 message_id,支持调用方按收件人回读和去重;失败不计作已通知。

相关资料

  • 用户身份发送支持已存在:#180
  • 相近的 230027 反馈:#394;本次已完成应用和用户两层权限核对。
  • 发送消息 API:230038 对应跨租户单聊限制。
  • 机器人对外共享:这是机器人身份的另一种通知方式,不等同于本人私信。

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 at the im +messages-send entry point and compare its user-identity path with the raw POST /open-apis/im/v1/messages?receive_id_type=open_id request, focusing on handling for errors 230038 and 230027. Done means the supported cross-tenant capability or boundary is documented, the diagnostic distinguishes the stated causes, and sending semantics are not silently changed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.