Feishu
This document describes how to create a Feishu enterprise self-built app bot that sends one-on-one text messages or messages that @ the bot in group chats to Tencent Cloud EdgeOne Makers, where the Agent generates a result and returns it to the original conversation.
Prerequisites and Scope of Application
1. You already have a Feishu organization and account with the permission to create enterprise self-built apps. Test members belong to this organization.
2. It can complete the administrator review required for app publishing and set the app availability scope.
3. Makers has been activated.
4. This document uses a Feishu China enterprise self-built app to verify text messages mentioned in one-on-one chats and group chats. It does not cover Lark, multi-tenant store apps, or card interactions.
Creating an Application and Enabling the Bot
1. Log in to the Feishu Developer Console.
2. Click Create Enterprise Self-built App, enter the name and description, upload an icon, and complete the creation.
3. Go to the app details and add Bot in Add App Capability. See Enable Bot Capability.
4. Go to Credentials & Basic Info and copy the App ID and App Secret.
Requesting Permissions
1. In the app details, go to Permissions.
2. Search for the permission identifiers in the following table and apply for the required app identity permissions.
Permissions | Purpose | Configuration Requirements |
im:message.p2p_msg:readonly | Read one-to-one messages sent by users to the bot | Required for single chat |
im:message.group_at_msg:readonly | Receive messages in group chats where users @ the current bot | Required for group chat |
im:message:send_as_bot | Send replies as the application bot | Required |
Getting Event Encryption Configuration
1. Go to Development Configuration > Events & Callbacks > Encryption Policy.
2. Copy the Verification Token.
3. Configure and copy the Encrypt Key, and keep it consistent with the value in Makers.

Purpose of the parameters obtained above
Configuration | Purpose |
App ID / App Secret | Obtain Feishu app access credentials for sending replies. |
Verification Token | Verify event tokens |
Encrypt Key | Decrypt event bodies and participate in event signature verification. |
Deploying the Makers Template
1. Open the Makers Agent for IM template.
2. In the project environment variable settings, fill in the following variables (copy .env.example to .env).
Environment Variable | Required | Description |
FEISHU_APP_ID | Yes | App ID |
FEISHU_APP_SECRET | Yes | App Secret |
FEISHU_ENCRYPT_KEY | Yes | Encrypt Key |
FEISHU_VERIFICATION_TOKEN | Yes | Verification Token |
3. Save the configuration and deploy it.
4. Copy the production HTTPS domain name, and append /feishu to the end.
5. Make sure the service is deployed in a mainland China AZ so that Feishu services can access it correctly.
Configuring the Event Request URL
1. Return to the Feishu app details, and go to Development Configuration > Events & Callbacks > Event Configuration.
2. Select Send events to developer server as the subscription method, and enter the full request URL from the previous step.
3. Save the address and wait for the URL verification to succeed.
4. Click Add Event, and select the message event im.message.receive_v1. In the official documentation, this corresponds to Receive Message v2.0, but the event identifier prevails.
5. Save the event configuration, and confirm that the required receiving permission for the event has been applied for.

Publishing an Application and Adding a Bot
1. Go to App Publishing > Version Management and Release, create a version, and enter the version number and update notes.
2. Add test members or a test department to the app's available scope, and submit the release.
3. If your organization requires administrator review, wait for the review to be approved, and confirm that the version has been published.
4. Use an account within the available scope to search for the app bot in the Feishu client and open a one-on-one chat.
5. To test group chats, go to Group Bot in the target group's settings, and add the current app bot.
Sending a Message and Verifying It
1. In the one-on-one chat with the bot, send `Please introduce Tencent Cloud EdgeOne Makers in one sentence.`.
2. Wait for the Agent to finish, and confirm that the original one-on-one chat receives a new text reply.
3. In the test group, enter `@`, select the current bot from the candidate list, send the same question, and confirm that the group receives a new text reply.
4. In a one-on-one chat, send `Please shorten the previous answer to no more than ten words.` In group chats, you still need to @ the bot when sending follow-up questions.

