Skip to content
Peal
Esc
↑↓navigate↵open⌘Jpreview
On this page

Webhooks

Have Peal tell your own server what happens in a workspace, without polling: who manages endpoints and how to add one.

A webhook is a request Peal sends to an address of yours when something happens in a workspace: a post went out or failed, a channel needs reconnecting, a file is ready. Your product or automation hears about it at once, so it doesn’t have to keep asking the API.

Peal signs every request the way the Standard Webhooks specification says (its text). The libraries written for that specification verify Peal’s deliveries as they are.

Who manages them

You can manage webhooks from four places:

Where How
The web app Settings, then Webhooks
The API The webhooks group, below
The command line peal webhooks (command line)
MCP The MCP tools list_webhooks and list_webhook_deliveries, which read; create_webhook and update_webhook, which add and change an endpoint; send_test_webhook and redeliver_webhooks, which make Peal call your server

Two permissions cover them:

Permission What it allows Who holds it
webhook:read List the endpoints and read their deliveries Owners and admins
webhook:manage Add, change, turn off and delete endpoints, rotate secrets, send and resend Owners and admins

An API key does what its permissions allow, and an OAuth client what you let it do. A client that’s only allowed to read lists endpoints and deliveries, and changes nothing. Staff acting as a member can’t change a workspace’s webhooks.

Every plan includes webhooks, and so does an instance that doesn’t bill.

Endpoints

An endpoint is an address, the events it wants, a description and whether it’s on. You can also limit it to some channels and workspaces. A workspace has 10 endpoints at most, whatever its plan.

Each endpoint has these settings:

Setting Rules
Address An HTTPS URL on the default port (443), on a public host, without a user name or a password, 2048 characters at most.
Events The event types the endpoint subscribes to, at least one. It’s sent those and nothing else.
Description What the endpoint is for, up to 200 characters.
On or off While an endpoint is off, Peal sends it nothing and its pending deliveries fail. What happens in the meantime isn’t kept for it, so turning it back on doesn’t replay anything.
Scope, over the API workspace, the default, hears this workspace. partner hears every workspace a partner account owns too, and is only allowed on the account’s home workspace; elsewhere it answers 404 PartnerNotFound. You set it when you create the endpoint, and it can’t change.
Only these channels (channelIds) 50 at most. No list means every channel (Filters).
Only these workspaces (workspaceIds) 200 at most, on a partner endpoint only. No list means every workspace it hears (Filters).

Filters

With channelIds, the endpoint only receives events about those channels. Which events pass depends on what they’re about:

The event is about Events Sent when
One channel post.published, post.failed, post.unconfirmed, post.unpublished, post.unpublish_failed, channel.*, comment.* Its channel is listed
A whole post post.scheduled, post.unscheduled, post.cancelled, the approval events One of the post’s channels is listed. The payload is unchanged.
No channel media.*, boost.* Always, whatever the endpoint lists. Leave those types out of its events if you don’t want them.

With workspaceIds, a partner endpoint only hears those workspaces, and its home workspace only if it’s listed. An endpoint with the workspace scope refuses the field (WebhookFilterRefused, or InvalidRequest when you create it).

Filters apply when each event happens, with the endpoint as it is at that moment. Sending a delivery again sends it to its endpoint whatever the filters say now.

Peal only checks the shape of the ids in a filter, so an id that names nothing matches nothing. A filter stays as you saved it when a channel is disconnected or a workspace leaves the partner account. The endpoint’s form lists such a channel apart, ticked, as A channel no longer connected. Untick it to take it off.

Headers of your own

An endpoint can carry up to 5 headers of your choice, sent with every delivery next to Peal’s own. A gateway in front of your server might ask for a token, for example, or you might route on a header. They’re static: the same on every delivery and every attempt.

