WebhookAPI 1.0.7

dotnet add package WebhookAPI --version 1.0.7                
NuGet\Install-Package WebhookAPI -Version 1.0.7                
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="WebhookAPI" Version="1.0.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WebhookAPI --version 1.0.7                
#r "nuget: WebhookAPI, 1.0.7"                
#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 WebhookAPI as a Cake Addin
#addin nuget:?package=WebhookAPI&version=1.0.7

// Install WebhookAPI as a Cake Tool
#tool nuget:?package=WebhookAPI&version=1.0.7                

Webhook API

Description

This nuget-package is for simply sending webhooks from a C#-Application to your server via HTTP-POST.

Usage

using WebhookAPI;

public class Info
{
    private Webhook webhook;

    public Info()
    {
        // Initialization must be done only once per App)
        webhook = new Webhook("URL", "APP_NAME");

       // or you can directly pass the UserAgent
       webhook = new Webhook("URL", "APP_NAME", "USER AGENT");

       // or you can also use the retry param:
       // (The retry param will resend every failed request after 5 minutes, but after 10 tries it will give up and discard the request)
       webhook = new Webhook("URL", "APP_NAME", true);
    }

    public async Task YourMethodAsync()
    {
         // If the user agent is passed via constructor it will be used when no user agent is passed here, otherwise you can override
         // it here if you want
         await webhook.PostWebHookAsync(Webhook.LogLevel.Info, 
                                        "YOUR_MESSAGE", 
                                        "SCOPE", 
                                        "USER_AGENT (string?)");
    }
}

Dependency Injection


// Add service (options are required!)
builder.Services.AddWebHookService(new WebhookOptions() { Url = "YOUR_URL_", Application = "YOUR_APP_", UserAgent = "USER_AGENT (optional)", Retry = false });

// Inject service
public class YourService : IYourService
{
    private readonly WebhookAPI.Webhook _webhookService;

    public YourService(WebhookAPI.Webhook webhookService)
    {
        _webhookService = webhookService;
    }
}

Additional Notes

You can also use the event OnWebHookSending to interrupt webhooks or log webhook activities!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.7 43 11/24/2024
1.0.6 159 5/18/2024
1.0.5 285 12/28/2023
1.0.4 259 8/20/2023
1.0.3 164 8/17/2023
1.0.2 1,291 3/16/2023
1.0.1 299 12/10/2022

Added Dependency Injection Feature