Track conversion from chat to paid
Attribute paid revenue to the chats that influenced it, using the real goals mechanism: a URL condition, matched automatically against pages the visitor loads after chatting. There is no per-conversion attribution API call to make; the redirect URL from your checkout does the work.
There is no endpoint to POST a conversion against a specific conversation ID, and no conversation:started-to-checkout-metadata flow needed. Goals match by URL, automatically, deduplicated per visitor. Design your checkout's success redirect around that instead.
1. Create a goal matching your success URL
One-time setup, not per checkout.
// There is no per-conversion attribution endpoint. Goals work by URL
// match, automatically, against pages the visitor loads after chatting.
// Set this up once, not per checkout.
curl -X POST 'https://app.message.com/api/v1/goals' \
-H 'Authorization: Bearer YOUR_WORKSPACE_JWT' \
-H 'Content-Type: application/json' \
-d '{
"name": "Checkout success",
"condition": { "operator": "contains", "value": "/checkout/success" },
"valueCents": null
}'2. Redirect to that URL on successful payment
For Stripe, set success_url on the Checkout Session to a page matching the goal's condition. For Shopify, use the order status page or a custom thank-you page. For your own billing, redirect there after the charge succeeds.
// Server-side: redirect the browser back to a URL that matches the
// goal's condition on successful payment. That page load is what
// message.com's automatic goal matching sees, not the webhook.
const session = await stripe.checkout.sessions.create({
mode: "subscription",
line_items: [...],
success_url: "https://your-site.com/checkout/success?session_id={CHECKOUT_SESSION_ID}",
});message.com's widget tracks page views for any visitor it has seen; when that visitor's browser loads the matching URL, the goal fires automatically and is attributed to the visitor (and, where resolvable, the agent) without any extra call from you.
3. Read completions
Per-goal completions, with attribution:
curl 'https://app.message.com/api/v1/goals/:id/completions?range=30d' \
-H 'Authorization: Bearer YOUR_WORKSPACE_JWT'For revenue across all goals, see the Reports API's conversions endpoints.
Attributing a dollar amount
A goal's valueCents is a fixed amount applied to every completion (e.g., a flat $49 per signup), not a variable per-transaction amount. If your checkout amounts vary, the goal system will tell you that a conversion happened, not how much it was worth; join that separately from your billing provider's own records using the visitor's email.
Common pitfalls
- Looking for a per-conversion attribution endpoint. There isn't one. Set up the URL-matching goal once; completions happen automatically.
- Expecting variable revenue amounts per completion. A goal's value is fixed, not per-transaction. Reconcile actual amounts against your billing provider separately.
- A success URL that is also reachable another way. If a marketing campaign links straight to
/checkout/success, your goal over-counts. Keep the URL unique to real completions.