基于飞书开放平台视频会议(vc)API 实现,采用 AppId + AppSecret 换取 tenant_access_token 鉴权,内置令牌缓存与自动刷新。
包信息
- NuGet 包:
Bitzsoft.Integrations.VideoConference.Feishu - 接口:
IVideoConferenceService - 鉴权:AppId + AppSecret 换 tenant_access_token(Bearer 头注入)
- Provider ID:
feishu
配置
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
AppId | string | 是 | — | 应用 ID(AppId) |
AppSecret | string | 是 | — | 应用密钥(AppSecret) |
DefaultOwnerId | string? | 否 | — | 默认会议主持人(飞书 VC 创建会议 owner_id 必填) |
BaseUrl | string | 否 | https://open.feishu.cn | 飞书开放平台 API 基地址 |
HttpClientName | string | 否 | VideoConferenceFeishu | 业务 HttpClient 命名 |
TokenHttpClientName | string | 否 | VideoConferenceFeishuToken | 令牌刷新专用 HttpClient 命名 |
{ "VideoConference": { "Feishu": { "AppId": "your-app-id", "AppSecret": "your-app-secret", "DefaultOwnerId": "ou_your-owner-id" } }}注册
// 方式一:IConfiguration(默认读取 "VideoConference:Feishu" 配置节)services.AddFeishuVideoConference(configuration);
// 方式二:委托配置services.AddFeishuVideoConference(options =>{ options.AppId = "your-app-id"; options.AppSecret = "your-app-secret"; options.DefaultOwnerId = "ou_your-owner-id";});使用示例
var meeting = await service.CreateMeetingAsync(new CreateMeetingRequest{ Subject = "产品设计评审", StartTime = DateTimeOffset.Parse("2026-08-04T10:00:00+08:00"), EndTime = DateTimeOffset.Parse("2026-08-04T11:30:00+08:00"),});
// 邀请参会人await service.InviteAttendeesAsync(new InviteAttendeesRequest{ MeetingId = meeting.MeetingId, Attendees = [new() { Email = "colleague@example.com" }]});
// 查询录制var recordings = await service.ListRecordingsAsync(meeting.MeetingId);鉴权机制
- 令牌获取:POST
/open-apis/auth/v3/tenant_access_token/internal,JSON body 含 AppId 和 AppSecret。 - 令牌缓存:
FeishuVideoConferenceTokenManager为 Singleton,过期前 5 分钟刷新。 - 业务请求:按请求注入
Authorization: Bearer {tenant_access_token}头。 - 失效码
99991661/99991663/99991664触发自愈。
已知限制
飞书 VC 创建会议要求 owner_id 必填,请求未显式指定时回退到 DefaultOwnerId。本项目自包含令牌管理,不依赖 TeamWork.Feishu。