Contentstack allows you to create webhooks that send real-time data to any third-party application or service when a set event occurs.
To create a webhook, log in to your Contentstack account, and perform the following steps:
- Go to your stack, navigate to the “Settings” gear icon, and select Webhooks.
- Click on either the + New Webhook button located at the top-right corner of the page or the Let’s go make one! link (if you haven’t created any webhooks yet).
- In the Create Webhook page, provide the following webhook details:
- Name (mandatory): Provide a suitable name for your webhook.
- URL to notify (mandatory): Specify the URL or web address where the data will be sent once the webhook is triggered. The URL will receive an HTTP POST request when the selected event happens.
- HTTP basic auth username (optional): Provide the username of the HTTP basic auth if you intend to use Basic Authentication to secure your webhook.
- HTTP basic auth password (optional): Provide the password of the HTTP basic auth.
- Custom headers (optional): This field lets you add any additional header into the HTTP POST request. You can add multiple headers by clicking the + icon.
- When (mandatory): Set the conditions for the webhook to trigger. Here you need to define the event when the webhook will be triggered. For ease of use, we have two views under it: Conditional View and Code View.
- Click on the Save button.
Note: A webhook will not trigger on local environments such as localhost.
Let's create a webhook that will be triggered whenever any changes are made to any content type in a stack.
To perform this create action via APIs, refer to the Create a webhook API request.