aspnet / WebHooks

[Archived] Libraries to create and consume web hooks on ASP.NET Core. Project moved to https://github.com/aspnet/AspLabs
Apache License 2.0
627 stars 439 forks source link

Flesh out ASP.NET Core sender packages #183

Closed dougbu closed 5 years ago

dougbu commented 6 years ago

Follow-on work item for #5.

Hopefully less needs to change than on the receiver side i.e. the work may mainly be about building for .NET Standard and determining the minimum .NET Standard version required. See #47 as well.

davesmits commented 6 years ago

is there a eta for this? and are you taking PR's? i been working for this last few days; although i dont think its in a production state; been making much progress already for it

Moily commented 6 years ago

Getting a Microsoft.AspNetCore.WebHooks.Custom as an initial offering would be a great start. Are you close to having that ready, @davesmits? I can get to it in a few weeks, if not.

davesmits commented 6 years ago

working in here: https://github.com/davesmits/WebHooks ; maybe have a look and give some feedback which parts are useful so i will isolate these in a PR

Right now moving ILogger to the .net core default; currently have the whole setup working including a custom receiver. Had make some changes in the receiver packages for that as mentioned with bug #221; didnt fix it (yet) as not seeing the right solution directly

Havret commented 6 years ago

I have ported old ASP.NET Custom Sender to ASP.NET Core. It's fully interoperable with old receiver package. If you consider accepting PR please let me know. For now I am keeping this in private repo.

Havret commented 6 years ago

As I said here #301 I am working on sender package on my fork https://github.com/Havret/WebHooks

I have ported sender package from original WebHooks project to ASP.NET Core and made some changes in the notification model. We were using the 1:1 port for a while at work, but it turned out that the format of WebHook massages was hard to consume by our clients.

For those who are not familiar with the original project, Webhooks were sent in serialized form as follows:

{
  "Id": "d564f700284c431cb65a8f0e91fb7acb",
  "Attempt": 1,
  "Properties": {},
  "Notifications": [
    {
      "Action": "SomeNotification",
      "Comparer": {},
      "Count": 2,
      "Keys": [
        "FirstName",
        "LastName"
      ],
      "Values": [
        "Scott",
        "Hanselman"
      ]
    }
  ]
}

The two issues we have with this design are:

  1. The need to reintegrate payload from collections of Keys and Values for each notification.
  2. The fact that notification metadata are sent alongside with actual payload.

I have come with something a bit simpler. All the metadata is now moved to request header and body carries only a payload. The payload can be any "object" user like - no more NotificationDictionary.

For comparision the same message now may look like this:

Id: d564f700284c431cb65a8f0e91fb7acb
Attempt: 1
Notification: SomeNotification
{
  "FirstName" : "Scott",
  "LastName" : "Hanselman"
}

There are few drawbacks of this approach. The most significant one is that you cannot send more than one notification per request anymore. It's not a problem for us, because as I am aware, most WebHook implementation you can find in the wild does not support such a feature (e.i. GitHub Webhooks), but maybe I am wrong.

If you want to help, any contribution would be more than welcome. There is still some work to do.

aspnet-hello commented 5 years ago

This issue was moved to aspnet/AspLabs#48