Azure Functions – Create Generic Webhook Trigger

Please go through the following article to understand about Azure Functions.


Webhooks are “user-defined HTTP callbacks”. They are usually triggered by some event, such as pushing code to a repository or a comment being posted to a blog. When that event occurs, the source site makes an HTTP request to the URI configured for the Webhook.


Below are few of the real-world cases where you might have to develop Webhooks.

  • In a Blog site, you would like to send an e-mail to the end user as soon as a comment is posted. You might call a Webhook that is responsible for sending an e-mail.
  • In an e-commerce site, you might want to invoke a third-party payment gateway to process the credit card for the payment. The third-party gateway provider might provide you a Webhook to which you might pass Amount and other related details for processing.

In this article, we will learn how to create an Azure Generic Web Hook function using C# language.

Please login to your Azure Subscription and navigate to your Azure Function App and then as shown in the below screen capture, click on New Function and choose the GenericWebHook-CSharp template.


For this example, I have given “OnRequestRecieved” as the name of the Function and clicked on Create button which would take you to the Develop tab as shown below.


If you are .NET developer, you will understand that the above function Run accepts the input parameters first and last from the request object and sends a response Hello <<first>> <<last>> greeting as response if the request object has first and last parameters. Otherwise, it throws an error.

We will test the Function named Run using Postman App. You can download the app at

To test the Azure Function, you need to grab the url of the Azure function by clicking on Get function URL link which is shown below.


Clicking on the Get function URL will open the URL in a small popup as shown below.


Below is the structure of the Azure Function.


You can copy the complete url by clicking on the icon highlighted in the above screen capture.

Let’s open the Postman and test our Function as shown below.


Points to note:

  1. Choose Post method.
  2. Paste the URL of the Function App
  3. Select Raw
  4. Choose JSON
  5. Provide the input in the JSON format with the fields first and last
  6. Click on Send button
  7. Review the response.

That’s it. We have created an Azure Generic Webhook Trigger and validated using Postman. However, in real-time, you might provide your Webhook URL to some third-party applications (or one of your applications that can invoke the Webhook triggers) that would automatically invoke your Webhook based on some events.


In this article, we have learnt the following.

  • What is a Webhook
  • Few Real-world cases of using Webhook
  • How to create a Webhook trigger using Function Apps
  • Structure of the Webhook trigger URL
  • How to test the Webhook trigger using postman.

Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s