POST. The event key holds the event name, which also travels in the X-Webhook-Event header, and occurred_at holds the time of the event.
NewLead ignores the body of your response. Payloads can include keys that are not listed here: ignore the ones you do not recognize.
Events never fire for test leads or for test calls made from the dashboard.
Event types
call.started
direction is inbound, outbound or web.
call.rejected
end_reason says why, for example rejected_balance or rejected_plan. The list can grow.
call.ended
The text agent of the call’s lead.
null if the call has no lead or the lead belongs to a voice agent with no text agent.null when recording_available is false. Otherwise, request it with a key from the subaccount: GET /v1/calls/{call_id}/recording redirects (302) to a signed link that is valid for one hour. Send the key in Authorization: Bearer, which is not forwarded when your client follows the redirect.false does not guarantee that the call has no recording. The recording can arrive just after this event, which is not sent again. To check, use GET /v1/calls/{call_id}.What was said, in order.
role is agent or user. GET /v1/calls/{call_id} calls the same speaker lead.call.analyzed
variables holds every extracted variable with its confidence, from 0 to 1. lead_id is null if the call has no lead, and text_agent_id follows the same rule as in call.ended.
This event is not sent if the agent declares no variables, if the call has no transcript or if the analysis fails. To know that a call finished, use call.ended.
lead.created
Fires once per lead, on any channel: WhatsApp, Instagram, web chat, a call, a Lead Ads form, an email, the API or a template sent to a new phone. It also fires when a conversation closes and the same person starts another one, with a new lead and the same contact_id.
lead.qualified
Fires when the lead answers the last required question and that answer does not disqualify them. It fires again only if the team reopens the qualification and the lead completes it again.
lead.appointment_booked
Fires once per appointment the agent books, in a chat or a call.
appointment.event_id is the ID of the calendar event. timezone is the IANA time zone of the agent. location and meet_link can be null.
lead.handoff
Fires once per notice the agent sends to the team.
follow_up.sent
Fires when a follow-up message goes out to the lead.
phone_number has no leading +. lead.phone does.
message.received
Fires once per message a lead sends to the agent, on WhatsApp, Instagram or the web chat. A message with an attachment fires once the attachment has been processed, usually a few seconds later, so message.attachments lists it. If the attachment can’t be processed, the event still fires without it: attachments is empty, and text is null when there was no caption.
message.failed
Fires when a message to the lead fails and NewLead will not retry it on its own: WhatsApp or Instagram refused it, WhatsApp reported it as failed later, or it could not be sent at all, for example because the 24-hour window closed and the agent has no approved template for it. The agent’s automatic first message is retried a few times and fires only after the last attempt.
It fires once per failure. If someone retries the message from the dashboard and it fails again, you receive another message.failed with the same message.id. Messages canceled before they are sent, such as a scheduled follow-up after the lead replies, do not fire it.
After a temporary error, the agent may send the same reply or follow-up again as a new message, with another message.id. You can then receive message.failed for the first attempt even though the lead got the second one.
message.error.code is the error code WhatsApp or Instagram returned, and category groups it, for example recipient_not_reachable or template_paused. The list can grow. Both are null when there is no provider error code, for example when the message could not be sent at all.
The message object
message.received and message.failed carry the message as GET /v1/messages/{message_id} returns it, read when the event fires. Attachments come without a download URL. A voice note or an audio carries transcription, the text of what the lead said; it is null for other attachments or when it could not be transcribed.
The lead object
Every lead.*, message.* and follow_up.sent event carries the same lead object, read when the event fires. You can create or update a contact from any of them.
The person. All the leads of one person across the channels and agents of a subaccount share it.
Event times
Useoccurred_at to order events. To order the messages of a conversation, use message.created_at: a message with an attachment fires a few seconds late, after any text the lead sent next. occurred_at matches these fields: