Skip to main content

Feishu bot

Status: production-ready, supports bot DMs and group chats. Uses WebSocket long connection mode to receive events.

Plugin required

Install the Feishu plugin:
openclaw plugins install @openclaw/feishu
Local checkout (when running from a git repo):
openclaw plugins install ./extensions/feishu

Quickstart

There are two ways to add the Feishu channel: If you just installed OpenClaw, run the wizard:
openclaw onboard
The wizard guides you through:
  1. Creating a Feishu app and collecting credentials
  2. Configuring app credentials in OpenClaw
  3. Starting the gateway
After configuration, check gateway status:
  • openclaw gateway status
  • openclaw logs --follow

Method 2: CLI setup

If you already completed initial install, add the channel via CLI:
openclaw channels add
Choose Feishu, then enter the App ID and App Secret. After configuration, manage the gateway:
  • openclaw gateway status
  • openclaw gateway restart
  • openclaw logs --follow

Step 1: Create a Feishu app

1. Open Feishu Open Platform

Visit Feishu Open Platform and sign in. Lark (global) tenants should use https://open.larksuite.com/app and set domain: "lark" in the Feishu config.

2. Create an app

  1. Click Create enterprise app
  2. Fill in the app name + description
  3. Choose an app icon
Create enterprise app

3. Copy credentials

From Credentials & Basic Info, copy:
  • App ID (format: cli_xxx)
  • App Secret
Important: keep the App Secret private. Get credentials

4. Configure permissions

On Permissions, click Batch import and paste:
{
  "scopes": {
    "tenant": [
      "aily:file:read",
      "aily:file:write",
      "application:application.app_message_stats.overview:readonly",
      "application:application:self_manage",
      "application:bot.menu:write",
      "contact:user.employee_id:readonly",
      "corehr:file:download",
      "event:ip_list",
      "im:chat.access_event.bot_p2p_chat:read",
      "im:chat.members:bot_access",
      "im:message",
      "im:message.group_at_msg:readonly",
      "im:message.p2p_msg:readonly",
      "im:message:readonly",
      "im:message:send_as_bot",
      "im:resource"
    ],
    "user": ["aily:file:read", "aily:file:write", "im:chat.access_event.bot_p2p_chat:read"]
  }
}
Configure permissions

5. Enable bot capability

In App Capability > Bot:
  1. Enable bot capability
  2. Set the bot name
Enable bot capability

6. Configure event subscription

⚠️ Important: before setting event subscription, make sure:
  1. You already ran openclaw channels add for Feishu
  2. The gateway is running (openclaw gateway status)
In Event Subscription:
  1. Choose Use long connection to receive events (WebSocket)
  2. Add the event: im.message.receive_v1
⚠️ If the gateway is not running, the long-connection setup may fail to save. Configure event subscription

7. Publish the app

  1. Create a version in Version Management & Release
  2. Submit for review and publish
  3. Wait for admin approval (enterprise apps usually auto-approve)

Step 2: Configure OpenClaw

openclaw channels add
Choose Feishu and paste your App ID + App Secret.

Configure via config file

Edit ~/.openclaw/openclaw.json:
{
  channels: {
    feishu: {
      enabled: true,
      dmPolicy: "pairing",
      accounts: {
        main: {
          appId: "cli_xxx",
          appSecret: "xxx",
          botName: "My AI assistant",
        },
      },
    },
  },
}

Configure via environment variables

export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"

Lark (global) domain

If your tenant is on Lark (international), set the domain to lark (or a full domain string). You can set it at channels.feishu.domain or per account (channels.feishu.accounts.<id>.domain).
{
  channels: {
    feishu: {
      domain: "lark",
      accounts: {
        main: {
          appId: "cli_xxx",
          appSecret: "xxx",
        },
      },
    },
  },
}

Step 3: Start + test

1. Start the gateway

openclaw gateway

2. Send a test message

In Feishu, find your bot and send a message.

3. Approve pairing

By default, the bot replies with a pairing code. Approve it:
openclaw pairing approve feishu <CODE>
After approval, you can chat normally.

Overview

  • Feishu bot channel: Feishu bot managed by the gateway
  • Deterministic routing: replies always return to Feishu
  • Session isolation: DMs share a main session; groups are isolated
  • WebSocket connection: long connection via Feishu SDK, no public URL needed

Access control

Direct messages

  • Default: dmPolicy: "pairing" (unknown users get a pairing code)
  • Approve pairing:
    openclaw pairing list feishu
    openclaw pairing approve feishu <CODE>
    
  • Allowlist mode: set channels.feishu.allowFrom with allowed Open IDs

Group chats

