Skip to main content
Widgetic tells you what happens to your partner account: an invoice, a payment, credits running low, a pause or a stop. The same event reaches you in up to three places, and what you see in each one is the same facts:
  • Email, to the addresses you choose.
  • Your dashboard, as a list (see Partner Dashboard). The API returns the same list.
  • Your own system, as a signed POST to an address you set (a webhook), so that your code can act on it: mark an invoice paid, warn your team that credits are low.

The Events

Money and the standing of your account are never silent: the events marked Always are emailed whatever you choose, and you can narrow only what your own system receives. The ten events about your managed users are for your webhook only. They are not emailed and not in the dashboard list, so a busy account is not flooded. Each event is told once. An invoice that Stripe reports twice, or a reminder that is checked again, does not reach you twice. Two events about your managed users are told sparingly, so that one busy customer does not flood your system:
  • composition.updated is told for the first save of a composition in each five minutes, so one composition is told at most 12 times an hour, whatever the number of saves. It does not carry the content: read the composition for its current state. Changing only the status of a composition is not a save.
  • credits.managed_user_cap_reached is told once for each customer each month. It is told again in the same month only if you change the customer’s cap and the customer reaches the new one. The request that was refused is still refused, with the same 402, whether or not you have a webhook. If you set your address after a customer reached its cap, you may not be told about that customer until next month.
The four workflow events are about the workflows your customers make, with the Workflows screen in an editor session or with your key and their header. A workflow you make yourself, in your own account, is not told, and neither is a save or a read. Each one is told when it happens and carries no graph: read the workflow for what it holds now. A deleted workflow can no longer be read, so workflow.deleted says which one it was and the state it was in. Widgetic adds events from time to time. Ignore an event type your code does not know: answer 2xx and drop it.

What Each Event Carries

Every notification has a title (one line), a body (a few sentences that say what happened and what to do about it), a tone (info, success, warning or error) and its facts in data, named in camelCase.

Read Your Notifications

GET /partners/{partnerId}/notifications lists them, the newest first. A page holds limit notifications (20 by default, at most 100). When there are older ones, nextBefore is set: ask again with it as before.
Reading needs the partner:read scope when your key is limited to some scopes (see Authentication).

Choose Where They Go

GET /partners/{partnerId}/notifications/settings returns where your notifications go now, and events, every kind of event there is, for a settings screen. PUT on the same address changes it. A key you leave out of the body stays as it was, so send only what changes.
Changing the settings needs an API key with full access, because they decide where your notifications go. Reading them does not.

Your Own Webhook

Set webhookUrl and Widgetic sends a signed POST for each event you subscribed to. The address must be https on the standard port, on a public site, and it must not redirect. The first time you set an address, Widgetic makes a signing secret and the answer carries it as webhookSecret. It is shown once, so keep it now. It looks like whsec_..., and it cannot be read again.
(The answer also holds the other settings. This one shows only what matters here.)

What a call looks like

The body is JSON: { "id", "type", "createdAt", "partnerId", "data" }, where data is the data of the notification.
The headers are the ones of the Standard Webhooks scheme, so any of its libraries verifies a call. Widgetic adds x-widgetic-event (the event type) and a user-agent of WidgeticPartnerEvents/1.0.

Verify it

Check every call before you trust it, and refuse a webhook-timestamp that is more than five minutes old. Take your secret without the whsec_ prefix and decode it from base64: those bytes are the key. Sign the raw body, exactly as it arrived, and not a copy that your framework parsed and wrote out again.
Here it is in a receiver. It keeps the body as it arrived, verifies it, drops an event it has already handled, and answers quickly:

Answer and retries

Answer with a 2xx within ten seconds. Anything else, and no answer, is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and a day: eight attempts in all, over about two days. Your address is read again at each attempt, so a receiver you mend in the meantime still gets the event. Two answers end the delivery at once: 410 Gone and 413 Payload Too Large. Delivery is at least once. If your answer is lost, the same event arrives again with the same id. An event is never lost to a slow receiver, but your code has to be able to meet it twice. An email counts as delivered when it was handed to the mail service. A webhook call counts as delivered when your endpoint answered 2xx.

Rotate the secret

POST /partners/{partnerId}/notifications/webhook-secret makes a new secret and returns it once as webhookSecret. Use it when the secret was lost or may have leaked. The old secret keeps signing for a day, next to the new one, so that your receiver can switch without a call being rejected: for that day each call carries two signatures, and the code above accepts either. Rotating again within the day ends the overlap with the first secret. Send an Idempotency-Key with it, and retry with the same key if the answer was lost: you get the same answer, secret included, and no second secret is made. The call needs an API key with full access.

See What Was Sent

GET /partners/{partnerId}/notifications/deliveries lists the sends of your notifications, the newest first: each email to one address and each call to your webhook. It tells you whether it was delivered, when it is tried again, how many attempts it had, the HTTP status your webhook answered with, and why the last attempt failed. Use it to find out why an event did not reach you.
status is pending, delivered, failed or cancelled. target is the address of an email, or only the host of your webhook, because the whole address may hold a token. lastError is a few words from Widgetic, never what your endpoint replied. To send one webhook delivery again, for example after you fixed your receiver, call POST /partners/{partnerId}/notifications/deliveries/{deliveryId}/replay. It sends the event to your current address with the same webhook-id as the original, so a receiver that remembers ids can ignore a duplicate, with a new createdAt and a signature made with your current secret. The attempt is recorded as a new row that points at the delivery you replayed. A handful of replays a minute is enough for this, and more are refused with 429. It needs an API key with full access.

Errors

Credits & Billing

How invoices, tax and reminders work

Account Status

Activation, pauses, unpaid invoices and what each one stops