Webhooks
Receive real-time notifications for events in your Outstand account with webhooks instead of polling the API.
Webhooks allow you to receive real-time notifications when events occur in your Outstand account. Instead of polling our API for updates, webhooks push data to your endpoint as soon as something happens.
Overview
When you configure a webhook endpoint, Outstand will send an HTTP POST request to your specified URL whenever a subscribed event occurs. This enables you to:
- Get instant notifications when posts are published successfully
- Be alerted immediately when publishing errors occur
- Know when a social account token expires and needs re-authentication
- React to new comments on your connected accounts' posts
- Build automated workflows based on Outstand events
- Integrate with your existing systems and dashboards
Setting Up Webhooks
Creating a Webhook Endpoint
- Navigate to Settings in the Outstand web application
- Click on Webhooks in the sidebar
- Click the Add Webhook button
- Fill in the webhook configuration form:
| Field | Description | Required |
|---|---|---|
| Name | A friendly name to identify this webhook (e.g., "Production Notifications") | Yes |
| Endpoint URL | The HTTPS URL where Outstand will send webhook payloads. Must start with https:// - plain http:// endpoints are not supported and will not receive deliveries | Yes |
| Signing Secret | A secret key used to sign payloads with HMAC-SHA256 | No |
| Custom Headers | Additional HTTP headers to include in webhook requests | No |
| Events | Which events should trigger this webhook | Yes |
- Select the events you want to subscribe to
- Click Create to save the webhook
Managing Webhooks
From the Webhooks settings page, you can:
- Enable/Disable a webhook using the toggle switch
- Edit a webhook's configuration by clicking the Edit button
- Test a webhook to verify your endpoint is working
- Delete a webhook when it's no longer needed
Available Events
| Event | Description |
|---|---|
post.published | Triggered when a post is successfully published to at least one social account |
post.deleted | Triggered when a post published through Outstand is removed on Facebook |
post.error | Triggered when a post fails to publish to all targeted social accounts |
account.token_expired | Triggered when a social account's OAuth token fails to refresh |
import.completed | Triggered when a post import job finishes successfully |
import.failed | Triggered when a post import job finishes with errors or partial results |
conversation.started | Triggered when a new conversation starts with a connected account, whether the contact messages first or you start it |
message.received | Triggered when a direct message is received |
message.sent | Triggered when a direct message is sent from a connected account |
message.failed | Triggered when a direct message fails to send |
comment.received | Triggered when someone comments on a connected account's post or Instagram Live broadcast |
The conversation.* and message.* events are emitted for Instagram Direct Messages, Facebook Page messages and X Direct Messages, and only for organizations with DM messaging turned on, for accounts connected with messaging access: instagram_business_manage_messages on Instagram (see Enable Direct Messages), pages_messaging with pages_manage_metadata on a Facebook Page (see Enable Direct Messages), dm.read on X. With DM messaging on, the messaging scopes are part of each network's default scopes. With it off, incoming direct messages are not collected and no conversation.* or message.* events are sent.
The comment.received event is emitted for Instagram comments, Facebook Page comments, Threads replies, X replies and LinkedIn Company Page comments. Facebook Page comments need the Page connected with pages_manage_metadata, a default scope on Managed Keys, and X replies need Outstand's webhook URL registered on your X app. LinkedIn comments are only sent for Company Pages connected with Outstand's managed keys, never for personal profiles. Instagram, Facebook and X comments can be answered with a direct message, see Comment-to-DM; Threads replies and LinkedIn comments cannot.
Bluesky has no webhooks, so Bluesky accounts never trigger comment.received or message.received. See Bluesky comment and message webhooks.
Webhook Payload Format
All webhook payloads are sent as JSON with the following structure:
Headers
Content-Type: application/json
User-Agent: Outstand-Webhooks/1.0
X-Outstand-Signature: sha256=<signature> (if signing secret is configured)Plus any custom headers you configured.
post.published Event
Sent when a post is successfully published to at least one social account.
{
"event": "post.published",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"postId": "9dyJS",
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"socialAccounts": [
{
"accountId": "a1B2c3",
"network": "threads",
"username": "myaccount",
"platformPostId": "12345678901234567",
"platformPostUrl": "https://www.threads.net/@myaccount/post/DAbCdEfGhIj"
},
{
"accountId": "d4E5f6",
"network": "linkedin",
"username": "John Doe",
"platformPostId": "urn:li:share:7654321",
"platformPostUrl": "https://www.linkedin.com/feed/update/urn:li:share:7654321"
},
{
"accountId": "g7H8i9",
"network": "instagram",
"username": "myinsta",
"platformPostId": "17851234567890123",
"platformPostUrl": "https://www.instagram.com/p/DAbCdEfGhIj/"
}
]
}
}platformPostUrl is the public URL of the post on the social network.
post.deleted Event
Currently Facebook only. Sent when a Page post published through Outstand is removed on Facebook, either by the Page or by Facebook. It does not fire for posts deleted through the Outstand API, unknown posts, or imported posts. Repeated removal notifications are ignored once the destination is marked deleted. Only the affected social account destination is marked deleted.
{
"event": "post.deleted",
"timestamp": "2026-11-28T12:00:00.000Z",
"data": {
"postId": "abc123",
"socialAccountId": "def456",
"network": "facebook",
"platformPostId": "123456789_987654321",
"deletedAt": "2026-11-28T12:00:00.000Z"
}
}postId and socialAccountId are Outstand's public encoded IDs. platformPostId is the ID reported by Facebook.
deletedAt is the time Outstand processed the removal notification, not the original post creation time.
post.error Event
Sent when a post fails to publish to all targeted social accounts.
{
"event": "post.error",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"postId": "9dyJS",
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"socialAccounts": [
{
"accountId": "a1B2c3",
"network": "threads",
"username": "myaccount",
"error": "Rate limit exceeded. Please try again later."
},
{
"accountId": "g7H8i9",
"network": "instagram",
"username": "myinsta",
"error": "Access token has expired"
}
]
}
}account.token_expired Event
Sent when a social account's OAuth token fails to refresh. This typically means the user needs to re-authenticate the account.
{
"event": "account.token_expired",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"accountId": 42,
"network": "instagram",
"username": "myinsta",
"error": "Failed to refresh Instagram token: The access token is invalid"
}
}import.completed Event
Sent when a post import job finishes with all posts successfully imported.
{
"event": "import.completed",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"import_id": "9dyJS",
"status": "completed",
"imported": 42,
"skipped": 0,
"failed": 0
}
}import.failed Event
Sent when a post import job finishes with errors or only partially succeeds. The status field can be partial (some posts imported, some failed) or failed (nothing imported). The error field is only present when a specific error message is available.
{
"event": "import.failed",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"import_id": "9dyJS",
"status": "partial",
"imported": 30,
"skipped": 2,
"failed": 10,
"error": "Some posts could not be fetched from the platform"
}
}conversation.started Event
Sent the first time a contact messages one of your connected accounts, or when you start a conversation with them. It is delivered once per conversation, alongside the event for its first message: message.received, or message.sent when you started it.
{
"event": "conversation.started",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"conversationId": "9dyJS",
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"network": "instagram",
"participantId": "17841400000000000"
}
}message.received Event
Sent when a contact sends a direct message to one of your connected accounts. When the contact sent it by tapping a quick reply or a button, data also carries interaction with the type tapped (quick_reply or button) and the id you gave that option, for example { "type": "quick_reply", "id": "..." }. When the contact replied to your Instagram story or mentioned you in theirs, data also carries story with its type (reply or mention) and, when Instagram sends them, the story's id and url. See Story replies and mentions.
{
"event": "message.received",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"conversationId": "9dyJS",
"messageId": "k2Lm8",
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"network": "instagram",
"content": "",
"senderId": "17841400000000000",
"sentAt": "2024-12-29T10:29:58.000Z",
"attachments": [
{
"type": "link",
"platformType": "ig_reel",
"url": "https://www.instagram.com/reel/DAbCdEfGhIj/",
"title": "Our new linen shirt, in four colours",
"mediaId": "18139494541428835"
}
],
"sender": {
"isFollower": true,
"isFollowedByAccount": false,
"followerCount": 25,
"isVerified": false
}
}
}attachments lists the media the contact sent or shared: photos, videos, audio and files, and shared reels and posts with their caption and id. type says what the url is: an image, video, audio or file, whose url is a Meta CDN link that expires, or a link to a page, such as a shared reel or post on instagram.com. platformType keeps the network's own value, such as ig_reel or ig_post. It is empty for a text-only message. A note the contact adds to a share arrives as a separate message. See Received media and shares.
sender is what Instagram reveals about the contact, looked up when the message arrives, so it reflects a follow that happened since their last message:
| Field | Description |
|---|---|
isFollower | The contact follows your connected account |
isFollowedByAccount | Your connected account follows the contact |
followerCount | The contact's follower count |
isVerified | The contact has a verified Instagram account |
sender is null when the lookup fails, and a field inside it is null when Instagram does not return it. Treat null as unknown, never as "not a follower".
Messenger does not expose follows or verification to a Page, so on a Facebook conversation every field inside sender is null.
message.sent Event
Sent when a direct message goes out from one of your connected accounts. This covers messages sent through the API (source: "api") and messages the account owner sends from the Instagram or Messenger app (source: "native_app"). App-sent messages are relayed but not stored, so their event has messageId: null and carries the message content; see Message lifecycle and webhooks.
{
"event": "message.sent",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"conversationId": "9dyJS",
"messageId": "p7Qx3",
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"network": "instagram",
"platformMessageId": "aWdfZAG1faXRlbToxOk...",
"source": "api"
}
}message.failed Event
Sent when a message submitted through the API could not be delivered. The error field carries the reason returned by the platform.
{
"event": "message.failed",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"conversationId": "9dyJS",
"messageId": "p7Qx3",
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"network": "instagram",
"error": "Instagram send failed: 403"
}
}comment.received Event
Sent when someone comments on, or replies to a comment on, a post owned by one of your connected accounts. This covers posts published outside Outstand and comments received during Instagram Live broadcasts. Existing comment.received subscribers receive Live comments too; filter on data.isLive if you only want regular comments. Comments written by the connected account itself, including replies sent through the API, do not trigger it.
{
"event": "comment.received",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"network": "instagram",
"accountId": "x8Kp2",
"postId": "a1B2c",
"platformPostId": "17912345678901234",
"isLive": false,
"commentId": "17865799348089039",
"parentCommentId": null,
"authorId": "17841400000000000",
"authorUsername": "jane.doe",
"authorName": null,
"text": "Love this! Is it available in blue?",
"author": null
}
}| Field | Description |
|---|---|
accountId | The connected social account that owns the post, as returned by GET /v1/social-accounts |
postId | The Outstand post the comment is on, or null when the post was not published through Outstand |
platformPostId | The post's ID on the network, or the broadcast media ID for Instagram Live. On Threads and X, the first post of the thread the reply is in |
isLive | Required boolean: true for Instagram live_comments notifications; false for regular Instagram comments, Facebook Page comments, Threads replies, X replies and LinkedIn comments |
commentId | The comment's ID on the network. When postId is set, pass it as parent_comment_id to publish a reply under it. To answer the commenter in a direct message instead (Comment-to-DM), start a conversation with accountId as social_account_id and the comment as instagram.comment_id plus authorId as instagram.author_id, or as facebook.comment_id alone on a Facebook Page, which needs no author id, or as x.comment_id alone on X. Threads replies and LinkedIn comments cannot be answered with a direct message. On LinkedIn it is the full urn:li:comment:(...) URN |
parentCommentId | The comment being replied to, or null for a top-level comment. On LinkedIn it is a full urn:li:comment:(...) URN |
authorId, authorUsername, authorName | The commenter on the network. Instagram sends authorId and authorUsername. Facebook has no usernames, so a Page comment sends authorId and authorName. Threads sends authorUsername only, and its authorId is null. X always sends authorId, and authorUsername and authorName are null when X leaves the author out of its delivery. LinkedIn sends authorId only, as a urn:li:person:... or urn:li:organization:... URN |
text | The comment text. On LinkedIn it is fetched from LinkedIn, and is null when LinkedIn will not return it for the Page's token |
author | The commenter's follow relationship and follower count, in the same shape as sender on message.received. Instagram reveals it only to accounts the person has messaged, so it is null unless the commenter has sent your account a DM since it was connected. Messenger reveals nothing of the kind, so on Facebook every field inside it is null, and it is always null on Threads. On X, it is looked up for every reply, which X bills to your app as a User read, see What X bills to your app. null means unknown, never "not a follower". It is always null on LinkedIn |
LinkedIn notes: only comments on public posts of a Company Page are delivered. LinkedIn can deliver the same comment more than once, and reconnecting a Page may re-deliver up to 24 hours of comments, so deduplicate by accountId plus commentId.
Instagram Live example
Live comments use the same event with isLive: true. platformPostId identifies the broadcast media, and postId is null when it was not published through Outstand:
{
"event": "comment.received",
"timestamp": "2026-10-29T10:30:00.000Z",
"data": {
"orgId": "kR7mQ2xLpN4vT8wZ3bC6yH9sJ1dF5gAe",
"network": "instagram",
"accountId": "x8Kp2",
"postId": null,
"platformPostId": "18012345678901234",
"isLive": true,
"commentId": "17865799348089040",
"parentCommentId": null,
"authorId": "17841400000000000",
"authorUsername": "jane.doe",
"authorName": null,
"text": "Hello from Stockholm!",
"author": null
}
}Meta sends Live comment notifications only while the broadcast is live; they stop when it ends. This event receives comments only and adds no broadcast lifecycle events, comment history or new reply capabilities. See Instagram comment webhook setup.
Comments are not stored by Outstand, so this event is the only record of them we pass on. Deduplicate using accountId plus commentId: a comment can occasionally be delivered more than once.
Verifying Webhook Signatures
If you configure a signing secret, Outstand will include an X-Outstand-Signature header with each request. This allows you to verify that the webhook came from Outstand and wasn't tampered with.
The header value is sha256= followed by the hex-encoded HMAC-SHA256 of the request body, keyed with your signing secret. The signature covers the exact bytes Outstand sent, so always verify against the raw request body before parsing it. Do not re-serialize a parsed body (for example JSON.stringify(req.body)): any difference in whitespace, key order, number formatting or character escaping changes the bytes and the signature no longer matches. Compare signatures in constant time.
// Node.js (Express) example
const crypto = require('crypto');
const express = require('express');
function verifySignature(rawBody, signature, secret) {
if (typeof signature !== 'string') return false;
const expected = Buffer.from(
'sha256=' + crypto.createHmac('sha256', secret).update(rawBody).digest('hex'),
'utf8'
);
const received = Buffer.from(signature, 'utf8');
// timingSafeEqual throws when the lengths differ, so check them first.
return received.length === expected.length && crypto.timingSafeEqual(received, expected);
}
const app = express();
// express.raw keeps the body as the original bytes (a Buffer) instead of parsing it.
// Register it on the webhook route before any global express.json() middleware.
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
const isValid = verifySignature(req.body, req.get('X-Outstand-Signature'), process.env.WEBHOOK_SECRET);
if (!isValid) {
return res.status(401).send('Invalid signature');
}
// Parse only after the signature has been verified.
const event = JSON.parse(req.body.toString('utf8'));
// Process the webhook...
res.status(200).send('OK');
});// Fetch-style handler (Cloudflare Workers, Deno, Bun, Next.js route handlers)
import { createHmac, timingSafeEqual } from 'node:crypto';
export async function POST(request) {
// Read the body as text once, verify it, then parse that same string.
const rawBody = await request.text();
const signature = request.headers.get('X-Outstand-Signature') ?? '';
const expected = Buffer.from(
'sha256=' + createHmac('sha256', process.env.WEBHOOK_SECRET).update(rawBody, 'utf8').digest('hex'),
'utf8'
);
const received = Buffer.from(signature, 'utf8');
if (received.length !== expected.length || !timingSafeEqual(received, expected)) {
return new Response('Invalid signature', { status: 401 });
}
const event = JSON.parse(rawBody);
// Process the webhook...
return new Response('OK', { status: 200 });
}# Python (Flask) example
import hashlib
import hmac
import json
import os
def verify_signature(raw_body: bytes, signature: str | None, secret: str) -> bool:
if not signature:
return False
expected = 'sha256=' + hmac.new(
secret.encode('utf-8'),
raw_body,
hashlib.sha256
).hexdigest()
return hmac.compare_digest(signature.encode('utf-8'), expected.encode('utf-8'))
# In your webhook handler
@app.route('/webhook', methods=['POST'])
def handle_webhook():
raw_body = request.get_data() # the raw bytes, before any JSON parsing
is_valid = verify_signature(
raw_body,
request.headers.get('X-Outstand-Signature'),
os.environ['WEBHOOK_SECRET']
)
if not is_valid:
return 'Invalid signature', 401
event = json.loads(raw_body)
# Process the webhook...
return 'OK', 200Delivery & Retries
Outstand provides a scalable and reliable delivery mechanism to deliver webhooks, which provides:
- Automatic retries: Failed deliveries are retried up to 5 times with exponential backoff
- Retry intervals: Starting at 10 seconds, increasing up to 5 minutes between attempts
- Timeout: Each delivery attempt has a 30-second timeout
Response Requirements
Your endpoint should:
- Return a
2xxstatus code (200-299) to acknowledge receipt - Respond within 30 seconds
- Be idempotent (handle duplicate deliveries gracefully)
If your endpoint returns a 4xx or 5xx status code, or times out, the delivery will be retried.
Best Practices
- Always verify signatures if you've configured a signing secret
- Respond quickly - do heavy processing asynchronously after acknowledging the webhook
- Handle duplicates - use the
postIdandtimestamp(oraccountIdpluscommentIdforcomment.received) to deduplicate if needed - Use HTTPS - webhook endpoints must use HTTPS. Deliveries to
http://URLs are rejected and never reach your endpoint - Test your endpoint - use the Test button in the UI before going live
- Monitor failures - set up alerting for failed webhook deliveries on your end
Testing Webhooks
You can test your webhook configuration directly from the Outstand UI:
- Go to Settings → Webhooks
- Find the webhook you want to test
- Click the Test button
This will send a test payload to your endpoint:
{
"event": "test",
"timestamp": "2024-12-29T10:30:00.000Z",
"data": {
"message": "This is a test webhook from Outstand",
"endpointId": 123
}
}The test result will show you the HTTP status code returned by your endpoint.