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 key

Three ways to react

UseWhenAPI
AutomationRun an action on the event: call a URL or send an email of the website…/automations/ (MCP escalateflow_automations_*)
Outgoing webhookYour server receives every event you subscribe to, signed and retried…/webhooks/ (MCP escalateflow_webhook_*)
Conversion goalTell 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.

EventMeaning
form_submissionFired when a new form submission is received
page_viewFired when a page is viewed
conversionFired when a conversion is recorded
order.createdA customer placed an order (bank transfer or card, before payment)
order.paidAn order was paid (card payment confirmed or marked paid)
order.shippedAn order was marked shipped (tracking number / carrier / tracking_url in the payload)
order.deliveredAn order was marked delivered
order.cancelledAn order was cancelled (by the shop, or an unpaid card checkout expired)
order.refundedAn order was refunded
order.editedAn order was edited (lines, quantities or shipping; new totals and balance_due / refund_due in the payload)
checkout.abandonedThe recovery email of an abandoned checkout was sent (payload {checkout: {..., recovery_url}})
return.requestedA customer requested a return (or the shop created one)
return.approvedA return was approved
return.declinedA return was declined
return.receivedThe returned items were received (stock back when restocked)
return.refundedA return was refunded
subscription.createdA subscription was created (with or without a trial)
subscription.trial_startedA subscription started its trial with a card on file
subscription.trial_ending_3dA trial ends in 3 days
subscription.convertedFirst real charge after the trial (charge.amount / currency in the payload)
subscription.renewedA later recurring charge was paid
subscription.payment_failedA subscription charge failed
subscription.cancelledA subscription was cancelled (subscription.cancel_at_period_end tells whether it runs until the period ends)
payment.succeededA card charge went through (an order, or a subscription invoice with money)
payment.failedA charge was declined (payment.failure has the code and decline code)
payment.refundedA refund, full or partial (one event per refund; payment.refund has its amount)
payment.dispute_openedA chargeback was opened (payment.dispute)
payment.dispute_closedA 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.*: return and order.
  • subscription.*: subscription, plus charge when money moved.
  • payment.*: payment, customer and source.

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, with failure = {code, decline_code, message}. One event per failed charge or attempt. A declined attempt on Stripe Checkout, before the order exists, has source.type: "checkout" and the product_id.
  • payment.refunded: one event per refund; partial refunds count.
  • payment.dispute_opened / payment.dispute_closed: a chargeback. dispute.outcome is won, lost or warning_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_end tells 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_end there is no subscription.trial_ending_3d;
  • without charge.dispute.* there is no payment.dispute_*.

Automations

GETPOST/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_type is webhook or http_request (config.url, optional config.headers), or email (config.smtp_id and config.template_id of the website).
  • Other options: delay_seconds waits before running, timeout is 1–60 s, max_retries is 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;
  • PUT changes only the fields you send;
  • DELETE removes it;
  • an automation only runs for events of its own website.

Outgoing webhooks

GETPOST/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-Event and X-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…)

  1. Connect the ad platforms with POST …/ad-platforms/. For Meta that is the pixel and the Conversions API token.
  2. 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_started with event_type: "start_trial" sends Meta StartTrial when a subscription starts its trial with a card.
  • A goal on subscription.converted with event_type: "subscribe" sends Meta Subscribe, 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.