The GitHub org Molecule-AI was suspended on 2026-05-06; canonical SCM is now Gitea at https://git.moleculesai.app/molecule-ai/. Stale github.com/Molecule-AI/... URLs return 404 and break tooling that clones / pip-installs / curls them. This bundles all non-Go-module URL fixes for this repo into a single PR. Go module path references (in *.go, go.mod, go.sum) are out of scope here -- tracked separately under Task #140. Token-auth clone URLs also flip ${GITHUB_TOKEN} -> ${GITEA_TOKEN} since the GitHub token does not auth against Gitea. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.4 KiB
Connecting an AI Agent to Lark / Feishu
Molecule AI's Lark channel adapter (shipped in #480) lets any workspace agent receive messages from Lark or Feishu chats and reply through the same thread. This tutorial gets you from zero to a live bot in about ten minutes.
Lark vs Feishu — same payload format, different host. Lark is the international product; Feishu is the China edition. The adapter detects which host to use from your webhook URL.
Prerequisites
- A Molecule AI workspace already running (any runtime)
- A Lark tenant with permission to create a Custom Bot
PLATFORM_URLand a workspace bearer token
Setup
# 1. Create a Lark Custom Bot in your group chat
# Settings → Bots → Add Bot → Custom Bot
# Copy the Webhook URL — looks like:
# https://open.larksuite.com/open-apis/bot/v2/hook/<token>
# 2. (Recommended) Set a Verification Token in the Lark bot settings.
# This lets the platform reject spoofed inbound messages.
# 3. Register the channel on your workspace
curl -s -X POST "${PLATFORM_URL}/workspaces/${WORKSPACE_ID}/channel" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"type": "lark",
"config": {
"webhook_url": "https://open.larksuite.com/open-apis/bot/v2/hook/YOUR_TOKEN",
"verify_token": "YOUR_VERIFY_TOKEN"
}
}'
# 4. Point Lark Event Subscriptions at your platform
# Lark Developer Console → Event Subscriptions → Request URL:
# https://YOUR_PLATFORM/channels/lark/webhook
# 5. Subscribe to the im.message.receive_v1 event in Lark console.
# 6. Send a message in the Lark group — your agent replies.
# Watch the round-trip:
molecule workspace logs ${WORKSPACE_ID} --follow
The 200-OK-but-failed gotcha
Lark's outbound API always returns HTTP 200, even on delivery failure. The real result is in the JSON body:
{ "code": 99, "msg": "...", "data": {} }
Molecule AI surfaces code != 0 as a hard Go error so your agent sees an
actual failure instead of silent data loss. Check last_sample_error on the
workspace if messages seem to disappear.
Expected output
After step 6, workspace logs shows:
[channel:lark] inbound user_id=ou_xxx text="Hello agent"
[agent] reply "Hi! How can I help you today?"
[channel:lark] outbound code=0 ok
How it works
When a Lark user sends a message the platform receives a v2 event_callback
(im.message.receive_v1). It validates the optional verify_token with a
constant-time compare (timing-attack safe), then proxies the text through the
standard A2A flow — the same path used by Telegram and Slack. The agent never
knows which channel it's talking to. Replies go back via the Custom Bot
webhook; the adapter prefers user_id over open_id so replies land in the
correct DM thread when the bot has contacts permission.
Multi-channel teams
You can attach different channels to different workspaces in the same org. Route customer-facing chats to a triage agent on Lark while your eng team talks to the DevOps agent on Slack — all coordinated through the same Molecule AI canvas without code changes.