How to Integrate a Feishu AI Bot: 7 Steps + 8 Troubleshooting Checks

The integration is not the hard part — not knowing which link broke is

2026-10-26 · Leo · Tutorials · 12 min read
TL;DR — A Feishu AI bot integration has exactly four links: create a custom app and get credentials → grant scopes → set up the inbound channel (event webhook or long connection) → call the send-message API to reply. Most "I connected it but nothing happens" cases fail on the third link: the callback URL never passed verification, the event was never subscribed, or the bot is not in the group. Below are seven ordered steps, a way to verify each one, and eight troubleshooting entries — so when you get stuck you do not have to start guessing from the top.
⚠️ This article describes integration methods and debugging reasoning only. It contains no customer cases, no real credentials, and no internal system details. The Feishu open platform UI, scope names, and API versions change over time — always confirm field names and approval flows against the official documentation and what your admin console actually shows.

The big picture: how many links are there really

Strip away the branding and a Feishu AI bot is three things combined: an application identity (who is speaking), an inbound channel (how the user's message reaches you), and an outbound channel (how your answer gets back into the conversation).

LinkWhat you doTypical symptom when it breaks
IdentityCreate a custom app, obtain App ID and App SecretEvery API call returns an auth error
InboundEvent webhook or long connectionYour server log shows no request at all
OutboundCall the send-message API to post the answerRequest arrives, but nothing appears in chat

These three links are serial: if an earlier one is broken, the later ones never produce a visible symptom. That is why the first rule of debugging is to verify link by link instead of suspecting the model or your code first.

Step 1: Create a custom app and get credentials

Create an enterprise custom app in the Feishu open platform console. You get two values: App ID and App Secret. They are used to exchange for an access token (tenant access token), which authenticates every subsequent API call.

Verification for this step is simple: exchange credentials for a token once. If you get one back, the identity link works.

# Exchange for an access token (illustrative; confirm fields in official docs)
POST /open-apis/auth/v3/tenant_access_token/internal
{
  "app_id": "cli_xxx",
  "app_secret": "xxx"
}
# On success: access_token plus an expire value in seconds

Key point: tokens expire. Do not re-exchange on every request, and do not hardcode a token for long-term use. Cache it and refresh ahead of expiry — for example, re-exchange when less than five minutes remain.

Step 2: Grant scopes — one missing scope fails silently

Feishu scopes are granted capability by capability, not "enable the bot and everything works". An AI bot scenario usually touches three groups:

Scope groupPurposeWhat happens if missing
Messages and groupsReceive message events, send messages, read group infoEvents arrive but replies fail, or nothing arrives at all
Contacts (optional)Map a user identity to an internal accountYou cannot tell who is asking, so permission tiers are impossible
Docs and wiki (optional)Let the bot read enterprise documents to answerKnowledge answers fail or go off topic

Key point: after requesting scopes you usually must publish a version and wait for admin approval. Many people change scopes, test immediately, and still see failures — the version was never published. Verify this step by checking that the scope status reads "effective", not merely "requested".

Step 3: Choose the inbound channel — webhook vs long connection

This is the most consequential choice in the whole guide. Feishu supports two ways to deliver messages to your service, and they fit very different situations:

DimensionEvent webhookLong connection
MechanismFeishu POSTs to your public URLYour service connects out and holds a persistent link
Public URL requiredYes, and it must be HTTPSNo
Signature verificationRequiredNot required (the connection itself authenticates)
Best forTeams that already run a public serviceIntranet, local development, private deployments
Main riskUnreachable URL, certificate issues, signature mismatchConnection drops and needs automatic reconnect

The decision rule is direct: does your service have a publicly reachable HTTPS address? If yes, prefer the webhook — it is more standard and easier to inspect. If no (intranet, private deployment, local debugging), use the long connection.

If the company is going down a private-deployment path overall, the long connection is usually the lower-friction option and makes the data boundary easier to explain. For the wider trade-offs, see how to choose a private AI deployment approach.

Step 4: Three things the webhook mode must handle

If you pick the webhook, your server has to handle more than "receive the message". Three items are routinely skipped:

① URL verification (challenge handshake)

When you register the callback URL, Feishu first sends a verification request. You must echo the challenge value back unchanged before the URL is marked verified. If this fails, no event will ever be delivered.

② Signature verification (reject forged requests)

Real events carry a signature header. Your server must recompute the signature from the app credentials using the documented algorithm and compare; reject on mismatch. Skipping this exposes your bot endpoint to anyone — it is a security baseline, not a nice-to-have.

③ Respond fast, process asynchronously

Return success quickly and push the actual work (especially LLM calls) onto an async queue. If you block until the model finishes, the request times out, Feishu retries, and the same message gets processed more than once.

Idempotency is the item most often missed here: events can be delivered more than once, so deduplicate by event ID — otherwise users see the bot answer the same question twice.

Step 5: Put the bot in the group, and handle mentions vs direct chat

With scopes and channel working, one more thing remains: the bot must be in the conversation. In group chat it has to be added to the group, and by default it only receives messages when mentioned — that is product design, not a bug.

ScenarioTriggerWatch out for
Group chatBot is mentionedMessage text usually contains a mention placeholder; strip it before using the question
Direct chatUser messages the bot directlyDirect-chat capability must be enabled and the version published
Topic groupMentioned inside a topicReply must land in the same topic or it leaks into the main group

Teams running several IM platforms should note one more thing: message structures, mention syntax, and rich-text formats differ across platforms. Put "extract the user question" behind a platform-neutral layer so that adding WeCom or DingTalk later does not mean rewriting business logic — see DingTalk vs Feishu vs WeCom AI bot.

Step 6: Streaming replies — where experience is decided

AI answers take seconds to tens of seconds. If you send the finished text in one shot, users read it as "the bot froze". Streaming means posting a placeholder message first, then updating that same message incrementally.

# Illustrative flow (confirm endpoints and fields in official docs)
1. Receive event -> return success immediately
2. Send a placeholder message, keep its message_id
3. Stream model output -> update the message every 300-500 ms
4. On completion -> one final full update

Key point: do not update too often — the send API is rate limited and per-token updates will be throttled; do not update too rarely either, or it is no better than a single send. In practice 300–500 ms is a stable band, and you should degrade to a single send if updates start failing.

Step 7: The go-live checklist

"Integration finished" is not "ready to launch". Tick every row below; if any is unverified, do not declare it done.

#CheckCriterion
1Credentials exchange for a tokenA standalone script succeeds, independent of business code
2Scopes are effectiveConsole shows "effective", not "requested"
3Inbound channel worksServer log shows real events, not just the verification request
4Signature verification onForged requests are rejected and logged
5Idempotency implementedA duplicate event is processed once
6Group and direct chat both testedBoth entry points answer correctly
7Streaming worksTime to first visible text is clearly shorter than full generation
8Failures degrade gracefullyModel timeout or rate limit produces a readable message, never silence

8 troubleshooting entries: check in this order

1. No request in the server log at all

First confirm the callback URL passed verification, then confirm the event is actually subscribed — holding the scope without subscribing the event still delivers nothing.

2. Verification passes, real events never arrive

Usually scopes not effective or version not published. Check scope status and publish the version again.

3. Event arrives but signature verification fails

Check whether you signed the raw request body. Many frameworks parse JSON automatically, which breaks the signature — compute over the unparsed body.

4. Bot stays silent, log shows send API errors

Usually a missing send-message scope, or the wrong conversation identifier. Confirm whether you are sending to a chat_id or an open_id — they are not interchangeable.

5. Mentioned in a group, no response

Confirm the bot was added to the group and the event subscription includes group messages. Direct chat working while groups do not is almost always this one.

6. Same message answered twice

Callback timed out and Feishu retried. Move processing to async and deduplicate by event ID.

7. Streaming updates get rate limited

Reduce update frequency to one per 300–500 ms, and degrade to a single send when throttled instead of failing outright.

8. Works locally, fails after deployment

First confirm the deployed environment can reach the internet (token exchange requires it). For intranet environments, switch to the long connection rather than fighting egress policy.

Closing thoughts

The hard part of a Feishu AI bot is not writing code — it is splitting the four links apart so each one is independently verifiable. Identity, scopes, inbound, outbound: when any of them is dark, the symptom is identical — "nothing happens". Without per-link verification, you can only guess.

Treat the seven steps as a build order, the eight entries as a lookup table for when you are stuck, and the checklist as the launch gate. That sequence takes roughly half a day to a day. The rest of your time belongs to answer quality and permission boundaries — that is what actually decides whether anyone uses the bot.

💡 Further reading: multi-platform architecture in connecting an AI agent to IM platforms; cross-platform comparison in DingTalk vs Feishu vs WeCom AI bot; permission boundaries in AI agent permission and security pitfalls.