SuperAPI AI Directory

feishu-automation

General & other

View repository

Updated 10-16 06:50

About this skill

Feishu Automation Operations

Feature Description

This skill is specifically designed to automate various operations on the Feishu platform, including:

  • Creation and data management of Bitable
  • Sending messages to users or groups
  • Document and knowledge base management
  • Group creation and member management
  • Cloud document permission management
  • Workflow automation

Use Cases

  • "Add a record to Feishu Bitable"
  • "Create a Feishu group and invite members"
  • "Send a message to a Feishu group"
  • "Search Feishu document content"
  • "Automate Feishu approval processes"
  • "Batch import data into Feishu tables"

Core Feature Modules

1. Bitable

  • Create tables: Create new Bitable and data tables
  • Field management: Add and modify field types and properties
  • Record operations: Create, delete, update, and query record data
  • Data query: Query data using filter conditions
  • Batch operations: Batch import and export data

2. Message Management

  • Send messages: Text, rich text, cards, images, etc.
  • Group messages: Send notifications to groups
  • Direct messages: Send messages to individuals
  • Message history: Retrieve conversation history
  • Message templates: Use card templates

3. Document Management

  • Document search: Search cloud document content
  • Document creation: Create new documents
  • Permission management: Add collaborators and set permissions
  • Content extraction: Retrieve plain text content of documents

4. Group Management

  • Create groups: Create new group chats
  • Member management: Add or remove members
  • Group list: Retrieve groups a user belongs to
  • Group information: Query group details

5. Wiki

  • Search nodes: Search knowledge base content
  • Node information: Retrieve knowledge base node details
  • Content management: Manage knowledge base documents

Workflows

Data Synchronization Workflow

  1. Connect to Feishu: Configure API credentials
  2. Retrieve data: Retrieve data from external systems
  3. Data transformation: Convert to Feishu format
  4. Write to tables: Batch write to Bitable
  5. Send notifications: Notify relevant personnel

Message Push Workflow

  1. Trigger conditions: Listen for events or trigger on a schedule
  2. Construct message: Prepare message content and format
  3. Get recipient: Determine user or group ID
  4. Send message: Call message API
  5. Log: Save send record

Best practices

Authentication configuration

  • Use user_access_token for user identity operations
  • Use tenant_access_token for app identity operations
  • Safeguard App ID and App Secret
  • Refresh access_token regularly

Data operations

  • Pay attention to API rate limits during batch operations
  • Use pagination to query large amounts of data
  • Validate before writing data
  • Maintain data format consistency

Error handling

  • Implement a retry mechanism
  • Log detailed errors
  • Handle insufficient permissions
  • Validate user and group IDs

Common code examples

1. Create a Base and add data

// 创建多维表格
const app = await createBitable({
  name: "客户管理表",
  folder_token: "folder_id"
});

// 创建数据表
const table = await createTable({
  app_token: app.app_token,
  table: {
    name: "客户信息",
    fields: [
      { field_name: "客户名称", type: 1 },
      { field_name: "联系电话", type: 13 },
      { field_name: "创建时间", type: 5 }
    ]
  }
});

// 添加记录
await createRecord({
  app_token: app.app_token,
  table_id: table.table_id,
  fields: {
    "客户名称": "张三",
    "联系电话": "13800138000",
    "创建时间": Date.now()
  }
});

2. Send a group message

// 发送文本消息
await sendMessage({
  receive_id: "chat_id",
  msg_type: "text",
  content: JSON.stringify({
    text: "这是一条测试消息"
  })
});

// 发送卡片消息
await sendMessage({
  receive_id: "chat_id",
  msg_type: "interactive",
  content: JSON.stringify({
    elements: [
      {
        tag: "div",
        text: {
          content: "**重要通知**",
          tag: "lark_md"
        }
      }
    ]
  })
});

3. Search and query data

// 搜索多维表格记录
const records = await searchRecords({
  app_token: "app_token",
  table_id: "table_id",
  filter: {
    conjunction: "and",
    conditions: [
      {
        field_name: "状态",
        operator: "is",
        value: ["进行中"]
      }
    ]
  }
});

// 搜索文档
const docs = await searchDocs({
  search_key: "项目计划",
  count: 10
});

Integration scenarios

1. CRM data synchronization

  • Get customer data from the CRM system
  • Synchronize to Feishu Base
  • Automatically update customer status
  • Send change notifications

2. Approval process automation

  • Listen for approval events
  • Update related table data
  • Notify relevant personnel
  • Record approval history

3. Automatic report generation

  • Extract data from tables on a schedule
  • Generate statistical reports
  • Create Feishu documents
  • Share with team members

4. Task management

  • Create a task table
  • Assign tasks to members
  • Send task reminders
  • Track task progress

Notes

  • Comply with Feishu API call frequency limits
  • Correctly handle user ID types (open_id, union_id, user_id)
  • Ensure the app has sufficient permission scopes
  • Use a test environment during testing
  • Protect user privacy and data security