coupon.updated

A coupon's terms changed, with a field-by-field list of what moved.

Ability to subscribeproject-coupon:view

When this fires

A creator changed a coupon's terms: its code, name, discount, caps, minimum, or window. Fires once per update through the REST API.

The dedicated activate and deactivate endpoints emit coupon.activated / coupon.deactivated rather than this event. An update that includes active is still an update, and emits coupon.updated with active in its changes, so handle active appearing in changes as well as subscribing to the flip events.

Editing terms is dashboard and API only. The bot can create, inspect, switch off and delete a coupon, but not edit its terms; a multi-field edit is a form, not a chat. Dashboard edits do not currently emit this event (the dashboard writes through the service layer directly), so this event originates from the REST API.

changes only contains keys whose value differs. A save that changed nothing sends "changes": {}; the event still fires, because the creator did press save.

Caveats

  • changes compares the snapshot, not the database columns. It covers exactly the keys in data.coupon, so a change to the coupon's plan restriction does not appear; that lives in a separate relation the snapshot deliberately omits. Re-read the coupon endpoint if you track which plans a code covers.
  • from and to keep their original types. A decimal field gives you decimal strings, an integer field integers, a nullable field null. Don't assume both sides are strings.
  • Changing the code does not migrate past redemptions. Redemptions already recorded stay attached to the coupon by id, so a renamed code keeps its history, but any subscriber who wrote the old string down now has a dead code.
  • A change is not retroactive. Subscribers who already redeemed keep the terms they paid under; a reduced discount only affects checkouts from here on.

Related events

  • coupon.created: the same snapshot shape, on authoring.
  • coupon.activated / coupon.deactivated: the on/off flip this event deliberately excludes.

Header Parameters

SB-Signature*string

t=<unix seconds>,v1=<hex>: the HMAC-SHA256 of "<t>.<raw body>" under the endpoint's secret. Verify it before acting, and refuse a t more than 300 seconds from now. During a secret rotation a v0= signature under the previous secret may precede v1=.

SB-Event-Id*string

The event's ULID, bare. The envelope's id is the same ULID prefixed evt_, so strip the prefix before comparing. Deduplicate on it: a retry carries the same id.

SB-Event-Name*string

The event name, the same as the envelope's type.

Content-Type*string

Always application/json.

User-Agent*string

Always Subscriby-Webhooks/1.0.

Request Body

application/json

The signed JSON envelope posted to your endpoint.

TypeScript Definitions

Use the request body type in TypeScript.

The envelope every event is delivered in.

Response Body

Example Requests

POST/coupon.updated

How is this guide?