EasyAbp.NotificationService.Provider.Dingtalk.Abstractions 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package EasyAbp.NotificationService.Provider.Dingtalk.Abstractions --version 1.0.0
NuGet\Install-Package EasyAbp.NotificationService.Provider.Dingtalk.Abstractions -Version 1.0.0
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="EasyAbp.NotificationService.Provider.Dingtalk.Abstractions" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyAbp.NotificationService.Provider.Dingtalk.Abstractions --version 1.0.0
#r "nuget: EasyAbp.NotificationService.Provider.Dingtalk.Abstractions, 1.0.0"
#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.
// Install EasyAbp.NotificationService.Provider.Dingtalk.Abstractions as a Cake Addin
#addin nuget:?package=EasyAbp.NotificationService.Provider.Dingtalk.Abstractions&version=1.0.0

// Install EasyAbp.NotificationService.Provider.Dingtalk.Abstractions as a Cake Tool
#tool nuget:?package=EasyAbp.NotificationService.Provider.Dingtalk.Abstractions&version=1.0.0

EasyAbp.NotificationService.Dingtalk

基于EasyAbp.NotificationService的钉钉机器人消息通知

使用方式:

  • 安装EasyAbp

  • 安装EasyAbp.NotificationService.Provider.Dingtalk

dotnet add package EasyAbp.NotificationService.Provider.Dingtalk --version 1.0.0
  • 添加moduel依赖
[DependsOn(
    typeof(NotificationServiceProviderDingtalkModule)
)]
  • 配置钉钉,appsettings.json中添加:
   "Dingtalk": {       
        "AppKey": "你的appkey",
        "AppSecret": "你的appsecret",
        "RedirectUri": "忽略",
        "WebHookAesKey": "忽略",
        "WebHookToken": "忽略",
      	"RobotCode": "你的钉钉机器人RobotCode"
    }
  • 实现IDingtalkUserIdProvider
[Dependency(ReplaceServices = true, TryRegister = true)]
public class DingtalkUserIdProvider : IDingtalkUserIdProvider , ITransientDependency
{
    

    public DingtalkUserIdProvider(r)
    {
        
    }

    public async Task<string> GetOrNullAsync(string appId, Guid userId)
    {
        //实现业务系统用户和钉钉用户的转换
    }

    public async Task<string> GetOrNullAsync(Guid userId)
    {
       // 实现业务系统用户和钉钉用户的转换
    }
}
  • 发送消息, 注入DingtalkRobotInteractiveCardNotificationFactory
var eto = await _dingtalkRobotInteractiveCardNotificationFactory.CreateAsync(new DingtalkRobotInteractiveCardDataModel()
                {
                    CardBizId = "你的消息id",
                    CardData = new
                    {
                        config = new
                        {
                            autoLayout = true,
                            enableForward = true,
                        },
                        header = new
                        {
                            title = new
                            {
                                type = "text",
                                text = $"消息标题"
                            },
                            logo = "@lALPDfJ6V_FPDmvNAfTNAfQ"
                        },
                        contents = new List<object>()
                        {
                            new
                            {
                                type = "section",
                                fields = new
                                {
                                    list = new List<object>
                                    {
                                        new
                                        {
                                            type = "text",
                                            text = $"消息正文段落1",
                                        },
                                        new
                                        {
                                            type = "text",
                                            text = $"消息正文段落2",
                                        },
                                        new
                                        {
                                            type = "text",
                                            text = $"消息正文段落3",
                                        },
                                        new
                                        {

                                            type = "text",
                                            text = $"消息正文段落4",
                                        }
                                    }
                                }
                            }
                        }
                    }
                }, userIds);
                await _localEventBus.PublishAsync(eto);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on EasyAbp.NotificationService.Provider.Dingtalk.Abstractions:

Package Downloads
EasyAbp.NotificationService.Provider.Dingtalk

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 108 3/18/2024
1.0.1 140 8/25/2023
1.0.0 131 8/25/2023