With Webhooks, you can send HTTP requests to a third-party application every time when an event or action occurs on your application. Simply put, when an event happens in your webpage, you can notify a third-party application automatically without continuously polling for data. 


Let’s say you have an e-commerce website and you have a billing application integrated with your application. So every time when a purchase happens, you can notify the billing system automatically using their webhook URL.


Webhooks:


Using Webhooks, you can automatically push data to your application through which you can have a simple one-to-one connection that runs automatically.


Whenever an event occurs in your web application, a POST event will be sent in a JSON format to the Webhook URL you’ve configured.


The URL will be called automatically every time when a specified action/event happens for the contacts. For example, whenever a new contact is added, you can configure the web application to push data to your app’s webhook URL automatically.


Using Webhooks in Marketing Journeys:


  1. Drag and drop the Webhooks block that’s under the Actions.

  2. Click on Choose or Create a Webhook. This brings up a popup providing the option to choose from the list of available webhooks or create a new one.

  3. Click Create New Webhook. This brings up the page where you can configure the webhooks.

  4. Configure your Webhook URL’s details:

    1. Webhook name: Provide a name for the Webhook

    2. URL: Input your webhook URL. If there are any required parameters on your URL, you can add them as a placeholder using the below option.

    3. Required Authentication: If your third-party application URL is protected and requires authentication, you can authenticate using two ways. Through Basic, you can pass a Username and Password and through Token, a token or API key can be passed to authenticate and help access the URL.

    4. Add Custom Header: If your Webhook URL requires any additional information with the content such as security information, etc. those can be added as custom headers by enabling this option.

    5. Add custom payload: Apart from default event trigger information, you can add your own custom contact/event properties in your payload as well. Those events will be sent as JSON data on the HTTP request body.

Sample Payload:
"Headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"Body": {
"event_type": "List",
"data": {
"contact": {
"first name": "test_contact_fname",
"mobile": "1234567890",
"email": "
testuser@freshmarketer.com"
},
"event_details": {
"list_id": "100",
"contact_id": "200"
},
"custom_data": {
"name": "test_contact_fname",
"salary": "123",
"age": "12"
}
},
"id": "7c076336-6072-4be3-a86f-b7255dbd0d63",
"event": "list.add_contact",
"event_category": "system",
"event_time": 1563186327795
}
}



    1. Test your Webhooks: You can test your Webhook URL with sample data. The response status received should be 200 and any other response other than that is considered as a failure. This helps you identify if your Webhook URL is valid or not.

  1. Click Create Webhook once the configuration is complete.


Sample Journey using Webhooks:


Here the Webhook URL will be called whenever the contacts from the list ‘Test’ clicks on the email campaign ‘Sample’ that has been sent.