You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.3 KiB
2.3 KiB
LINGYUN.Abp.Notifications.WeChat.MiniProgram
WeChat Mini Program notification publishing module, providing functionality to send subscription messages to users through WeChat Mini Program.
Features
- WeChat Mini Program subscription message sending
- Support for custom message templates
- Support for multi-language messages
- Support for different environments (development, trial, release)
- Integration with ABP notification system
Module Reference
[DependsOn(typeof(AbpNotificationsWeChatMiniProgramModule))]
public class YouProjectModule : AbpModule
{
// other
}
Configuration
Note: This configuration will be removed in the next major WeChat-related version and merged into LINGYUN.Abp.WeChat.MiniProgram.AbpWeChatMiniProgramOptions
{
"Notifications": {
"WeChat": {
"MiniProgram": {
"DefaultMsgPrefix": "", // Default message prefix
"DefaultTemplateId": "", // Default Mini Program template ID
"DefaultState": "developer", // Default Mini Program type: developer/trial/formal
"DefaultLanguage": "zh_CN" // Default Mini Program language
}
}
}
}
Usage
Sending Notifications
public class YourService
{
private readonly INotificationPublisher _notificationPublisher;
public YourService(INotificationPublisher notificationPublisher)
{
_notificationPublisher = notificationPublisher;
}
public async Task SendNotificationAsync()
{
await _notificationPublisher.PublishAsync(
"WeChatMiniProgram.Notification", // Notification name
new NotificationData(), // Notification data
userIds: new[] { "userId" }, // Recipient user IDs
tenantIds: new[] { "tenantId" } // Tenant IDs
);
}
}
Custom Notification Handling
public class YourNotificationHandler :
INotificationHandler<WeChatMiniProgramNotification>
{
public async Task HandleNotificationAsync(
WeChatMiniProgramNotification notification)
{
// Handle notification
}
}