Base solution for your next web application
Open Closed

Initiating a Webhook event #9581


User avatar
0
tbentley created

I am running Angular, with .Net Core on version 9.0.1 of AspNetZero

I have read the Webhook documentation for AspNetZero and the AspBoilerplate but I cannot see how to initiate the webhook event. I have also read the http://volosoft.com/Blog/ASP.NET-CORE-3.1-Webhook-Implementation-Using-Pub-Sub where I also see what the standard WebhookPayload.cs that I need to build (I think)

I have a CreateOrder Api that when called (and successful), I want to initiate a webhook NewDelivery event to be initiated which is subscribe to by selected Delivery/Courier companies.

I have followed the instructions for creating the WebHook Publisher and the Subscription for the NewDeliveryOrderWebhook but what is the process to call the webhook from the API (or associated Manager).

Any help would really be appreciated.

Thanks... Terry

.


4 Answer(s)
  • User Avatar
    0
    musa.demir created

    Do you want to receive the published webhook event in the same application?

  • User Avatar
    0
    tbentley created

    No the webhook would be received by a third party application. I think I have figured out the calling of the Publish to initiate the webhook but the webhook is not being received at the destination uri of the subscriber. I have also not been able to see any of my webhooks on the client angular side; I created the subscription by adding a record to the database.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @tbentley

    WebHooks are published when specific events are triggered, see https://aspnetboilerplate.com/Pages/Documents/Webhook-System#publish-webhooks.

    You can also manually publish WebHooks using _webHookPublisher.PublishAsync method. But, in that case, you must see records under "Webhook Send Attempts" section of Webhook detail page.

    1. Could you try to crete a Webhook subscription using the UI ?
    2. Could you check the IIS logs or Network logs on the receiving computer to see if any records received related to Webhooks (using Wireshark) ?

    Thanks,

  • User Avatar
    0
    tbentley created

    Thanks. I was finally able to see the subscription using the UI and get the webhook to publish the data to a remote site. I used https://webhook.site which is a great site for testing webhooks. I am actually not sure what it was that finally caused the data to publish. It may have been the adding of the publish within a unit of work using clause -- _unitOfWorkManager.Current.SetTenantId