Webhooks & Events
Webhooks allow WP AutoFlow to communicate with external systems in real-time. Whenever a post is successfully published to your WordPress site, the system sends a POST request to a URL of your choice.
This is useful for:
- Social Media: Triggering a Zapier/Make scenario to tweet the new post.
- Notifications: Sending an alert to a Discord or Slack channel.
- Logging: Saving the production history to a Google Sheet.
Configuration
- Go to Settings > Webhooks in the Dashboard.
- Enter the Destination URL (Endpoint).
- Click Save.
- You can click "Test Webhook" to send a dummy payload and verify the connection.
The Event Payload
When an event triggers, WP AutoFlow sends a HTTP POST request with a JSON body.
Event: post_created
Triggered immediately after the content is successfully created on the target WordPress API.
JSON Payload Structure:
{
"event": "post_created",
"data": {
"id": 1885,
"title": "The New Era of Artificial Intelligence in WordPress",
"link": "https://yoursite.com/the-new-era-of-ai/",
"timestamp": "2025-12-14T23:10:10.480Z"
},
"source": "WP AutoFlow"
}Key Definitions
| Field | Description |
|---|---|
event | The type of event trigger. Currently, always post_created. |
data.id | The ID of the post in your database (WP AutoFlow internal ID). |
data.title | The final title of the published article. |
data.link | The public URL of the post on your WordPress site. |
data.timestamp | ISO 8601 string of when the event occurred. |
source | Always WP AutoFlow. Useful for filtering if you receive webhooks from multiple apps. |
Integration Examples
1. Discord (via n8n or Make)
Since Discord expects a specific format, we recommend sending the Webhook to an automation platform like n8n or Make.com, which then formats the message for Discord.
- Create a webhook trigger in Make.
- Paste that URL into WP AutoFlow.
- Map
data.titleanddata.linkto a Discord message node.
2. Custom Script (Node.js)
If you are running a custom listener, you can handle the event like this:
app.post('/webhook/handler', (req, res) => {
const { event, data, source } = req.body;
// Verify it came from AutoFlow
if (source === 'WP AutoFlow' && event === 'post_created') {
console.log(`New post published: ${data.title}`);
console.log(`URL: ${data.link}`);
}
res.status(200).send('Received');
});Timeout: The webhook expects a 200 OK response within 10 seconds. If your external script takes too long to process, the webhook request might be marked as failed in the logs.