Galosys.Foundation.Mud.Feishu
26.7.31.1
dotnet add package Galosys.Foundation.Mud.Feishu --version 26.7.31.1
NuGet\Install-Package Galosys.Foundation.Mud.Feishu -Version 26.7.31.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Galosys.Foundation.Mud.Feishu" Version="26.7.31.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Galosys.Foundation.Mud.Feishu" Version="26.7.31.1" />
<PackageReference Include="Galosys.Foundation.Mud.Feishu" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Galosys.Foundation.Mud.Feishu --version 26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Galosys.Foundation.Mud.Feishu, 26.7.31.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Galosys.Foundation.Mud.Feishu@26.7.31.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Galosys.Foundation.Mud.Feishu&version=26.7.31.1
#tool nuget:?package=Galosys.Foundation.Mud.Feishu&version=26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Galosys.Foundation.Mud.Feishu
飞书平台适配器,基于 Mud.Feishu 2.1.5 实现。寄生命名空间 Mud.Feishu。
1. 配置
appsettings.json:
{
"Feishu": {
"AppId": "your-feishu-app-id",
"AppSecret": "your-feishu-app-secret"
}
}
2. DI 注册
using Mud.Feishu;
services.AddMudFeishu();
3. 获取 Platform
var platform = serviceProvider.GetRequiredService<IImPlatform>();
// platform.Platform => "feishu"
4. 发送消息
var msgId = await platform.Notification.SendAsync(new ImMessage(
ImTargetType.User,
"ou_xxx", // 飞书 open_id
ImMessageType.Text,
"审批通知",
"您有一笔采购单待审批,请及时处理。",
null));
5. 发送交互卡片
var cardId = await platform.Notification.SendCardAsync("ou_xxx",
new ApprovalCardData(
"采购审批单",
15000m,
"张三",
"采购部门急用,请尽快审批",
new[] { new ImAction("通过", "approve", ActionType.Callback) }
));
6. 撤销消息
var success = await platform.Notification.RevokeAsync(msgId);
7. 发起审批
var instanceId = await platform.Approval.StartAsync(new ApprovalRequest(
BizKey: "PO-2024-001",
Title: "服务器采购审批",
Description: "申请采购 3 台 Dell 服务器,用于生产环境扩容",
Amount: 150000m,
InitiatorId: "ou_user001",
ApproverIds: new[] { "ou_approver001", "ou_approver002" },
FormFields: new[] { new ApprovalFormField("采购类型", "IT设备", true) }
));
8. 查询审批状态
var status = await platform.Approval.QueryStatusAsync(instanceId);
// status => ApprovalStatus.Pending / Approved / Rejected
9. 用户映射
// ERP userId → 飞书 userId
var feishuId = await platform.UserMapping.ToPlatformIdAsync("erp1001", "feishu");
// 飞书 userId → ERP userId
var erpId = await platform.UserMapping.ToErpIdAsync("ou_xxx", "feishu");
10. 回调处理
[HttpPost("callback/feishu")]
public async Task<IActionResult> FeishuCallback(
[FromServices] IImPlatform platform)
{
using var reader = new StreamReader(Request.Body);
var rawBody = await reader.ReadToEndAsync();
var headers = Request.Headers.ToDictionary(h => h.Key, h => h.Value.ToString());
await platform.Webhook.HandleAsync<object>("feishu", rawBody, headers);
return Ok("success");
}
11. 手机号支持
发送消息时 TargetId 传 11 位手机号,自动使用 receive_id_type="phone",飞书服务端直接解析:
await platform.Notification.SendAsync(new ImMessage(
ImTargetType.User,
"13800138000", // 自动识别为手机号
ImMessageType.Text,
"通知", "内容", null));
无需本地翻译或缓存。
12. 告警通道
// 通过 Alarmer 发送告警
// Alarmer 在 FeishuModule 中自动注册,通过 IAlarmerFactory 或 PluginRegistry 触发
配置类
[Options("Feishu")]
public class FeishuOptions
{
public string AppId { get; set; }
public string AppSecret { get; set; }
}
依赖
| 包 | 用途 |
|---|---|
Galosys.Foundation.Integration.Im.Abstractions |
接口定义 |
Galosys.Foundation.Notification |
PluginRegistry 通知通道 |
Mud.Feishu 2.1.5 |
飞书 Open API SDK |
Mud.Feishu.Abstractions |
飞书 SDK 抽象层 |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Galosys.Foundation.Core (>= 26.7.31.1)
- Galosys.Foundation.Integration.Im.Abstractions (>= 26.7.31.1)
- Galosys.Foundation.Notification (>= 26.7.31.1)
- Mud.Feishu (>= 2.1.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.7.31.1 | 0 | 7/31/2026 |
| 26.7.30.1 | 51 | 7/30/2026 |
| 26.7.29.1 | 77 | 7/29/2026 |
| 26.7.28.1 | 76 | 7/28/2026 |
| 26.7.26.2 | 87 | 7/26/2026 |
| 26.7.26.1 | 88 | 7/25/2026 |
| 26.7.25.1 | 89 | 7/25/2026 |
| 26.7.24.2 | 96 | 7/24/2026 |
| 26.7.24.1 | 88 | 7/24/2026 |
| 26.7.22.1 | 89 | 7/23/2026 |
| 26.7.21.1 | 95 | 7/22/2026 |
| 26.7.20.2 | 89 | 7/20/2026 |
| 26.7.20.1 | 94 | 7/20/2026 |
| 26.7.19.3 | 94 | 7/19/2026 |