Add webhook configuration and support to Elsa Server

Integrated webhook sinks via appsettings.json for handling "Run Task" events. Enabled webhook functionality in the application pipeline and added the necessary project reference for Elsa.Webhooks. This enhances event-driven capabilities and improves extensibility.
This commit is contained in:
Sipke Schoorstra 2025-02-23 21:40:15 +01:00
parent 361b644a75
commit 33d291cfcc
No known key found for this signature in database
GPG key ID: 5C10502B28A4268F
3 changed files with 17 additions and 1 deletions

View file

@ -28,6 +28,7 @@
<ProjectReference Include="..\..\modules\Elsa.Sql.SqlServer\Elsa.Sql.SqlServer.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Sql\Elsa.Sql.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Tenants.AspNetCore\Elsa.Tenants.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Webhooks\Elsa.Webhooks.csproj" />
<ProjectReference Include="..\..\modules\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\common\Elsa.DropIns\Elsa.DropIns.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Alterations.MassTransit\Elsa.Alterations.MassTransit.csproj" />

View file

@ -665,7 +665,8 @@ services
tenantHttpRouting.WithTenantHeader("X-Tenant-ID");
});
}
elsa.UseWebhooks(webhooks => webhooks.ConfigureSinks += options => builder.Configuration.GetSection("Webhooks").Bind(options));
elsa.InstallDropIns(options => options.DropInRootDirectory = Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "DropIns"));
elsa.AddSwagger();
elsa.AddFastEndpointsAssembly<Program>();

View file

@ -327,5 +327,19 @@
}
}
]
},
"Webhooks": {
"Sinks": [
{
"Id": "1",
"Name": "Run Task",
"Filters": [
{
"EventType": "Elsa.RunTask"
}
],
"Url": "https://localhost:6001/webhooks/run-task"
}
]
}
}