Skip to content

Analytics & automations

Pull messaging metrics into your own reports, and trigger dashboard automations from events in your systems.

Endpoints

Analytics

Query parameters
  • fromdateoptional
    YYYY-MM-DD. Defaults to 14 days ago.
  • todateoptional
    YYYY-MM-DD. Defaults to today. Ranges can span up to 366 days.
  • phone_number_iduuidoptional
    Only this number.
GET /v1/analytics/overview
{
  "range": { "from": "2026-11-01", "to": "2026-11-14" },
  "totals": { "sent": 61240, "delivered": 59312, "read": 41870, "failed": 1928, "inbound": 8403, "conversations": 5120 },
  "rates": { "delivery": 96.9, "read": 68.4, "failure": 3.1 },
  "series": [
    { "day": "2026-11-01", "sent": 4210, "delivered": 4102, "read": 2980, "failed": 108, "inbound": 611 }
  ],
  "costs": {
    "currency": "INR",
    "total": 21480.35,
    "by_category": { "marketing": { "count": 22100, "amount": 19224.79 }, "utility": { "count": 18120, "amount": 2255.56 } },
    "note": "Estimated from Meta's published rates; Meta bills your WhatsApp account directly."
  }
}

Rates are percentages. /v1/analytics/errors returns { "data": [{ code, title, detail, count }] } for failed messages in the range.

Automation events

Automations built in the dashboard can start from an API event trigger. Post an event — an order shipped, a payment failed — and every enabled automation with that trigger runs for the contact.

POST /v1/automations/events → 202
{
  "event": "order_shipped",
  "phone": "+14155550101",
  "data": { "order_id": "48213", "eta": "Saturday" }
}
Body parameters
  • eventstringrequired
    Your event name, 1–64 characters.
  • contact_iduuidoptional
    The contact. Or identify them by phone.
  • phonestringoptional
    The contact's phone number, if you don't have the contact id.
  • dataobjectoptional
    Anything the automation should be able to use.

Keys with messages:send can post events too. The response says how many automations were triggered.

Something unclear or missing on this page? Tell us at contact@swastik.ai