Webhook Events

A complete reference of the AgentMail webhook event and its payload.

When you create a webhook, you subscribe to events from AgentMail. As of now, AgentMail supports a single event type: message.received. This event is your primary trigger for all agent-based workflows. We will be adding more event types in the future.

All webhook payloads follow the same basic structure:

1{
2 "event": "event.name",
3 "data": {
4 // ... event-specific data object
5 }
6}

Message Event

The message.received event is triggered whenever a new email is successfully received and processed in one of your Inboxes.

message.received

  • Description: This is the main trigger to kick off your agent’s workflow. Use this event to fetch the full message content, process it, and decide on the next action, such as generating a reply.
  • Use Case: Instantly kick off an agent’s workflow to process and reply to an incoming email.
1{
2 "event": "message.received",
3 "data": {
4 "id": "msg_123abc",
5 "object": "message",
6 "inbox_id": "inbox_456def",
7 "thread_id": "thd_789ghi",
8 "from": [
9 {
10 "name": "Jane Doe",
11 "email": "jane@example.com"
12 }
13 ],
14 "to": [
15 {
16 "name": "Support Agent",
17 "email": "support@agentmail.to"
18 }
19 ],
20 "subject": "Question about my account",
21 "created_at": "2023-10-27T10:00:00Z"
22 // ... and other message properties
23 }
24}

Future Events

We are working on expanding our event offerings. In the future, you can expect to see events related to email delivery status, such as:

  • delivery.success
  • delivery.bounced
  • delivery.complained
  • and much more…

Stay tuned for updates as we roll out these new features!

If you have any specific webhook notifications you would like, please ping us in the #feature-requests channel in the Discord