Skip to content

session_started & session_closed

The session_started and session_closed events track the lifecycle of customer conversation sessions in the WhatsApp Inbox on the Mahadata platform. Each event is delivered as a flat JSON object.

POST {your_webhook_url}
{
"event": "session_started",
"timestamp": "2026-11-16T08:00:00+00:00",
"conversation_id": "7f6e5d4c-3b2a-1908-8765-4321fedcba98",
"channel_type": "whatsapp",
"contact": "6281234567890",
"reason": "new",
"agent_id": null,
"team_id": "8a9b0c1d-2e3f-4a5b-8c9d-0e1f2a3b4c5d"
}
POST {your_webhook_url}
{
"event": "session_closed",
"timestamp": "2026-11-16T09:00:00+00:00",
"conversation_id": "7f6e5d4c-3b2a-1908-8765-4321fedcba98",
"channel_type": "whatsapp",
"contact": "6281234567890",
"reason": "resolved",
"closed_by": "2c8d4a10-5e1b-4c3a-9f00-112233445566",
"agent_id": "2c8d4a10-5e1b-4c3a-9f00-112233445566",
"team_id": "8a9b0c1d-2e3f-4a5b-8c9d-0e1f2a3b4c5d"
}
FieldTypeDescription
eventstring"session_started" or "session_closed"
timestampstringEvent timestamp in RFC 3339 format (e.g. "2026-11-16T08:00:00+00:00")
conversation_idstringInbox conversation UUID
channel_typestringChannel type ("whatsapp")
contactstring | nullCustomer phone number, or null if unavailable
reasonstring"new" or "reopened" on session_started; "resolved", "auto_resolved", or "bulk_resolved" on session_closed
closed_bystring | nullPresent only on session_closed: UUID of the user who resolved the conversation for "resolved", or null for "auto_resolved" and "bulk_resolved"
agent_idstring | nullUUID of the agent currently assigned to the conversation (null if unassigned)
team_idstring | nullUUID of the inbox team assigned to the conversation (null if unassigned)
  • session_started: Sent when an inbound message from a WhatsApp customer creates a new conversation (reason: "new") or reopens a resolved conversation within the 24-hour window (reason: "reopened").
  • session_closed: Sent when a WhatsApp conversation transitions to resolved via single-conversation resolve (resolved), bulk resolve (bulk_resolved), or the Auto-Resolve timer (auto_resolved).
  • Emitted for 1-on-1 WhatsApp conversations associated with a WhatsApp sender number (phone_number_id).
  • Not emitted for: conversations opened by outbound sends (before the customer replies), conversation merges, channel-disconnect closures, group inbox threads, webchat closures, or non-WhatsApp channels (such as RCS or Email).