Skip to main content
Version: Next

Webhooks

Event Publisher delivers real-time webhook notifications when events occur on your PBXware system. Instead of polling for changes, your server receives an HTTP POST the moment something happens.

Scope, event filtering and the event envelope apply to both delivery methods and are described in the Event Publisher overview.


How It Works​

  1. Configure a webhook — provide your endpoint URL, the events to subscribe to, and optional authentication
  2. An event fires — when a subscribed event occurs, PBXware sends a POST request with a JSON payload to your URL
  3. Acknowledge receipt — return any 2xx HTTP response; no body is required

Retries: If your server returns a non-2xx response or does not respond, PBXware retries delivery using exponential backoff. Retry behavior is configurable. Use the event_id field in the envelope for idempotency — retried deliveries carry the same event_id as the original.

Because webhooks are standard HTTP POST requests, Event Publisher integrates naturally with workflow automation platforms such as Zapier, Make (Integromat), Microsoft Power Automate, and n8n — no custom server required for many use cases. If a target system expects a different payload structure, you will need to implement your own middleware to handle the transformation.


Key Concepts​

Outbound authentication — PBXware can authenticate requests to your endpoint using a static bearer token, HTTP Basic Auth, or OAuth2 (Client Credentials or Resource Owner Password Credentials).

Endpoint testing — Before creating a webhook, you can test whether your endpoint is reachable and correctly authenticated.

See the Event Publisher API Reference for all webhook management endpoints.


Example: Receiving Events​

Acknowledge each request immediately and process the event afterwards. Retried deliveries carry the same event_id, so skip events you have already handled; in production, keep the handled IDs in a store with an expiry rather than in memory. If you configured outbound authentication, check the Authorization header before accepting a request.

Save it as an ES module, for example server.mjs, and install Express: npm install express

import express from 'express';

const app = express();
app.use(express.json());

const seenEventIds = new Set();

function handleEvent(event) {
console.log(event.event, event.event_id);
}

app.post('/webhook', (req, res) => {
res.sendStatus(200);

const event = req.body;
if (seenEventIds.has(event.event_id)) return;
seenEventIds.add(event.event_id);

handleEvent(event);
});

app.listen(3000);

The Call Events and SMS Events pages show what handleEvent can do with each event.