Names and values follow these rules:

  • A name is an HTTP token (letters, digits and !#$%&'*+.^_`|~-), 64 characters at most, and once per endpoint whatever its case. Authorization is allowed.
  • A value is visible ASCII on one line, 1,024 characters at most. It can hold spaces, but not at either end.

Peal refuses the names it sets itself, and those that describe the body, change how the request is delivered or change how its answer is encoded: any name starting with webhook- or Content-, Host, User-Agent, Cookie, Connection, Keep-Alive, Proxy-Connection, TE, Trailer, Transfer-Encoding, Upgrade, Expect and Accept-Encoding. None of yours ever replaces one of Peal’s.

Change the headers

Values are write-only. Peal stores them encrypted, as it does the secret, and never shows them again. The endpoint lists their names (headerNames), and Peal never writes the values in its logs or in the delivery log. To change them, send the endpoint’s whole list in headers:

In headers Result
A header with its value Sets it
A header by its name alone Keeps the value the endpoint has under that name (422 WebhookHeadersRefused when it has none)
A header left out Removes it
[] Removes them all
No headers field Keeps them

Values stay with their origin. Peal only sends a value to the origin (scheme, host and port) of the address it came with, and keeps it sealed to that origin. Changing url to another path on the same host keeps the values.

Moving to another host needs headers in the same request, with every header’s value, or [] to remove them. Otherwise the request answers 422 WebhookHeaderValuesRequired and nothing is saved. Whoever moves the endpoint must know the values again, so the address alone never carries them somewhere else.

Through the API

The webhooks group has these endpoints:

Endpoint What it does
GET /api/v1/webhooks Lists the endpoints, oldest first
POST /api/v1/webhooks Adds an endpoint, and answers its secret once
GET /api/v1/webhooks/{endpointId} Shows one
PATCH /api/v1/webhooks/{endpointId} Changes its address, description, events, filters or headers, or turns it on or off
DELETE /api/v1/webhooks/{endpointId} Deletes it, with its secret and its log
POST /api/v1/webhooks/{endpointId}/secret Rotates its secret, and answers the new one once
POST /api/v1/webhooks/{endpointId}/test Sends it a test event, or a sample of eventType
GET /api/v1/webhooks/{endpointId}/deliveries Lists its deliveries, newest first, 30 a page, by status and eventType
POST /api/v1/webhooks/{endpointId}/deliveries/{deliveryId}/redeliver Sends a delivery’s event again
GET /api/v1/webhooks/deliveries Lists the deliveries of every endpoint, by status, endpointId, eventType, since and until
POST /api/v1/webhooks/deliveries/redeliver Sends many deliveries again: deliveryIds, or endpointId with since, until and eventType

The GET requests need webhook:read. Everything else needs webhook:manage.

Add an endpoint

This endpoint hears when posts go out, fail or stay unconfirmed, and sends a token for the gateway in front of your server:

import { PealClient } from "@peal-social/sdk";

const peal = new PealClient({ token: process.env.PEAL_API_KEY });

const { endpoint, secret } = await peal.webhooks.create({
  url: "https://hooks.example.com/peal",
  description: "Order system",
  eventTypes: ["post.published", "post.failed", "post.unconfirmed"],
  headers: [{ name: "Authorization", value: "Bearer <your gateway token>" }],
});
import os

from peal import Peal, WebhookHeader

peal = Peal(token=os.environ["PEAL_API_KEY"])

created = peal.webhooks.create(
    url="https://hooks.example.com/peal",
    description="Order system",
    event_types=["post.published", "post.failed", "post.unconfirmed"],
    headers=[WebhookHeader(name="Authorization", value="Bearer <your gateway token>")],
)
import (
	"context"
	"os"

	peal "github.com/peal-social/peal/packages/peal-sdk/go"
	"github.com/peal-social/peal/packages/peal-sdk/go/client"
	"github.com/peal-social/peal/packages/peal-sdk/go/option"
)

client := client.NewClient(option.WithToken(os.Getenv("PEAL_API_KEY")))

created, err := client.Webhooks.Create(context.TODO(), &peal.NewWebhookEndpoint{
	URL:         "https://hooks.example.com/peal",
	Description: peal.String("Order system"),
	EventTypes: []peal.SubscribableWebhookEventType{
		peal.SubscribableWebhookEventTypePostPublished,
		peal.SubscribableWebhookEventTypePostFailed,
		peal.SubscribableWebhookEventTypePostUnconfirmed,
	},
	Headers: []*peal.WebhookHeader{
		{Name: "Authorization", Value: "Bearer <your gateway token>"},
	},
})
require "peal"

peal = Peal::Client.new(token: ENV.fetch("PEAL_API_KEY"))

created = peal.webhooks.create(
  url: "https://hooks.example.com/peal",
  description: "Order system",
  event_types: ["post.published", "post.failed", "post.unconfirmed"],
  headers: [{ name: "Authorization", value: "Bearer <your gateway token>" }]
)
import java.util.List;
import social.peal.PealClient;
import social.peal.resources.webhooks.requests.*;
import social.peal.types.*;

PealClient peal = PealClient.builder()
    .token(System.getenv("PEAL_API_KEY"))
    .build();

WebhookEndpointSecret created = peal.webhooks().create(
    NewWebhookEndpoint.builder()
        .url("https://hooks.example.com/peal")
        .description("Order system")
        .eventTypes(List.of(
            SubscribableWebhookEventType.POST_PUBLISHED,
            SubscribableWebhookEventType.POST_FAILED,
            SubscribableWebhookEventType.POST_UNCONFIRMED))
        .headers(List.of(WebhookHeader.builder()
            .name("Authorization")
            .value("Bearer <your gateway token>")
            .build()))
        .build());
<?php
use Peal\PealClient;
use Peal\Types\SubscribableWebhookEventType;
use Peal\Types\WebhookHeader;
use Peal\Webhooks\Requests\NewWebhookEndpoint;

$peal = new PealClient(token: getenv('PEAL_API_KEY'));

$created = $peal->webhooks->create(new NewWebhookEndpoint([
    'url' => 'https://hooks.example.com/peal',
    'description' => 'Order system',
    'eventTypes' => [
        SubscribableWebhookEventType::PostPublished->value,
        SubscribableWebhookEventType::PostFailed->value,
        SubscribableWebhookEventType::PostUnconfirmed->value,
    ],
    'headers' => [
        new WebhookHeader([
            'name' => 'Authorization',
            'value' => 'Bearer <your gateway token>',
        ]),
    ],
]));
using Peal;

var peal = new PealClient(Environment.GetEnvironmentVariable("PEAL_API_KEY")!);

var created = await peal.Webhooks.CreateAsync(new NewWebhookEndpoint
{
    Url = "https://hooks.example.com/peal",
    Description = "Order system",
    EventTypes = new List<SubscribableWebhookEventType>
    {
        SubscribableWebhookEventType.PostPublished,
        SubscribableWebhookEventType.PostFailed,
        SubscribableWebhookEventType.PostUnconfirmed,
    },
    Headers = new List<WebhookHeader>
    {
        new WebhookHeader { Name = "Authorization", Value = "Bearer <your gateway token>" },
    },
});
use peal_sdk::prelude::*;

let peal = PealClient::new(ClientConfig {
    token: std::env::var("PEAL_API_KEY").ok(),
    ..Default::default()
})?;

let created = peal
    .webhooks
    .create(
        &NewWebhookEndpoint::builder()
            .url("https://hooks.example.com/peal")
            .description("Order system")
            .event_types(vec![
                SubscribableWebhookEventType::PostPublished,
                SubscribableWebhookEventType::PostFailed,
                SubscribableWebhookEventType::PostUnconfirmed,
            ])
            .headers(vec![WebhookHeader::builder()
                .name("Authorization")
                .value("Bearer <your gateway token>")
                .build()?])
            .build()?,
        None,
    )
    .await?;
curl https://api.example.com/api/v1/webhooks \
  -H "Authorization: Bearer $PEAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.example.com/peal",
    "description": "Order system",
    "eventTypes": ["post.published", "post.failed", "post.unconfirmed"],
    "headers": [{ "name": "Authorization", "value": "Bearer <your gateway token>" }]
  }'
