larksuite / larksuite/cli

Support file/stdin content for interactive card sends

Open
#916 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

Sending interactive cards from scripts/agents is currently awkward because im +messages-send accepts --content but not a file-based content flag such as --content-file / --content @file.

For large interactive-card JSON payloads, passing the entire serialized JSON string through a shell argument is brittle.

Environment

  • lark-cli version observed: 1.0.30
  • OS: WSL Ubuntu
  • Brand: Feishu
  • Command: im +messages-send --msg-type interactive

Current workaround

CARD=$(python3 - <<'PY'
import json
print(json.dumps(json.load(open('/path/to/card.json')), ensure_ascii=False))
PY
)

lark-cli im +messages-send \
  --as bot \
  --chat-id <chat_id> \
  --msg-type interactive \
  --content "$CARD"

This works, but it is easy to break quoting/escaping for large cards.

Proposal

Support one of these equivalent forms:

lark-cli im +messages-send --msg-type interactive --content-file ./card.json

or:

lark-cli im +messages-send --msg-type interactive --content @./card.json

or stdin:

lark-cli im +messages-send --msg-type interactive --content - < ./card.json

The CLI could read the file/stdin as raw JSON for interactive messages and validate that the payload is valid JSON before sending.

Why this matters

AI agents and CI jobs commonly materialize card JSON as a file first, validate it, then send it. A file/stdin path would be safer and more consistent with other commands that already support file-backed content.

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 Go implementation of the im +messages-send command and inspect how its --content argument is handled for interactive messages. Support a file or stdin input path, validate the resulting raw JSON, and confirm that the interactive card is sent without shell-quoting workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.