Server integration

Webhooks

Registering receivers, the event catalogue, token verification against the raw body, retries and reconciliation.

A webhook is how App Center tells you something changed. It is at-least-once and best-effort: retries are bounded, ordering is not guaranteed, and a receiver that has been offline must be able to catch up by pulling.

Managing registrations

These live under /appcenter/v3/app, scoped to your own application — no method accepts an application id. The platform registers its two first-party receivers at boot; every other application registers its own. The cap is 10 registrations per application.

POST/webhooksappcenter:service

Register a receiver. No credential is issued, stored or returned.

Request body

urlstringrequired
HTTPS receiver, ≤ 2048 characters, no embedded credentials, no redirect target. Plain HTTP is refused.
eventsstring[]required
At least one entry from the catalogue below, or * for everything. Duplicates are collapsed.
descriptionstring | null
Free text up to 200 characters, so an operator can tell two receivers apart.
Request body
{
  "url": "https://retill.example.com/webhooks/appcenter",
  "events": [
    "user.updated",
    "business.updated",
    "subscription.created"
  ],
  "description": "Production receiver"
}
200 OK
{
  "success": true,
  "data": {
    "webhook": {
      "id": 17,
      "url": "https://retill.example.com/webhooks/appcenter",
      "description": "Production receiver",
      "events": [
        "user.updated",
        "business.updated"
      ],
      "active": true,
      "version": 1,
      "consecutiveFailures": 0,
      "lastDeliveryAt": null,
      "lastSuccessAt": null,
      "lastFailureAt": null,
      "createdAt": "2026-06-02T08:31:55.000Z",
      "updatedAt": "2026-06-02T08:31:55.000Z"
    }
  }
}

There is no secret to store: every delivery is signed with a short-lived token minted by the platform's identity provider.

Failures to handle

409webhook_limit_reached
Ten registrations already exist. Delete one rather than rotating the URL of a live receiver.
409CONFLICT
That URL is already registered for this application.
422VALIDATION_FAILED
An unknown event name, a non-HTTPS URL, or an empty events array.
  • The subscription family is five separate names — there is no subscription.updated.
  • Creating a webhook does not send a verification request. Call /test to prove the receiver.
GET/webhooksappcenter:service

Every registration for this application. No credential is stored to return.

200 OK
{
  "success": true,
  "data": {
    "webhooks": [
      {
        "id": 17,
        "url": "https://retill.example.com/webhooks/appcenter",
        "description": "Production receiver",
        "events": ["user.updated", "business.updated"],
        "active": true,
        "version": 4,
        "consecutiveFailures": 0,
        "lastDeliveryAt": "2026-11-08T10:14:02.000Z",
        "lastSuccessAt": "2026-11-08T10:14:02.000Z",
        "lastFailureAt": null,
        "createdAt": "2026-06-02T08:31:55.000Z",
        "updatedAt": "2026-10-21T13:02:11.000Z"
      }
    ]
  }
}
  • An application with no registrations gets { "success": true, "data": { "webhooks": [] } }.
  • GET /webhooks/:webhookId returns the same object under webhook.
  • version is the concurrency token you must send back on PATCH.
PATCH/webhooks/:webhookIdappcenter:service

Change the URL, the subscription list or the enabled flag. Every field except version is optional.

Request body

versionintegerrequired
The version you last read. Compare-and-swap: a stale value is refused, never merged.
urlstring
New HTTPS receiver. Must be unique per application.
eventsstring[]
Replaces the whole list, it does not merge.
descriptionstring | null
Up to 200 characters; "" is stored as null.
activeboolean
false pauses delivery without losing its history or the log.
Request body
{
  "version": 4,
  "active": false
}
409 VERSION_CONFLICT
{
  "success": false,
  "error": {
    "code": "VERSION_CONFLICT",
    "message": "This webhook was changed by another request. Reload and try again."
  }
}

Identical shape for a stale version here and on any other versioned write.

Failures to handle

