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.
1.5 KiB
1.5 KiB
LINGYUN.Abp.Webhooks
Base webhook module that provides basic webhook definitions and functionality.
Features
- Basic webhook definitions
- Webhook publishing and subscription
- Webhook event data handling
- Webhook configuration management
Module Dependencies
[DependsOn(typeof(AbpWebhooksModule))]
public class YouProjectModule : AbpModule
{
// other
}
Basic Usage
- Define a Webhook
public class YourWebhookDefinitionProvider : WebhookDefinitionProvider
{
public override void Define(IWebhookDefinitionContext context)
{
context.Add(
new WebhookDefinition(
name: "YourWebhook",
displayName: L("DisplayName:YourWebhook"),
description: L("Description:YourWebhook")
)
);
}
}
- Publish a Webhook
public class YourService
{
private readonly IWebhookPublisher _webhookPublisher;
public YourService(IWebhookPublisher webhookPublisher)
{
_webhookPublisher = webhookPublisher;
}
public async Task PublishWebhook()
{
await _webhookPublisher.PublishAsync(
webhookName: "YourWebhook",
data: new { /* webhook data */ }
);
}
}
- Handle Webhook Events
public class YourWebhookHandler : IWebhookHandler, ITransientDependency
{
public async Task HandleWebhookAsync(WebhookPayload webhook)
{
// Handle webhook event
}
}