home / skills / openclaw / skills / feishu-calendar-tool

feishu-calendar-tool skill

/skills/sunnull/feishu-calendar-tool

This skill manages Feishu calendar events with zero-setup, auto-discovering credentials and calendar IDs to create, list, and delete events.

npx playbooks add skill openclaw/skills --skill feishu-calendar-tool

Review the files below or copy the command above to add this skill to your agents.

Files (29)
SKILL.md
4.1 KB
---
name: feishu-calendar-tool
description: 飞书日历管理工具 - 零配置,自动获取凭证和日历ID,支持创建、删除、查询日程
---

# 飞书日历管理工具 📅

简单高效的飞书日历事件管理工具 - **零配置启动!**

## ✨ 核心特性

- **零配置** - 自动从 `~/.openclaw/openclaw.json` 读取飞书凭证
- **自动发现** - 自动获取 user_id 和 calendar_id
- **智能缓存** - 凭证和配置缓存 24 小时
- **创建日程** - 支持创建飞书日程事件
- **删除日程** - 支持删除已创建的事件
- **查询日程** - 查看指定日期范围的日程

## 快速开始

### 零配置使用(推荐)⭐

**已配置飞书通道?无需任何配置,直接使用!**

```bash
# 创建日程
node bin/create-event.mjs \
  --title "团队会议" \
  --start "2026-02-10 14:00:00" \
  --end "2026-02-10 15:00:00"

# 查询日程
node bin/list-events.mjs

# 删除日程
node bin/delete-event.mjs --event-id "事件ID"
```

### 首次使用

如果你还没有配置飞书应用:

#### 1. 创建飞书应用

访问 [飞书开放平台](https://open.feishu.cn/app) 创建应用,获取:
- **App ID**
- **App Secret**

#### 2. 添加权限

在应用管理页添加以下权限:
- ✅ `calendar:calendar` - 读写日历
- ✅ `calendar:calendar:readonly` - 读取日历
- ✅ `contact:user.base:readonly` - 自动获取 user_id
- ✅ `contact:user.employee_id:readonly` - 读取员工目录

#### 3. 配置到 openclaw.json

编辑 `~/.openclaw/openclaw.json`:

```json
{
  "channels": {
    "feishu": {
      "accounts": {
        "default": {
          "appId": "你的AppID",
          "appSecret": "你的AppSecret",
          "enabled": true
        }
      }
    }
  }
}
```

**完成!现在可以零配置使用了。**

## 使用方法

### 创建日程

```bash
node bin/create-event.mjs \
  --title "周会议" \
  --start "2026-02-10 17:00:00" \
  --end "2026-02-10 18:00:00" \
  --description "每周例会" \
  --location "会议室A"
```

**参数说明:**
- `--title` - 日程标题(必需)
- `--start` - 开始时间,格式:YYYY-MM-DD HH:MM:SS(必需)
- `--end` - 结束时间,格式:YYYY-MM-DD HH:MM:SS(必需)
- `--description` - 日程描述(可选)
- `--location` - 地点(可选)
- `--attendees` - 参与人,逗号分隔(可选)
- `--timezone` - 时区,默认 Asia/Shanghai(可选)

### 查询日程

```bash
# 查看未来 7 天的日程
node bin/list-events.mjs

# 查看指定日期范围
node bin/list-events.mjs \
  --start "2026-02-10" \
  --end "2026-02-17"
```

### 删除日程

```bash
node bin/delete-event.mjs --event-id "事件ID"
```

## 配置方式

### 自动查找顺序

1. **环境变量** - 如果已设置
2. **~/.openclaw/openclaw.json** - 推荐 ⭐
3. **~/openclaw/.secrets.env**
4. **~/.secrets.env**

## 验证配置

```bash
# 测试凭证加载
node bin/test-credentials.mjs

# 查看可用的日历
node bin/get-user-info.mjs
```

成功输出:
```
✅ Credentials loaded successfully!
Source: /home/user/.openclaw/openclaw.json
App ID: cli_xxxxxxxxxxxxx
```

## 自动发现功能

- **user_id** - 通过飞书 API 自动获取当前用户 ID
- **calendar_id** - 自动选择主日历(primary calendar)
- **缓存** - 结果缓存 24 小时,减少 API 调用

## 技术实现

- 使用飞书 Calendar v4 API
- 自动处理 access token 获取和刷新
- 智能错误重试机制
- 支持 Asia/Shanghai 时区

## 常见问题

### Q: 我已经配置了飞书通道,还需要重新配置吗?
A: **不需要!** 技能会自动读取 `openclaw.json` 中的凭证,直接使用即可。

### Q: 支持多个飞书账户吗?
A: 支持!在 `openclaw.json` 中配置多个账户,技能会优先使用 `default` 账户。

### Q: 如何查看我的日历 ID?
A: 运行 `node bin/get-user-info.mjs` 查看所有可用的日历。

### Q: 技能会修改我的 openclaw.json 吗?
A: **不会!** 技能只读取配置,从不修改。

## 相关链接

- [飞书开放平台](https://open.feishu.cn/app)
- [飞书日历 API 文档](https://open.feishu.cn/document/server-docs/docs/calendar-v4/event/create)

## 作者

小李子

## 许可证

MIT

Overview

This skill provides a zero-configuration Feishu (Lark) calendar management tool that automatically loads credentials and calendar IDs. It supports creating, listing, and deleting calendar events with automatic token handling and 24-hour caching for discovered IDs and credentials. The tool is designed for quick CLI usage and minimal setup.

How this skill works

The skill reads Feishu credentials from common local locations (environment variables, ~/.openclaw/openclaw.json, or .secrets.env) and auto-discovers the user_id and primary calendar_id via Feishu APIs. It automatically fetches and refreshes access tokens, caches discovered values for 24 hours, and exposes simple CLI commands for create, list, and delete operations. Error retries and timezone handling (default Asia/Shanghai) are built in for robust operation.

When to use it

  • Quickly add or remove events in Feishu without manual API setup
  • Automate calendar tasks from scripts or CI jobs when credentials are already provisioned
  • Inspect events across a date range for scheduling or auditing
  • Manage calendar entries for multiple Feishu accounts configured under openclaw.json
  • Test Feishu calendar credentials and available calendars locally

Best practices

  • Store App ID and App Secret in ~/.openclaw/openclaw.json for zero-config operation
  • Use the default account in openclaw.json or set environment variables for explicit selection
  • Cache duration is 24 hours; clear cache if you change account permissions or calendars
  • Provide explicit start/end times in YYYY-MM-DD HH:MM:SS format and include timezone if outside Asia/Shanghai
  • Validate credentials with the test-credentials command before batch operations

Example use cases

  • Create a team meeting from a CI job: create-event CLI with title, start, end, and attendees
  • List the next 7 days of events for daily scheduling automation via list-events
  • Delete a mistaken event by passing its event-id to delete-event
  • Discover available calendars and user_id using get-user-info for integration setup
  • Run credential diagnostics using test-credentials prior to deploying automation

FAQ

Do I need to configure anything if I already have a Feishu channel in openclaw.json?

No. If credentials exist in ~/.openclaw/openclaw.json the skill will auto-load them and operate without additional configuration.

Can I manage multiple Feishu accounts?

Yes. Place multiple accounts under channels.feishu.accounts in openclaw.json; the skill will use the default account or the one you specify.

How do I see my calendar ID or user_id?

Run the get-user-info command; it lists discovered user_id and available calendars.