Events, automations & conversions
What happens on a website is an event. Three ways to react to it: an automation, a signed webhook to your server, or a conversion for your ad platforms.
Get your API keyThree ways to react
| Use | When | API |
|---|---|---|
| Automation | Run an action on the event: call a URL or send an email of the website | …/automations/ (MCP escalateflow_automations_*) |
| Outgoing webhook | Your server receives every event you subscribe to, signed and retried | …/webhooks/ (MCP escalateflow_webhook_*) |
| Conversion goal | Tell your ad platforms (Meta, Google, TikTok, LinkedIn…) that a lead, a purchase or a trial happened | …/conversion-goals/ and …/ad-platforms/ (MCP escalateflow_goal_*) |
Form submissions have their own actions (…/forms/{form_id}/actions/, see Forms). Paths are under /api/v1/projects/{project_id}/.
The events
Every event a webhook can subscribe to (live list: GET /api/v1/webhooks/events/). This table comes from the code, so it is always the current one.
| Event | Meaning |
|---|---|
form_submission | Fired when a new form submission is received |
page_view | Fired when a page is viewed |
conversion | Fired when a conversion is recorded |
order.created | A customer placed an order (bank transfer or card, before payment) |
order.paid | An order was paid (card payment confirmed or marked paid) |
order.shipped | An order was marked shipped (tracking number / carrier / tracking_url in the payload) |
order.delivered | An order was marked delivered |
order.cancelled | An order was cancelled (by the shop, or an unpaid card checkout expired) |
order.refunded | An order was refunded |
order.edited | An order was edited (lines, quantities or shipping; new totals and balance_due / refund_due in the payload) |
checkout.abandoned | The recovery email of an abandoned checkout was sent (payload {checkout: {..., recovery_url}}) |
return.requested | A customer requested a return (or the shop created one) |
return.approved | A return was approved |
return.declined | A return was declined |
return.received | The returned items were received (stock back when restocked) |
return.refunded | A return was refunded |
subscription.created | A subscription was created (with or without a trial) |
subscription.trial_started | A subscription started its trial with a card on file |
subscription.trial_ending_3d | A trial ends in 3 days |
subscription.converted | First real charge after the trial (charge.amount / currency in the payload) |
subscription.renewed | A later recurring charge was paid |
subscription.payment_failed | A subscription charge failed |
subscription.cancelled | A subscription was cancelled (subscription.cancel_at_period_end tells whether it runs until the period ends) |
payment.succeeded | A card charge went through (an order, or a subscription invoice with money) |
payment.failed | A charge was declined (payment.failure has the code and decline code) |
payment.refunded | A refund, full or partial (one event per refund; payment.refund has its amount) |
payment.dispute_opened | A chargeback was opened (payment.dispute) |
payment.dispute_closed | A chargeback was closed (payment.dispute.outcome: won, lost or warning_closed) |
Automations accept these triggers, the ones something in the platform emits today (live list: GET /api/v1/automations/triggers/). Any other name answers 400.
order.paid, order.shipped, order.delivered, order.cancelled, order.refunded, cart.abandoned_1h, subscription.created, subscription.trial_started, subscription.trial_ending_3d, subscription.converted, subscription.renewed, subscription.payment_failed, subscription.cancelled, payment.succeeded, payment.failed, payment.refunded, payment.dispute_opened, payment.dispute_closed, user.registered, page.published
Payloads
Every event is JSON with event, timestamp and project_id, plus the object it is about.
order.*:order, the same fields as the orders API plus its lines.return.*:returnandorder.subscription.*:subscription, pluschargewhen money moved.payment.*:payment,customerandsource.
Once each. The shop events born from Stripe's notifications (subscription.*, payment.*) are delivered once per movement, even when Stripe repeats a notification. A charge reached through both checkout.session.completed and payment_intent.succeeded is one payment.succeeded.
payment.* (every movement of money)
{
"event": "payment.refunded",
"timestamp": "2026-11-20T10:00:00+00:00",
"project_id": "uuid",
"payment": {
"id": "ch_…", "payment_intent": "pi_…", "status": "partially_refunded",
"amount": "49.00", "amount_minor": 4900, "currency": "EUR",
"fee_minor": 166, "net_minor": 4734, "amount_refunded_minor": 1000,
"method": {"type": "card", "brand": "visa", "last4": "4242"}, "livemode": true,
"refund": {"id": "re_…", "amount": "10.00", "amount_minor": 1000, "reason": "requested_by_customer"}
},
"customer": {"id": "uuid or null", "email": "[email protected]", "name": "Ana", "stripe_customer_id": "cus_…"},
"source": {"type": "order", "id": "uuid", "number": "EF-1042"}
}payment.succeeded: a card charge went through. That is an order, or a subscription invoice with money; a trial's 0 invoice does not count.payment.failed: a declined charge, withfailure={code, decline_code, message}. One event per failed charge or attempt. A declined attempt on Stripe Checkout, before the order exists, hassource.type: "checkout"and theproduct_id.payment.refunded: one event per refund; partial refunds count.payment.dispute_opened/payment.dispute_closed: a chargeback.dispute.outcomeiswon,lostorwarning_closed.
source.type is order, subscription (with stripe_subscription_id, product_id and invoice) or checkout. fee_minor and net_minor are null when Stripe does not have them yet. They complement order.paid and subscription.*; they do not replace them.
subscription.* (the life of a shop subscription)
{
"event": "subscription.converted",
"subscription": {
"id": "uuid", "stripe_subscription_id": "sub_…", "status": "active",
"customer": {"id": "uuid", "email": "…", "name": "…", "stripe_customer_id": "cus_…"},
"product": {"id": "uuid", "name": "Plan Pro"}, "amount": "9.00", "currency": "EUR", "interval": "month",
"trial_end": "…", "current_period_start": "…", "current_period_end": "…",
"cancelled_at": null, "cancel_at_period_end": false
},
"charge": {"invoice_id": "in_…", "amount": "9.00", "amount_minor": 900, "currency": "EUR", "billing_reason": "subscription_cycle"}
}The events in order:
subscription.created.subscription.trial_started: only with a card on file.subscription.trial_ending_3d.subscription.converted: the first real charge after the trial.subscription.renewed: every later charge.subscription.payment_failed: one per attempt.subscription.cancelled:cancel_at_period_endtells whether it runs until the paid period ends.
Shops: the Stripe events to subscribe
A shop connects its own Stripe account. In its Stripe dashboard, its webhook endpoint (https://<platform host>/api/v1/stripe/webhook/) must be subscribed to these events. An event Stripe does not send produces nothing:
checkout.session.completed, checkout.session.expired, payment_intent.succeeded, payment_intent.payment_failed, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, customer.subscription.trial_will_end, invoice.paid, invoice.payment_failed, charge.refunded, charge.dispute.created, charge.dispute.closed
For example:
- without
customer.subscription.trial_will_endthere is nosubscription.trial_ending_3d; - without
charge.dispute.*there is nopayment.dispute_*.
Automations
/api/v1/projects/{project_id}/automations/{
"name": "Tell the ERP about refunds",
"trigger_type": "payment.refunded",
"action_type": "webhook",
"config": {"url": "https://erp.example.com/hooks/refunds", "headers": {"Authorization": "Bearer …"}},
"delay_seconds": 0,
"is_active": true
}- Actions:
action_typeiswebhookorhttp_request(config.url, optionalconfig.headers), oremail(config.smtp_idandconfig.template_idof the website). - Other options:
delay_secondswaits before running,timeoutis 1–60 s,max_retriesis 0–10. - URLs: must be public http(s).
Also:
POST …/automations/{id}/test/runs it once with a sample event;GET …/automations/{id}/logs/shows each run with the status code of your endpoint;PUTchanges only the fields you send;DELETEremoves it;- an automation only runs for events of its own website.
Outgoing webhooks
/api/v1/projects/{project_id}/webhooks/{"name": "Payments to my server", "url": "https://example.com/ef-hooks",
"events": ["payment.succeeded", "payment.refunded", "payment.dispute_opened"], "secret": "a-long-random-string"}Each delivery is a POST of the event JSON. Failed deliveries are retried 5 times, after 1 min, 5 min, 15 min, 1 h and 2 h. GET …/webhooks/{id}/deliveries/ shows them, and POST …/webhooks/{id}/test/ sends a test. More on Webhooks.
Verify the signature (when the webhook has a secret):
X-EscalateFlow-Signature: sha256=<hex>is the HMAC-SHA256, with the secret, of"{timestamp}.{raw body}".- The timestamp comes in
X-EscalateFlow-Timestamp; reject old ones to stop replays. - The other headers are
X-EscalateFlow-EventandX-EscalateFlow-Delivery.
ts = request.headers["X-EscalateFlow-Timestamp"]
expected = "sha256=" + hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest()
assert hmac.compare_digest(expected, request.headers["X-EscalateFlow-Signature"])Conversions (Meta, Google, TikTok, LinkedIn…)
- Connect the ad platforms with
POST …/ad-platforms/. For Meta that is the pixel and the Conversions API token. - Create a conversion goal with
POST …/conversion-goals/:name,trigger_type,trigger_config,event_type(the standard event:lead,purchase,start_trial,subscribe…) and the destinations.
The trigger types the API accepts:
form_submit, page_view, button_click, appointment_booked, appointment_completed, purchase, subscription.trial_started, subscription.converted, custom
Shop subscriptions:
- A goal on
subscription.trial_startedwithevent_type: "start_trial"sends MetaStartTrialwhen a subscription starts its trial with a card. - A goal on
subscription.convertedwithevent_type: "subscribe"sends MetaSubscribe, with the amount charged, at the first real charge after the trial.
Both go out once per subscription, with the buyer's email hashed and the _fbc/_fbp the browser had at checkout, so the ad click is attributed. A website without such a goal sends them to every active connection of its account. A running A/B test with a card_trial goal counts that trial for the visitor's variant.
payment.* events are not sent as conversions: the purchase already goes with the purchase goal. Sending it twice would count it twice.
GET …/conversion-logs/ shows what was sent and what the platform answered. EscalateFlow's own Meta pixel only runs on EscalateFlow's own sites, never on customer websites, which use their own connections.