404NOT_FOUND
No such webhook, or it belongs to another application — the two are deliberately indistinguishable.
409VERSION_CONFLICT
Someone else wrote first. Re-read, re-apply your change, retry once.
422VALIDATION_FAILED
An unknown key was sent — the schema is strict on purpose — or version is missing.
  • A successful write bumps version, so read the response rather than assuming version + 1.
DELETE/webhooks/:webhookIdappcenter:service

Remove a registration and stop all future deliveries to it.

200 OK
{
  "success": true,
  "data": {}
}

Past deliveries stay readable through the redeliver route until they age out.

Failures to handle

404NOT_FOUND
No such webhook for this application.
POST/webhooks/:webhookId/testappcenter:service

Queue a ping delivery and return its delivery row, so a receiver can be proven end to end.

200 OK
{
  "success": true,
  "data": {
    "deliveryId": "5e1b0f0e-8a0a-4b2b-9f00-1c2c7a3e9d41",
    "delivery": {
      "id": "5e1b0f0e-8a0a-4b2b-9f00-1c2c7a3e9d41",
      "webhookId": 17,
      "event": "ping",
      "status": "pending",
      "attempts": 0,
      "responseStatus": null,
      "responseBody": null,
      "error": null,
      "deliveredAt": null,
      "createdAt": "2026-11-08T10:40:12.000Z"
    }
  }
}

It starts pending: the answer arrives later, through the delivery log.

  • ping cannot be subscribed to — only this route emits it — but a * registration still receives it.
  • With the job queue disabled in local development the row stays pending forever. That is the queue, not the receiver.
GET/webhooks/:webhookId/deliveriesappcenter:service

The delivery log, newest first: what was sent, how many attempts, and what came back.

Query parameters

limitinteger 1–100 · default 50
Page size.
cursorstring
The nextCursor from the previous page, passed back verbatim. Keyset, not offset.
200 OK
{
  "success": true,
  "data": {
    "deliveries": [
      {
        "id": "5e1b0f0e-8a0a-4b2b-9f00-1c2c7a3e9d41",
        "webhookId": 17,
        "event": "ping",
        "status": "delivered",
        "attempts": 1,
        "responseStatus": 204,
        "responseBody": "",
        "error": null,
        "deliveredAt": "2026-11-08T10:40:13.412Z",
        "createdAt": "2026-11-08T10:40:12.000Z"
      }
    ],
    "nextCursor": null
  }
}

nextCursor is null on the last page — the only stop condition.

Failures to handle

404NOT_FOUND
No such webhook for this application.
422VALIDATION_FAILED
limit outside 1–100, or a malformed cursor.
  • status is pending, delivered or exhausted — the last means all seven attempts failed.
  • responseBody is your receiver's own reply, truncated to 2048 bytes before storage.
POST/webhooks/deliveries/:deliveryId/redeliverappcenter:service

Replay a stored payload to its receiver. The replay is a new delivery, with a new id.

Parameters

deliveryIdstring · uuidrequired
The id of the delivery to replay.
200 OK
{
  "success": true,
  "data": {
    "delivery": {
      "id": "a72c4b19-2f55-4d6e-8c17-90b1e5f2aa38",
      "webhookId": 17,
      "event": "user.updated",
      "status": "pending",
      "attempts": 0,
      "responseStatus": null,
      "responseBody": null,
      "error": null,
      "deliveredAt": null,
      "createdAt": "2026-11-08T11:02:44.000Z"
    }
  }
}

id differs from the delivery you replayed — deduplicate on it, not on the payload contents.

Failures to handle

404NOT_FOUND
The delivery does not exist, or belongs to another application.
422VALIDATION_FAILED
deliveryId is not a uuid.

The request

Content-Type
Valueapplication/json
User-Agent
ValueAppCenter-Webhooks/1
X-AppCenter-Event
ValueThe event name you subscribed to
X-AppCenter-Delivery
ValueDelivery uuid, also body.id, and the token's jti. Deduplicate on this
X-AppCenter-Signature
Valuev2= followed by an RS256 JWT whose body_sha256 covers the raw body

Verify the token

