Skip to content
Bitzsoft.Integrationsbitzsoft.integrations

Reference

钉钉 VideoConference

钉钉视频会议服务——AppKey + AppSecret 换 access_token,query 参数注入。

Last updated

基于钉钉开放平台视频会议 API 实现,采用 AppKey + AppSecret 换取 access_token,以 query 参数注入鉴权。内置令牌缓存与自动刷新。

包信息

  • NuGet 包:Bitzsoft.Integrations.VideoConference.DingTalk
  • 接口:IVideoConferenceService
  • 鉴权:AppKey + AppSecret 换 access_token(query 参数 ?access_token= 注入)
  • Provider ID:dingtalk

配置

字段类型必填默认值说明
AppKeystring应用 Key(AppKey)
AppSecretstring应用密钥(AppSecret)
DefaultOrganizerUserIdstring?默认会议组织者用户 ID(钉钉 organizerUserId)
BaseUrlstringhttps://oapi.dingtalk.com旧版 API 基地址(gettoken 等)
NewApiBaseUrlstringhttps://api.dingtalk.com新版 API 基地址(新版会议接口)
HttpClientNamestringVideoConferenceDingTalk业务 HttpClient 命名
TokenHttpClientNamestringVideoConferenceDingTalkToken令牌刷新专用 HttpClient 命名
{
"VideoConference": {
"DingTalk": {
"AppKey": "your-app-key",
"AppSecret": "your-app-secret",
"DefaultOrganizerUserId": "your-organizer-user-id"
}
}
}

注册

// 方式一:IConfiguration(默认读取 "VideoConference:DingTalk" 配置节)
services.AddDingTalkVideoConference(configuration);
// 方式二:委托配置
services.AddDingTalkVideoConference(options =>
{
options.AppKey = "your-app-key";
options.AppSecret = "your-app-secret";
options.DefaultOrganizerUserId = "your-organizer-user-id";
});

使用示例

var meeting = await service.CreateMeetingAsync(new CreateMeetingRequest
{
Subject = "每日站会",
StartTime = DateTimeOffset.Parse("2026-08-03T09:00:00+08:00"),
EndTime = DateTimeOffset.Parse("2026-08-03T09:15:00+08:00"),
});
// 移除参会人
await service.RemoveAttendeesAsync(new RemoveAttendeesRequest
{
MeetingId = meeting.MeetingId,
Attendees = [new() { UserId = "user-id-to-remove" }]
});
// 查询录制
var recordings = await service.ListRecordingsAsync(meeting.MeetingId);

鉴权机制

  • 令牌获取:GET /gettoken?appkey={AppKey}&appsecret={AppSecret}
  • 令牌缓存:DingTalkVideoConferenceTokenManager 为 Singleton,过期前 5 分钟刷新。
  • 业务请求:通过 UriBuilder 在请求 URL 上追加 access_token query 参数(已有 query 串时以 & 拼接)。
  • 失效码 40014/42001/48002 触发自愈。

已知限制

钉钉是本域唯一以 query 参数注入令牌的供应商。钉钉使用毫秒级 Unix 时间戳(与腾讯/飞书的秒级不同)。本项目自包含令牌管理,不依赖 TeamWork.DingTalk。

100%

滚轮或按钮缩放 · 放大后拖动画面 · 双击切换 100% / 200%