1. Group policy (channels.feishu.groupPolicy):
  • "open" = allow everyone in groups (default)
  • "allowlist" = only allow groupAllowFrom
  • "disabled" = disable group messages
2. Mention requirement (channels.feishu.groups.<chat_id>.requireMention):
  • true = require @mention (default)
  • false = respond without mentions

Group configuration examples

Allow all groups, require @mention (default)

{
  channels: {
    feishu: {
      groupPolicy: "open",
      // Default requireMention: true
    },
  },
}

Allow all groups, no @mention required

{
  channels: {
    feishu: {
      groups: {
        oc_xxx: { requireMention: false },
      },
    },
  },
}

Allow specific users in groups only

{
  channels: {
    feishu: {
      groupPolicy: "allowlist",
      groupAllowFrom: ["ou_xxx", "ou_yyy"],
    },
  },
}

Get group/user IDs

Group IDs (chat_id)

Group IDs look like oc_xxx. Method 1 (recommended)
  1. Start the gateway and @mention the bot in the group
  2. Run openclaw logs --follow and look for chat_id
Method 2 Use the Feishu API debugger to list group chats.

User IDs (open_id)

User IDs look like ou_xxx. Method 1 (recommended)
  1. Start the gateway and DM the bot
  2. Run openclaw logs --follow and look for open_id
Method 2 Check pairing requests for user Open IDs:
openclaw pairing list feishu

Common commands

CommandDescription
/statusShow bot status
/resetReset the session
/modelShow/switch model
Note: Feishu does not support native command menus yet, so commands must be sent as text.

Gateway management commands

CommandDescription
openclaw gateway statusShow gateway status
openclaw gateway installInstall/start gateway service
openclaw gateway stopStop gateway service
openclaw gateway restartRestart gateway service
openclaw logs --followTail gateway logs

Troubleshooting

Bot does not respond in group chats

  1. Ensure the bot is added to the group
  2. Ensure you @mention the bot (default behavior)
  3. Check groupPolicy is not set to "disabled"
  4. Check logs: openclaw logs --follow

Bot does not receive messages

  1. Ensure the app is published and approved
  2. Ensure event subscription includes im.message.receive_v1
  3. Ensure long connection is enabled
  4. Ensure app permissions are complete
  5. Ensure the gateway is running: openclaw gateway status
  6. Check logs: openclaw logs --follow

App Secret leak

  1. Reset the App Secret in Feishu Open Platform
  2. Update the App Secret in your config
  3. Restart the gateway

Message send failures

  1. Ensure the app has im:message:send_as_bot permission
  2. Ensure the app is published
  3. Check logs for detailed errors

Advanced configuration

Multiple accounts

{
  channels: {
    feishu: {
      accounts: {
        main: {
          appId: "cli_xxx",
          appSecret: "xxx",
          botName: "Primary bot",
        },
        backup: {
          appId: "cli_yyy",
          appSecret: "yyy",
          botName: "Backup bot",
          enabled: false,
        },
      },
    },
  },
}

Message limits

  • textChunkLimit: outbound text chunk size (default: 2000 chars)
  • mediaMaxMb: media upload/download limit (default: 30MB)

Streaming

Feishu does not support message editing, so block streaming is enabled by default (blockStreaming: true). The bot waits for the full reply before sending.

Configuration reference

Full configuration: Gateway configuration Key options:
SettingDescriptionDefault
channels.feishu.enabledEnable/disable channeltrue
channels.feishu.domainAPI domain (feishu or lark)feishu
channels.feishu.accounts.<id>.appIdApp ID-
channels.feishu.accounts.<id>.appSecretApp Secret-
channels.feishu.accounts.<id>.domainPer-account API domain overridefeishu
channels.feishu.dmPolicyDM policypairing
channels.feishu.allowFromDM allowlist (open_id list)-
channels.feishu.groupPolicyGroup policyopen
channels.feishu.groupAllowFromGroup allowlist-
channels.feishu.groups.<chat_id>.requireMentionRequire @mentiontrue
channels.feishu.groups.<chat_id>.enabledEnable grouptrue
channels.feishu.textChunkLimitMessage chunk size2000
channels.feishu.mediaMaxMbMedia size limit30
channels.feishu.blockStreamingDisable streamingtrue

dmPolicy reference

ValueBehavior
"pairing"Default. Unknown users get a pairing code; must be approved
"allowlist"Only users in allowFrom can chat
"open"Allow all users (requires "*" in allowFrom)
"disabled"Disable DMs

Supported message types

Receive

  • ✅ Text
  • ✅ Images
  • ✅ Files
  • ✅ Audio
  • ✅ Video
  • ✅ Stickers

Send

  • ✅ Text
  • ✅ Images
  • ✅ Files
  • ✅ Audio
  • ⚠️ Rich text (partial support)