Hermes Agent HelperHermes Agent Helper

Complete Feishu Setup Guide: Connect Hermes Agent to Feishu Bot

Hermes Agent Helperon a month ago

Overview

Feishu (Lark) is an enterprise collaboration platform. Hermes Agent supports conversational interactions with users through Feishu bots. This tutorial will guide you through the complete process from creating a Feishu app to configuring the Hermes Gateway.


We strongly recommend using the Hermes Agent Feishu Config Helper to configure your Feishu bot!

With the Feishu Config Helper, you only need to:

  1. Manually create a Feishu app (see "Step 1" below)
  2. Get your App ID and App Secret (see "Step 1" below)
  3. Run the Feishu Config Helper - it will automatically complete all Feishu-side configurations (permissions, event subscriptions, etc.)
  4. Configure the App ID and App Secret in the Hermes Service Manager

The Feishu Config Helper saves you 60+ minutes of manual configuration time by automatically handling tedious permission settings and event subscription setup.

If you prefer manual configuration, continue reading the full tutorial below.


Manual setup estimated time: 15-20 minutes

Required information:

  • App ID (unique application identifier)
  • App Secret (application secret key)
  • Feishu User ID (for access authorization)

Step 1: Create a Feishu Enterprise App

1.1 Access Developer Console

  1. Open Feishu Open Platform or Lark Developer
  2. Click "Developer Console" in the top right
  3. Log in with your Feishu/Lark account if not already logged in

1.2 Create Application

  1. On the "My Apps" page, click "Create Custom App"
  2. Fill in the application details:
    • App Name: Enter an identifiable name, e.g., "Hermes AI Assistant"
    • App Description: Brief description of the app's purpose
    • App Icon: Upload an app icon (optional)
  3. Click "Create"

1.3 Get Credentials

After creation, go to the app details page:

  1. Under "Credentials & Basic Info", find:
    • App ID: Format like cli_xxxxxxxxxxxxxxxx
    • App Secret: Click "Show" to reveal and copy

Save these two values securely - you'll need them for configuration.


Step 2: Configure App Permissions and Features

2.1 Add Bot Capability

  1. Go to "Features" → "Bot"
  2. Enable the "Enable Bot" toggle
  3. Fill in bot information:
    • Bot Name: The name users will see
    • Bot Description: Brief explanation of bot functionality

2.2 Configure Event Subscription

  1. Go to "Development Settings" → "Events & Callbacks"
  2. Under "Event Subscription", click "Add Event"
  3. Add the following events:
    • im.message.receive_v1 (receive messages)

2.3 Configure Request URL (Webhook)

On the "Event Subscription" page:

  1. Find the "Request URL" configuration
  2. Enter your Hermes Gateway callback URL:
    https://your-server-ip-or-domain:port/webhook/feishu
    
  3. Click "Save"

Note: When saving, Feishu will send a verification request to this URL. Make sure the Gateway is running.

2.4 Request Permissions

  1. Go to "Development Settings" → "Permissions & Scopes"
  2. Request the following permissions:
    • im:message (get and send messages in chats)
    • im:message:send_as_bot (send messages as the bot)
    • contact:user.id:readonly (get user IDs)

Step 3: Get Feishu User ID

The Feishu User ID (Open ID or User ID) is used to authorize which users can chat with the bot.

We provide a convenient Feishu Helper tool:

  1. Go to the Feishu Helper page
  2. Download and install the Feishu Helper
  3. Follow the on-page instructions to get your Feishu User ID

Method 2: Via API

  1. In the Feishu Open Platform's "API Explorer"
  2. Call the "Get User Info" endpoint
  3. Extract open_id or user_id from the response

Method 3: Check Message Logs

  1. Complete the configuration below and start the Gateway first
  2. Send a test message to the bot
  3. Check the Gateway logs for the sender's user ID

Step 4: Configure Hermes Gateway

If you're using our managed service:

  1. Go to the Hermes Service Manager page
  2. Log in to your server management interface
  3. In the "Config" tab, fill in:
    • gateway.feishu.app_id: Your App ID
    • gateway.feishu.app_secret: Your App Secret
    • gateway.feishu.allowed_users: Authorized user IDs (comma-separated)
  4. Click "Save Changes" to save and restart

Or use the "Feishu Setup" quick configuration tab for one-click setup.

Option 2: Via Interactive Wizard

Run in your server terminal:

hermes gateway setup

Follow the prompts:

  1. Select "Feishu / Lark"
  2. Enter App ID
  3. Enter App Secret
  4. Enter allowed user IDs (comma-separated)

Option 3: Manual Configuration

Edit the ~/.hermes/.env file and add:

FEISHU_APP_ID=cli_xxxxxxxxxxxxxxxx
FEISHU_APP_SECRET=your_app_secret
FEISHU_ALLOWED_USERS=ou_xxxxx,ou_yyyyy

Step 5: Publish the App

5.1 Create App Version

  1. On the app details page, click "Create Version"
  2. Fill in version number and update notes
  3. Save the version

5.2 Request Publication

  1. Click "Request Publication"
  2. Select publication scope (recommend "Admin only" for initial testing)
  3. Submit for review

5.3 After Approval

Once approved, authorized users can search for and add your bot in Feishu.


Step 6: Test and Verify

6.1 Start the Gateway

hermes gateway run

Or start as a system service:

hermes gateway install
hermes gateway start

6.2 Send Test Message

  1. Find your bot in Feishu
  2. Send a test message like "Hello"
  3. If configured correctly, the bot will reply with an AI-generated response

Troubleshooting

Q: Bot receives messages but doesn't reply

Possible causes:

  1. User ID not in FEISHU_ALLOWED_USERS
  2. Incorrect App Secret
  3. Gateway not running properly

Solutions:

  1. Check the user ID in Gateway logs
  2. Verify App Secret is correct
  3. Run hermes gateway status to check service status

Q: Event subscription verification fails

Possible causes:

  1. Gateway not running
  2. Callback URL not accessible
  3. Firewall blocking requests

Solutions:

  1. Ensure Gateway is running
  2. Check if server port is open
  3. Verify HTTPS certificate is valid (if using HTTPS)

Q: Permission request rejected

Possible cause: Enterprise admin restricted app permissions

Solution: Contact your Feishu enterprise admin to approve the permission request


For questions, please contact us for technical support.