This guide will help you set up a webhook integration to automatically receive new articles from Balzac to your application or website.
What is a Webhook?
A webhook is a way for an application to provide other applications with real-time information. It delivers data to other applications as events happen, meaning you get data immediately.
Setting Up Your Webhook Integration
To set up a webhook integration, you'll need:
A publicly accessible URL that can receive POST requests
The ability to handle and parse JSON data
(Optional) A bearer token if you want to secure your webhook endpoint
Request Format
Our system will send a POST
request to your specified webhook URL whenever a new article is published. The payload will be in JSON format.
Data Structure
Here's the data structure we send with each request:
{
"title": "Article Title",
"content": "Full HTML content of the article",
"slug": "article-slug",
"description": "Short description or excerpt",
"cover_image": "URL to the article's main image",
"published_at": "2023-07-10T15:30:45Z"
}
Authentication (Optional)
To secure your webhook endpoint, you can provide a bearer token when setting up the integration in our platform. If you provide a token, we will include it in all requests to your webhook URL.
How Authentication Works
When you specify a bearer token, we include it in the Authorization header of each request:
Authorization: Bearer your_token_here
Your server should validate this token before processing the request. If the token doesn't match what you expect, you should return a 401 Unauthorized response.
Response Handling
Your webhook endpoint should respond with a 200 OK HTTP status code.