The signature is a JWT minted per attempt by the platform's identity provider, signed with the same keys that sign access tokens. Verify it against <issuer>/jwks; there is no shared secret to provision or rotate. Three claims bind it to the delivery: jti must equal X-AppCenter-Delivery, evt must equal X-AppCenter-Event, and body_sha256 must equal the base64url SHA-256 of the raw body. exp is five minutes after the attempt, so a retry carries a fresh token rather than a stale one.

receiver.ts
import { createHash } from "node:crypto";
import { createRemoteJWKSet, jwtVerify } from "jose";

const ISSUER = process.env.APPCENTER_ISSUER!; // https://api.example.com/oidc
const jwks = createRemoteJWKSet(new URL(`${ISSUER}/jwks`));

export async function POST(request: Request) {
  // The token binds the bytes on the wire, so read the raw body first.
  const rawBody = await request.text();
  const signature = request.headers.get("x-appcenter-signature") ?? "";

  let payload: Record<string, any>;
  try {
    ({ payload } = await jwtVerify(signature.replace(/^v2=/, ""), jwks, {
      issuer: ISSUER,
      algorithms: ["RS256"],
    }));
  } catch {
    return new Response("bad signature", { status: 401 });
  }

  if (payload.jti !== request.headers.get("x-appcenter-delivery")) {
    return new Response("wrong delivery", { status: 401 });
  }

  const digest = createHash("sha256")
    .update(rawBody, "utf8")
    .digest("base64url");

  if (payload.body_sha256 !== digest) {
    return new Response("body mismatch", { status: 401 });
  }

  // Acknowledge first, work afterwards.
  const body = JSON.parse(rawBody);
  void enqueue(body);
  return new Response(null, { status: 204 });
}

Digest the raw bytes, not the parsed object

Re-serialising the payload changes the bytes, so the digest can never match. If your framework parses JSON before your handler runs, capture the raw bytes in a middleware or use a body parser that preserves them.

The payload

Every delivery is one envelope: id, event, occurredAt, the application that produced it, and a data object whose inner shape depends on the event. The envelope is frozen when the delivery row is created, so a retry replays the same bytes — that is what makes the signature verifiable and the payload safe to deduplicate.

user.updated
{
  "id": "5e1b0f0e-8a0a-4b2b-9f00-1c2c7a3e9d41",
  "event": "user.updated",
  "occurredAt": "2026-11-08T10:14:02.000Z",
  "app": { "id": 3, "shortCode": "VPOS" },
  "data": {
    "user": {
      "useruuid": "0d5a…",
      "email": "ama@example.com",
      "firstname": "Ama",
      "lastname": "Mensah",
      "profileimage": "https://cdn.versified.com.gh/a/0d5a….jpg"
    }
  }
}
business.updated
{
  "id": "0c8f2a51-3d77-4a19-b5e2-71f0c9d84b06",
  "event": "business.updated",
  "occurredAt": "2026-11-08T10:19:44.000Z",
  "app": { "id": 3, "shortCode": "VPOS" },
  "data": {
    "accountUuid": "7f31…",
    "business": {
      "name": "Ama's Mart",
      "email": "hello@amasmart.gh",
      "phone": "+233 24 000 0000",
      "address": "12 Oxford Street, Osu, Accra",
      "profileImage": "https://cdn.versified.com.gh/b/7f31….png"
    }
  }
}
subscription.created — also renewed, plan_changed, cancelled, expired
{
  "id": "8b41d2c6-6e0a-4f31-9a4d-2f5c1b7e8033",
  "event": "subscription.created",
  "occurredAt": "2026-11-08T09:00:00.000Z",
  "app": { "id": 3, "shortCode": "VPOS" },
  "data": {
    "subscription": {
      "id": 412,
      "planCode": null,
      "accessTier": "pro",
      "planId": 6,
      "startDate": "2026-11-08T00:00:00.000Z",
      "endDate": "2026-12-08T00:00:00.000Z"
    }
  }
}
app.published — also app.updated, app.archived
{
  "id": "19f7c0be-52a1-4c8e-8d0c-6a3b9e14f7d2",
  "event": "app.published",
  "occurredAt": "2026-11-08T08:42:10.000Z",
  "app": { "id": 3, "shortCode": "VPOS" },
  "data": {
    "application": {
      "id": 3,
      "shortCode": "VPOS",
      "name": "Retill",
      "status": "published",
      "version": 12
    }
  }
}
ping
{
  "id": "5e1b0f0e-8a0a-4b2b-9f00-1c2c7a3e9d41",
  "event": "ping",
  "occurredAt": "2026-11-08T10:40:12.000Z",
  "app": { "id": 3, "shortCode": "VPOS" },
  "data": { "message": "App Center webhook test delivery" }
}

