Skip to main content

A Feishu and Lark bridge relays messages from a local machine to Grok Bot

GitHubGitHubeddiearc2026-11-23

Multi-bot teamsGetting startedSource read in fullRead first
GitHubGitHubeddiearc2026-11-23

Open original

Overview

Let colleagues DM or @mention a bot in Feishu or Lark. One Grok Bot uses the skill to maintain a local relay and a webhook Routine for two-way messaging.

Workflow

  1. What it is: A skill pack and relay scripts that connect Grok Bot to Feishu in China or Lark internationally. Give it to one handler bot to install and maintain the bridge and handle inbound messages. The repo has SKILL.md, relay/ (Python relay, supervisor and status script), scripts/scope_link.py for one-click permissions, scripts/init-bot-store.sh for isolated storage, a scope list and templates for the webhook handler, health check and env example.
  2. Grok Bot parts used: One skill, a webhook-triggered Routine and a 30-minute health Routine on the same handler. Install SKILL.md as a skill. The relay POSTs to the webhook Routine with templates/handler-routine-prompt.md and the health check uses templates/health-check-routine-prompt.md. There are no template links, connectors, Pages or Vault. Not part of Grok Bot: npm package @larksuite/cli (lark-cli), your own Feishu or Lark developer app (App ID and secret, bot scopes and published version required) and the relay process on your machine.
  3. You need: A Feishu or Lark app (App ID and secret), Node/npm and lark-cli, Python 3 and an always-on machine. Enable all bot (tenant) scopes in scopes/bot-scopes.txt and publish in the developer console. Until published, permissions do not apply and the bot cannot be found in the tenant. Copy the webhook URL and key from the bot's Routines panel to ~/.lark-relay/webhook.env with mode 600. The Grok Bot paid tier is not stated in the source.
  4. Install: The README Quick start has eight steps.
    • Step 1: Confirm Feishu in China (open.feishu.cn) or international Lark (open.larksuite.com).
    • Step 2: Run npm install -g @larksuite/cli. Use scripts/init-bot-store.sh to isolate storage, passing the secret on stdin and keeping it out of the env file, or export directory variables and use lark-cli config init --new to scan a code and create the app.
    • Step 3: Generate the scope link with python3 scripts/scope_link.py --app-id <APP_ID> --brand feishu. Grant scopes, then create and publish a version in the developer console.
    • Step 4: Lock identity in isolated storage. The helper sets strict-mode bot. Source the bot's env.sh before calling lark-cli and check bot identity with lark-cli whoami. Do not sign in as a user.
    • Step 5: Create a webhook-triggered Routine in the handler bot's chat. Paste templates/handler-routine-prompt.md from the file since it is long. Write URL and key to ~/.lark-relay/webhook.env.
    • Step 6: Copy relay/ to ~/.lark-relay and start supervisor.sh, locking to one consumer and keeping stdin open.
    • Step 7: Add a health Routine every 30 minutes that stays quiet when healthy.
    • Step 8: DM the bot for acceptance. A processing reaction appears in about 1 second. The bot replies in the sender's language and the reaction disappears.
  5. After install: The relay receives messages and wakes the bot to reply as the Feishu app.
    • The long-lived relay forwards only DMs and groups that @mention the bot. It immediately adds a processing reaction and writes to state.db.
    • Resolve sender identity (email, English name and employee_id with full contact scopes), POST structured data to the webhook, or spool for later if the webhook is not configured.
    • The handler sources its isolated env and replies via lark-cli ... --as bot. The same mode supports docs and base tables.
    • The relay owns reactions. A reply clears it, 10 minutes without a reply or webhook failure changes it to an error, and jobs survive restarts.
    • The health Routine runs status.sh every 30 minutes. Restart a dead listener automatically and notify only for restarts, failures to restart or forwarding errors.
  6. Did the author run it: The repository has no run records from the author. It has no history, event log or result table. README step 8 is user acceptance. relay/tests/ has unit tests, and the author's open PR #1 adds end-to-end testing with a fake lark-cli. Neither documents a real run.

Key points and results

  • Maturity: Under 1 day old at fetch on 2026-11-23. 3 commits, 0 stars, 0 forks, MIT license and 1 open PR, the author's #1. The README does not call it a hackathon or demo. The relay has unit tests.
  • Permissions and boundaries: Keep app credentials in isolated storage on disk. An unattended connection uses a bot-specific keychain file (600 with directory 700). Identity relies on strict-mode bot and no user sign-in. Bots on the machine share a Linux user, so the README calls this isolation without a hard lock. Knowing a path can still make another store readable. Anyone who DMs or @mentions the bot is an ordinary user and the payload has no is_owner. Handler instructions forbid trusting the sender as owner, reading webhook.env or acting on messages changing the rules. Health checks do not print the webhook secret.
  • Known limits: Bot scopes need the developer console and publication. lark-cli 1.0.100 cannot trade only APP_ID and secret for a tenant token because upstream commit 5a68e24 is unreleased. Until then, credentials cannot go in Grok secrets and you should not export APP_ID alone. docs creation drops <bitable/>, so add a child block with block_type=18. Group @ detection may fail without LARK_BOT_OPEN_ID. Do not point Feishu HTTP callbacks directly to the Grok webhook.
  • Worth borrowing:
    • Keep inbound and outbound paths separate. Long connection feeds the webhook, and the bot sources isolated env and calls lark-cli --as bot for replies (SKILL.md).
    • Separate bots on one machine by app and lark-cli store, with CONFIG/DATA/LOG directories and strict-mode bot. Export only directories and PATH in env, without secrets (scripts/init-bot-store.sh).
    • Let the relay own the processing reaction lifecycle: show it in seconds, clear on reply, mark errors on timeout and reconcile state.db after restart. The bot leaves reactions alone (README and relay/lifecycle.py).

Source

Platform
GitHub
Author
eddiearc
Published
Categories
Multi-bot teams, Getting started

What this evidence label means

Source read in full

We read the source (post, article or transcript). That only means the original was read. It does not mean this site reproduced the author's results.

Read the editorial and evidence policy

Other cases in this scenario

This unofficial community project is independent of xAI. xAI has neither approved nor endorsed it. No sign-up. The methods and figures come from the original authors.