feishu-integration
Original:🇨🇳 Chinese
Translated
14 scripts
Feishu (Lark) API Integration Guide. Use this when users request to "create Feishu apps", "manage base tables", "add collaborators", "generate Feishu reports", "set Feishu permissions" or "automate Feishu operations". Prioritize using MCP tools for real-time interactive operations.
3installs
Added on
NPX Install
npx skill4agent add within-7/minto-plugin-tools feishu-integrationTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Feishu Integration Skill
Comprehensive guide for Feishu (Lark) API integration and automation.
🚀 How It Works
This project provides two usage methods:
Option 1: MCP Tool (Recommended) ⚡
Real-time interaction, no need to manually run scripts
User Request → MCP Tool Call → Feishu API → Return ResultDirectly operate Feishu API via tools.
mcp__feishu__*Advantages:
- ✅ Real-time interactive operations
- ✅ No need to switch terminals
- ✅ Automatic authentication handling
- ✅ Supports chained operations
Option 2: Python Script 📜
Suitable for complex batch operations and automated workflows.
🔧 MCP Tool List
Authentication & Connection
| Tool | Function | Use Case |
|---|---|---|
| Obtain access token | Verify connection status |
Base Table Management
| Tool | Function | Parameters |
|---|---|---|
| Create base table | |
| Get data table list | |
| Add field | |
Data Operations
| Tool | Function | Parameters |
|---|---|---|
| Add record | |
| Get records | |
Permission Management
| Tool | Function | Parameters |
|---|---|---|
| Add collaborator | |
| Find user by email | |
Resources
| Resource URI | Function |
|---|---|
| Get current configuration information |
💡 Typical Use Scenarios
Scenario 1: Create Different Types of Base Tables
You are a base table creation expert, follow these steps to complete the task:
User Request Examples:
- "Create a customer management system"
- "Help me make a project task management table"
- "Build an inventory management table"
Assistant Execution Process:
1. Analyze user requirements and design a reasonable table structure
- Identify business type (CRM/project management/inventory/sales, etc.)
- Determine core entities and attributes
- Design field relationships and data flows
2. Call create_bitable to create the base table
3. Obtain the returned app_token
4. Call get_tables(app_token) to get table_id
5. Call add_table_field() to add fields: [Dynamically generated based on requirements]
- Main table: Core business fields
- Select field types (text/number/date/single-select/multi-select/people, etc.)
- Set required fields and default values
6. Set field types, options, and validation rules
- Single-select fields: Configure option lists
- Number fields: Set range limits
- Date fields: Configure time formats
- Associated fields: Establish inter-table relationships
7. Add sample data
8. Add users as collaborators
9. Create associated tables (if needed)
- Sub-table design (e.g., order details, task comments)
- Inter-table association configuration
- Data relationship descriptionExample: Create a Customer Management System
User: Create a customer management system
Assistant Execution:
1. Requirement Analysis
- Business Type: CRM Customer Management
- Core Entities: Customers, Follow-up Records
- Data Flow: Customer Information → Follow-up Interaction → Conversion
2. Call create_bitable(name="Customer Management System")
3. Obtain the returned app_token (e.g.: app_xxxxxxxxx)
4. Call get_tables(app_token) to get table_id (e.g.: tblxxxxxxxx)
5. Call add_table_field() to add fields:
- Customer Name (field_name="Customer Name", field_type=1) Text
- Contact Person (field_name="Contact Person", field_type=1) Text
- Contact Phone (field_name="Contact Phone", field_type=11) Phone
- Customer Source (field_name="Customer Source", field_type=3) Single-select
- Customer Stage (field_name="Customer Stage", field_type=3) Single-select
- Industry (field_name="Industry", field_type=3) Single-select
- Estimated Transaction Amount (field_name="Estimated Transaction Amount", field_type=2) Number
- Creation Time (field_name="Creation Time", field_type=5) Date
- Remarks (field_name="Remarks", field_type=1) Text
6. Set field configurations
- Customer Source Options: Online Promotion/Referral/Exhibition/Proactive Development
- Customer Stage Options: Potential Customer/Interested/Negotiating/Converted/Lost
- Industry Options: Internet/Finance/Manufacturing/Retail/Other
- Estimated Amount: Set minimum value to 0
7. Add sample data
Call add_record(app_token, table_id, {
"Customer Name": "Sample Tech Company",
"Contact Person": "Zhang San",
"Contact Phone": "13800138000",
"Customer Source": "Online Promotion",
"Customer Stage": "Interested",
"Industry": "Internet",
"Estimated Transaction Amount": 50000,
"Creation Time": 1704067200000,
"Remarks": "Potential high-quality customer"
})
8. Add user as collaborator
Call get_user_by_email(email="user@example.com") to get open_id
Call add_collaborator(app_token, "user", open_id, "edit")
9. Create associated table "Follow-up Records"
Repeat steps 4-5 to create follow-up record table, including:
- Follow-up Time (field_type=5)
- Follow-up Method (field_type=3, options: Phone/WeChat/Email/In-person)
- Follow-up Content (field_type=1)
- Next Follow-up Time (field_type=5)
- Customer Name (associated field linked to customer information table)
10. Return results
- Table link: https://feishu.cn/base/{app_token}
- Field description document
- Usage suggestionsExample: Create a Project Task Management Table
User: Create a project task management table
Assistant Execution:
1. Requirement Analysis
- Business Type: Project Management
- Core Entities: Projects, Tasks
- Data Flow: Project Decomposition → Task Assignment → Execution Tracking
2. Call create_bitable(name="Project Task Management System")
3. Obtain the returned app_token
4. Call get_tables(app_token) to get table_id
5. Call add_table_field() to add fields to the "Project List" table:
- Project Name (field_name="Project Name", field_type=1)
- Project Number (field_name="Project Number", field_type=1)
- Project Status (field_name="Project Status", field_type=3) Options: Not Started/In Progress/Completed/Delayed
- Start Date (field_name="Start Date", field_type=5)
- End Date (field_name="End Date", field_type=5)
- Project Priority (field_name="Project Priority", field_type=3) Options: High/Medium/Low
- Project Progress (field_name="Project Progress", field_type=15) 0-100%
- Project Manager (field_name="Project Manager", field_type=1)
6. Add sample data
Call add_record() to add 2-3 sample projects
7. Add user as collaborator
8. Create associated "Task List" table
- Task Name (field_type=1)
- Belongs to Project (associated field → Project List)
- Task Owner (field_type=1)
- Task Status (field_type=3) Options: To Do/In Progress/Completed/Canceled
- Task Priority (field_type=3) Options: Urgent/High/Medium/Low
- Start Time (field_type=5)
- Deadline (field_type=5)
- Estimated Hours (field_type=2)
- Actual Hours (field_type=2)
- Task Description (field_type=1)
9. Return dual-table structure description, association diagram, and usage suggestionsExample: Create a Purchase Order Management System
User: Create a purchase order management system
Assistant Execution:
1. Requirement Analysis
- Business Type: Procurement Management
- Core Entities: Purchase Orders
- Data Flow: Order Creation → Approval → Execution
2. Call create_bitable(name="Purchase Order Management System")
3. Obtain the returned app_token
4. Call get_tables(app_token) to get table_id
5. Call add_table_field() to add fields:
- Purchase Order (field_name="Purchase Order", field_type=1)
- Unit Price (field_name="Unit Price", field_type=2)
- Quantity (field_name="Quantity", field_type=2)
- Total Amount (field_name="Total Amount", field_type=2)
- Purchase Time (field_name="Purchase Time", field_type=5)
- Purchaser (field_name="Purchaser", field_type=1)
6. Add sample data
7. Add user as collaborator
8. Return table link and usage instructionsScenario 2: Batch Import Data
User: Add 10 purchase records to table xyz
Assistant:
1. Call get_tables(app_token) to confirm table_id
2. Loop call add_record() to add data
3. Return addition resultsScenario 3: Permission Management
User: Add user@example.com as table administrator
Assistant:
1. Call get_user_by_email(email="user@example.com") to get open_id
2. Call add_collaborator(
app_token="...",
member_type="user",
member_id="<open_id>",
perm_type="full_access"
)🤖 Intelligent Table Type Recognition
Supports recognition of the following business types:
| Business Type | Keywords | Preset Fields |
|---|---|---|
| Customer Management | CRM, customer, sales, customer management | Customer Name, Contact Person, Stage, Amount |
| Project Management | project, task, project task | Project Name, Status, Owner, Progress |
| Procurement Management | procurement, order, supplier | Order Number, Unit Price, Quantity, Amount |
| Inventory Management | inventory, warehouse, commodity | Commodity Name, SKU, Stock Quantity, Location |
| HR Management | employee, attendance, recruitment | Name, Department, Position, Status |
| Expense Management | reimbursement, expense, approval | Reimburser, Amount, Type, Date |
📋 Field Type Description
| Type Value | Type Name | Description |
|---|---|---|
| 1 | text | Text |
| 2 | number | Number |
| 3 | select | Single-select |
| 4 | multiSelect | Multi-select |
| 5 | dateTime | Date & Time |
| 7 | attachment | Attachment |
| 11 | phone | Phone |
| 12 | ||
| 13 | url | URL |
| 15 | progress | Progress |
🔐 Permission Type Description
- - View only
view - - Edit permission
edit - - Full management permission
full_access
📁 Project Structure
feishu-integration/
├── plugin.json # Plugin manifest
├── SKILL.md # This document
├── mcp-server/ # MCP Server
│ ├── index.py # FastMCP implementation
│ ├── requirements.txt # Python dependencies
│ └── README.md # MCP documentation
├── scripts/ # Python scripts (backup)
│ ├── create_feishu_app.py
│ ├── create_purchase_order_bitable.py
│ ├── add_feishu_collaborator.py
│ └── ...
└── .mcp.json # MCP configuration🛠️ Configuration Instructions
MCP Server Configuration
Ensure contains:
~/.minto/config/mcp.jsonjson
{
"mcpServers": {
"feishu": {
"command": "python3.11",
"args": ["/path/to/mcp-server/index.py"],
"env": {
"FEISHU_APP_ID": "your_app_id",
"FEISHU_APP_SECRET": "your_app_secret"
}
}
}
}Environment Variables
- : Feishu app ID
FEISHU_APP_ID - : Feishu app secret
FEISHU_APP_SECRET
How to obtain:
- Visit https://open.feishu.cn
- Create a new app or select an existing one
- Obtain from the "Credentials & Basic Information" page
🔍 Troubleshooting
MCP Tool Unavailable
-
Check if MCP server is running:bash
minto mcp list -
Check if environment variables are configured:bash
minto mcp get feishu -
View MCP configuration file:bash
cat ~/.minto/config/mcp.json
API Returns 404
- Ensure relevant permissions are enabled on Feishu Open Platform
- Republish the app and wait for permissions to take effect (approx. 10 minutes)
Failed to Add Collaborator
The app requires the following permissions:
permission:permission.member.create- Or permission package: "Share Cloud Docs"
📚 Python Script Usage (Backup)
If you need to use script mode:
bash
cd scripts
python3 create_feishu_app.py
python3 add_feishu_collaborator.pyDependency installation:
bash
pip install requests lark-oapi✅ Best Practices
- Prioritize MCP tools for interactive operations
- Use scripts for batch operations to improve efficiency
- Add yourself as a collaborator immediately after creating tables
- Verify permissions: Test connectivity with first
get_tenant_access_token - Save app_token: Save the created table token for subsequent operations
🔗 Reference Documents
💻 Developers
- GitHub: https://github.com/Within-7/minto-plugin-tools
- MCP Server: FastMCP 2.12.2
- Python: 3.11+