Flarum Webhook

A Flarum extension that sends HTTP webhook notifications for forum events. Integrate your forum with Discord, Slack, custom bots, or any service that accepts webhooks.

Features
- 7 Event Types:
post.created, post.revised, post.hidden, post.deleted, discussion.renamed, discussion.hidden, discussion.deleted
- Full Data Payloads: Receive complete user, post, and discussion model data
- Bearer Token Authentication: Optional token for securing your webhook endpoint
- Simple Configuration: Admin panel settings for webhook URL and authentication
Installation
composer require import-ai/flarum-webhook
Configuration
- Navigate to Administration > Extensions > Flarum Webhook
- Enter your Webhook URL - the endpoint that will receive POST requests
- Optionally enter a Bearer Token for authentication
Webhook Payload
The webhook sends a JSON POST request with an event field indicating the event type, along with relevant model data.
Post Events
For post.created, post.revised, post.hidden, and post.deleted:
{
"event": "post.created",
"user": { "id": 1, "username": "admin", "display_name": "Admin", "email": "admin@example.com" },
"post": { "id": 42, "number": 3, "discussion_id": 10, "content": "<p>Post content...</p>" },
"discussion": { "id": 10, "title": "Discussion Title", "comment_count": 3 },
"actor": { "id": 1, "username": "admin" }
}
Discussion Renamed
{
"event": "discussion.renamed",
"discussion": { "id": 10, "title": "New Title" },
"old_title": "Old Title",
"actor": { "id": 1, "username": "admin" }
}
Discussion Hidden/Deleted
For discussion.hidden and discussion.deleted:
{
"event": "discussion.hidden",
"discussion": { "id": 10, "title": "Discussion Title" },
"actor": { "id": 1, "username": "admin" }
}
Detecting New Discussions
When a new discussion is created, a post.created event is fired for the first post. To detect new discussions:
if (payload.post.number === 1 && payload.discussion.comment_count === 1) {
// This is a new discussion!
}
Requirements
Links