peal webhooks create --url https://hooks.example.com/peal \
  --description "Order system" \
  --events post.published,post.failed,post.unconfirmed \
  --header "Authorization: Bearer $GATEWAY_TOKEN"

The answer holds the endpoint and its secret. Copy the secret now: later answers never hold it again, nor any header’s value. The endpoint names its headers in headerNames.

Send deliveries again

After an outage, you can send an endpoint’s failed deliveries again since an instant:

const result = await peal.webhooks.redeliverMany({
  endpointId: "019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f",
  since: "2026-11-10T00:00:00Z",
});
from peal import WebhookRedeliveryOfFailed

result = peal.webhooks.redeliver_many(
    request=WebhookRedeliveryOfFailed(
        endpoint_id="019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f",
        since="2026-11-10T00:00:00Z",
    ),
)
result, err := client.Webhooks.RedeliverMany(context.TODO(), &peal.WebhookRedeliveryRequest{
	WebhookRedeliveryOfFailed: &peal.WebhookRedeliveryOfFailed{
		EndpointID: "019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f",
		Since:      peal.String("2026-11-10T00:00:00Z"),
	},
})
# The SDK would send `endpoint_id` here, a key the API doesn't read, so
# the endpoint's id goes in under the API's own name.
result = peal.webhooks.redeliver_many(
  since: "2026-11-10T00:00:00Z",
  request_options: {
    additional_body_parameters: { endpointId: "019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f" }
  }
)
WebhookBulkRedelivery result = peal.webhooks().redeliverMany(
    WebhookRedeliveryRequest.of(WebhookRedeliveryOfFailed.builder()
        .endpointId("019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f")
        .since("2026-11-10T00:00:00Z")
        .build()));
