mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
---
|
|
title: Feishu (Lark)
|
|
description: Integrate CowAgent into Feishu application
|
|
---
|
|
|
|
Integrate CowAgent into Feishu by creating a custom app. Supports WebSocket (recommended, no public IP required) and Webhook event receiving modes.
|
|
|
|
## 1. Create Enterprise Custom App
|
|
|
|
### 1.1 Create App
|
|
|
|
Go to [Feishu Developer Platform](https://open.feishu.cn/app/), click **Create Enterprise Custom App**, fill in the required information and create.
|
|
|
|
### 1.2 Add Bot Capability
|
|
|
|
In **Add App Capabilities**, add **Bot** capability to the app.
|
|
|
|
### 1.3 Configure App Permissions
|
|
|
|
Click **Permission Management**, paste the following permission string, select all and enable in batch:
|
|
|
|
```
|
|
im:message,im:message.group_at_msg,im:message.group_at_msg:readonly,im:message.p2p_msg,im:message.p2p_msg:readonly,im:message:send_as_bot,im:resource
|
|
```
|
|
|
|
## 2. Project Configuration
|
|
|
|
Get `App ID` and `App Secret` from **Credentials & Basic Info**, then fill in `config.json`:
|
|
|
|
<Tabs>
|
|
<Tab title="WebSocket Mode (Recommended)">
|
|
No public IP required. Configuration:
|
|
|
|
```json
|
|
{
|
|
"channel_type": "feishu",
|
|
"feishu_app_id": "YOUR_APP_ID",
|
|
"feishu_app_secret": "YOUR_APP_SECRET",
|
|
"feishu_event_mode": "websocket"
|
|
}
|
|
```
|
|
|
|
Install dependency: `pip3 install lark-oapi`
|
|
</Tab>
|
|
<Tab title="Webhook Mode">
|
|
Requires public IP. Configuration:
|
|
|
|
```json
|
|
{
|
|
"channel_type": "feishu",
|
|
"feishu_app_id": "YOUR_APP_ID",
|
|
"feishu_app_secret": "YOUR_APP_SECRET",
|
|
"feishu_token": "VERIFICATION_TOKEN",
|
|
"feishu_event_mode": "webhook",
|
|
"feishu_port": 9891
|
|
}
|
|
```
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
## 3. Configure Event Subscription
|
|
|
|
1. After starting the project, go to Feishu Developer Platform **Events & Callbacks**, select **Long Connection** and save
|
|
2. Click **Add Event**, search for "Receive Message", select "Receive Message v2.0", confirm and add
|
|
3. Click **Version Management & Release**, create a version and apply for production release. After approval, you can use it
|
|
|
|
Search for the bot name in Feishu to start chatting.
|