The event payload is thinner than the REST read

A subscription.* event carries planId, the legacy accessTier label and the dates — planCode is always null. Read GET /app/subscriptions/:accountUuid when you need plan identity by code; treat the event as the trigger, not the record.

The event catalogue

user.updated
Fires whenA person's name, email or avatar changed — including a change made in another application
`data` carriesuser
business.updated
Fires whenAn account owner's business profile or logo changed
`data` carriesaccountUuid, business (nullable)
subscription.created
Fires whenA plan was bought for this application
`data` carriessubscription
subscription.renewed
Fires whenA period rolled over without a plan change
`data` carriessubscription
subscription.plan_changed
Fires whenThe account moved to a different plan
`data` carriessubscription
subscription.cancelled
Fires whenAuto-renewal was stopped; the period still runs to endDate
`data` carriessubscription
subscription.expired
Fires whenendDate passed without a renewal
`data` carriessubscription
app.updated
Fires whenThe catalogue record changed — name, presentation, status
`data` carriesapplication
app.published
Fires whenThe application became visible in the catalogue
`data` carriesapplication
app.archived
Fires whenThe application was withdrawn from the catalogue
`data` carriesapplication
ping
Fires whenOnly from POST /webhooks/:webhookId/test. Not subscribable, but a * registration receives it
`data` carriesmessage
*
Fires whenNot an event — the subscription entry that means "all of the above"
`data` carries—

Who receives which event

  • user.updated and business.updated fan out to every application the person holds a subscription with — not just the one that changed.
  • A subscription.* event goes only to the application the subscription belongs to, whether or not that application registered a receiver.
  • app.* events concern the catalogue record itself and go to the application they describe.
  • No registration means no delivery. A missed event is recovered by pulling, never by re-pushing.

Retries

Request timeout
Value10 seconds; redirects are not followed
Success
ValueAny 2xx. A 3xx is a failure
Attempts
Value7 total, first retry after 60 s, exponential backoff capped at 6 h
After that
ValueThe delivery is marked exhausted
Failure tracking
ValueconsecutiveFailures, lastFailureAt, lastSuccessAt — surfaced, never actioned

App Center does not disable a failing webhook. Ten consecutive failures still gets attempt eleven, which means a permanently dead receiver looks like a health problem rather than a switch. Answer fast and do the work asynchronously — a handler that takes longer than 10 seconds will be retried even though it succeeded.

Idempotency

  • Deduplicate on X-AppCenter-Delivery (equal to body.id), with a TTL of a few days.
  • A retry keeps the same delivery id; a redelivery of old data gets a new one because it is a new event.
  • Ordering is not guaranteed between different events. Compare occurredAt and ignore a payload older than what you already hold.
  • Acknowledge before you process. If processing fails after the acknowledgement, reconcile by pulling.

Reconciliation

  1. 1

    Compare in batches

    Read GET /users?uuids=… or ?emails=… in batches of up to 100 and diff against your local rows.

  2. 2

    Re-read what you are unsure about

    GET /subscriptions/:accountUuid resolves any doubt about entitlement.

  3. 3

    Replay rather than re-push

    POST /webhooks/deliveries/:deliveryId/redeliver is the supported way to re-run one payload. Nothing re-pushes state on boot.

Local development

With SKIP_JOB_QUEUE=true App Center records the delivery row and logs a warning instead of starting a worker, so it stays pending forever. That is expected — start the queue, or call /webhooks/:id/test against a running worker.

Something here out of date or unclear?

The platform team answers integration questions directly.

support@versified.com.gh
32 pages in this documentation