use Peal\Types\WebhookRedeliveryOfFailed;

$result = $peal->webhooks->redeliverMany(new WebhookRedeliveryOfFailed([
    'endpointId' => '019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f',
    'since' => '2026-11-10T00:00:00Z',
]));
var result = await peal.Webhooks.RedeliverManyAsync(new WebhookRedeliveryOfFailed
{
    EndpointId = "019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f",
    Since = "2026-11-10T00:00:00Z",
});
let result = peal
    .webhooks
    .redeliver_many(
        &WebhookRedeliveryRequest::WebhookRedeliveryOfFailed(
            WebhookRedeliveryOfFailed::builder()
                .endpoint_id("019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f")
                .since("2026-11-10T00:00:00Z")
                .build()?,
        ),
        None,
    )
    .await?;
curl https://api.example.com/api/v1/webhooks/deliveries/redeliver \
  -H "Authorization: Bearer $PEAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "endpointId": "019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f", "since": "2026-11-10T00:00:00Z" }'
peal webhooks redeliver --failed \
  --endpoint 019a6e00-77aa-7f12-b0c4-1a2b3c4d5e6f \
  --since 2026-11-10T00:00:00Z

The delivery log explains what a resend skips and how many you can send an hour.

Errors

Errors come in the API’s format, each with a code in snake case next to its name, such as webhook_url_refused for WebhookUrlRefused (Errors). An API key’s requests count towards its rate limit. The webhooks group answers these errors of its own:

Status Error When
404 WebhookEndpointNotFound The workspace has no endpoint with this id.
404 WebhookDeliveryNotFound The endpoint has no delivery with this id, or its log no longer keeps it.
409 TooManyWebhookEndpoints The workspace already has 10 endpoints.
409 WebhookEndpointDisabled You asked for a test or a resend on an endpoint that’s off.
422 WebhookFilterRefused workspaceIds on an endpoint with the workspace scope. field names it.
422 WebhookHeadersRefused A header sent without a value that the endpoint doesn’t have.
422 WebhookHeaderValuesRequired A new url on another origin, on an endpoint with headers, without every header’s value or [].
422 WebhookUrlRefused Peal doesn’t deliver to the address. reason says why, below.
429 TooManyWebhookSends The hour’s test events and resends are used up. See the delivery log.
503 WebhooksNotConfigured The instance can’t keep a signing secret. See Self-hosting.

WebhookUrlRefused gives one of these reasons:

reason The address
malformed isn’t a URL.
notHttps isn’t HTTPS, or names a port other than 443.
credentials carries a user name or a password.
tooLong is longer than 2048 characters.
notPublic has a host that is, or resolves to, an address that isn’t public.
unknownHost has a host name that doesn’t resolve.
ownServer is the Peal server’s own address, where Peal never delivers.

The API reference lists each endpoint’s parameters and answers.

Self-hosting

Webhooks need no setting of their own. Signing secrets are encrypted with the keys in PEAL_TOKEN_KEYS, like the tokens of connected channels. Without it, the instance still starts, but adding an endpoint or rotating a secret answers 503 WebhooksNotConfigured.

Deliveries leave from the server, so it must be able to reach your receivers over HTTPS. They only go to public addresses: an endpoint on localhost or inside your private network is refused, on your own instance too.

Was this page helpful?