Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.92k stars 442 forks source link

C# - How to Register Webhook Handlers with Built-in Receivers #1220

Open solvingj opened 7 years ago

solvingj commented 7 years ago

Azure functions webhooks are built upon the "Webhook Receivers" of .NET Core: https://docs.microsoft.com/en-us/aspnet/webhooks/receiving/receivers

One of the key components of the receivers is the ability to register a chain of handlers to be automatically processed in an order of priority: https://docs.microsoft.com/en-us/aspnet/webhooks/receiving/handlers

This is "key" because the central challenge of webhooks is distinguishing between many possible types of webhooks and specifying different handling. "Webhooks Handlers" is tailored to solve this problem fairly elegantly, rather than writing lengthy JSON parsing code with complicated switching logic within the run.csx itself.

We already have a good way of getting shared assemblies with all our various github webhook handlers onto the function app server and loaded in our functions at runtime. We just need to know how we can subscribe our handlers to the appropriate "receiver" (ours case being for the github receiver) within an Azure function.

mathewc commented 7 years ago

Related to open issue https://github.com/Azure/azure-webjobs-sdk-script/issues/448, which is about enabling the rest of the receiver types we already have built in. @christopheranderson

You're asking for something beyond that - to be able to register your own custom receivers.