AI

Clawdbot Integration Tutorial with Feishu

Step-by-step guide to integrating Clawdbot with Feishu messaging platform for practical implementation.

February 23, 2026
6 min read
By ClawList Team

How to Integrate Clawdbot with Feishu: A Step-by-Step Implementation Guide

Originally inspired by @lxfater


AI automation is no longer a proof-of-concept luxury — it is a production requirement. Clawdbot, one of the more capable AI agent frameworks gaining traction in developer circles, becomes significantly more powerful when connected to a real-world messaging platform like Feishu (also known as Lark). This tutorial walks you through exactly how to bridge the two, so your Clawdbot instance stops living in a terminal and starts delivering value inside the collaboration tools your team already uses.


Why Connect Clawdbot to Feishu?

Feishu is ByteDance's enterprise communication platform — a serious competitor to Slack and Microsoft Teams, with a particularly strong footprint across Asia-Pacific tech companies. It offers a mature Bot API, webhook support, card messaging, and event subscriptions, making it an excellent target for AI automation integration.

Connecting Clawdbot to Feishu gives you several immediate advantages:

  • Accessible AI responses — team members interact with your agent directly inside group chats or direct messages, no extra tooling required
  • Event-driven automation — trigger Clawdbot workflows from Feishu events such as new messages, mentions, or document changes
  • Structured output delivery — send rich Feishu card messages instead of raw text, improving readability for non-technical stakeholders
  • Audit trail — all interactions flow through Feishu's message history, giving you a natural log of agent activity

If your organization is already running on Feishu, this integration is the fastest path to putting AI automation in front of real users without asking them to change their habits.


Step 1 — Create and Configure a Feishu Bot Application

Before writing any integration code, you need a registered bot inside the Feishu open platform.

1.1 Register your application

Navigate to the Feishu Open Platform and create a new custom application. Give it a descriptive name — something like Clawdbot Assistant — so users know what they are talking to.

1.2 Enable required permissions

Under the application's permission settings, enable at minimum:

  • im:message — read and send messages
  • im:message.group_at_msg — receive @ mentions in group chats
  • im:chat — access chat metadata

For more advanced use cases (reading documents, querying calendars), add the relevant scopes at this stage. It is easier to request permissions upfront than to debug missing scope errors later.

1.3 Set up the event subscription endpoint

Feishu uses a webhook-style event subscription model. Under Event Subscriptions, add your server's callback URL:

https://your-server.com/feishu/webhook

Feishu will send a verification challenge to this URL when you save. Your server must respond with the challenge value from the request body — handle this before proceeding.

# Example verification handler (Python / FastAPI)
@app.post("/feishu/webhook")
async def feishu_webhook(request: Request):
    body = await request.json()
    
    # Respond to Feishu's URL verification challenge
    if body.get("type") == "url_verification":
        return {"challenge": body["challenge"]}
    
    # Route real events to Clawdbot
    await handle_feishu_event(body)
    return {"status": "ok"}

1.4 Retrieve your credentials

From the application dashboard, copy:

  • App ID
  • App Secret

Store these as environment variables — never hard-code credentials in source files.

export FEISHU_APP_ID=cli_xxxxxxxxxxxxxxxx
export FEISHU_APP_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Step 2 — Connect the Webhook to Clawdbot

With the Feishu side configured, the next step is wiring incoming events to your Clawdbot instance and routing responses back.

2.1 Parse the incoming message event

When a user sends a message to your bot (or @-mentions it in a group), Feishu fires a im.message.receive_v1 event. Extract the content and relevant metadata:

async def handle_feishu_event(body: dict):
    event = body.get("event", {})
    message = event.get("message", {})
    
    # Decode the message content (Feishu sends JSON-encoded content)
    import json
    content = json.loads(message.get("content", "{}"))
    user_text = content.get("text", "").strip()
    
    # Extract routing info
    chat_id = message.get("chat_id")
    message_id = message.get("message_id")
    
    if not user_text:
        return
    
    # Pass to Clawdbot for processing
    response_text = await clawdbot_process(user_text)
    
    # Send reply back to Feishu
    await send_feishu_reply(chat_id, message_id, response_text)

2.2 Invoke Clawdbot

How you call Clawdbot depends on your deployment. If you are running it as a local service:

import httpx

async def clawdbot_process(user_input: str) -> str:
    async with httpx.AsyncClient() as client:
        response = await client.post(
            "http://localhost:8080/api/run",
            json={"input": user_input},
            timeout=30.0
        )
        result = response.json()
        return result.get("output", "No response generated.")

2.3 Send the response back to Feishu

Use the Feishu messaging API to reply. For basic text replies:

async def send_feishu_reply(chat_id: str, reply_to: str, text: str):
    token = await get_feishu_tenant_token()
    
    async with httpx.AsyncClient() as client:
        await client.post(
            "https://open.feishu.cn/open-apis/im/v1/messages",
            headers={"Authorization": f"Bearer {token}"},
            json={
                "receive_id": chat_id,
                "receive_id_type": "chat_id",
                "msg_type": "text",
                "content": json.dumps({"text": text})
            }
        )

For richer output, consider using Feishu's Interactive Cards — they support markdown-style formatting, buttons, and structured data layouts, which makes Clawdbot's responses far more readable in a group context.


Step 3 — Practical Use Cases and Production Considerations

Once the integration is live, you can extend it in several directions:

Common use cases:

  • Internal knowledge base queries — point Clawdbot at your documentation and let team members ask questions directly in Feishu group chats
  • Automated report generation — trigger a Clawdbot workflow on a schedule and push summaries to a designated Feishu channel
  • Code review assistance — have Clawdbot receive pasted snippets via Feishu and return analysis or suggestions
  • Ticket triage — route incoming Feishu messages to Clawdbot for classification before forwarding to the right team

Production checklist:

  • Signature verification — validate the X-Lark-Signature header on every incoming webhook to prevent spoofed requests
  • Deduplication — Feishu may retry event delivery; store processed message_id values to avoid running Clawdbot twice on the same input
  • Rate limiting — add a per-user or per-chat request throttle to prevent runaway costs if a chat becomes very active
  • Async processing — return HTTP 200 to Feishu immediately, then process the event in a background task; Feishu will mark the delivery as failed if your handler takes too long
# Always acknowledge quickly, process asynchronously
@app.post("/feishu/webhook")
async def feishu_webhook(request: Request, background_tasks: BackgroundTasks):
    body = await request.json()
    if body.get("type") == "url_verification":
        return {"challenge": body["challenge"]}
    background_tasks.add_task(handle_feishu_event, body)
    return {"status": "ok"}

Conclusion

Integrating Clawdbot with Feishu is a concise, well-defined engineering task that delivers outsized value: you take an AI agent that previously required technical users to operate and make it instantly accessible to your entire organization through the interface they use every day. The integration surface — webhook ingestion, event parsing, Clawdbot invocation, and API reply — is small enough to ship and iterate on quickly.

Start with the minimal text-in, text-out flow described here, validate it with a real team workflow, and then layer in richer features like interactive cards, multi-turn conversation state, or tool-use capabilities as your requirements become clearer. The Feishu platform is capable enough to support sophisticated agent interactions; Clawdbot provides the reasoning layer. Connecting them is the straightforward part.

Credit to @lxfater for the original implementation guide that inspired this walkthrough.


Tags: Clawdbot, Feishu integration, AI automation, bot development, Lark API, enterprise AI, OpenClaw

Tags

#clawdbot#feishu#integration#tutorial#ai-agent

Related Articles