Skip to main content

Overview

AutoSend webhooks support three categories of events:
  1. Email Lifecycle Events - Track email sending and delivery
  2. Email Engagement Events - Track how recipients interact with your emails
  3. Contact Events - Track changes to your contact database
All webhook payloads follow this structure:
{
  "event": "event.type",
  "timestamp": "2025-11-12T10:30:00.000Z",
  "data": {
    // Event-specific data
  }
}

Supported Event Types

  • email.sent - Email successfully sent to the recipient’s mail server
  • email.delivered - Email successfully delivered
  • email.opened - Recipient opened the email
  • email.clicked - Recipient clicked a link in the email
  • email.bounced - Email failed to deliver
  • email.unsubscribed - Recipient unsubscribed
  • contact.created - New contact created
  • contact.updated - Contact information updated
  • contact.deleted - Contact deleted

Email Lifecycle Events

email.sent

Triggered when an email is successfully sent to the recipient’s mail server via SES.
Sample Payload:
{
  "event": "email.sent",
  "timestamp": "2025-11-12T10:00:00.000Z",
  "data": {
    "createdAt": "2025-11-12T10:00:00.000Z",
    "emailId": "64f1a2b3c4d5e6f7g8h9i0j1",
    "campaignId": "64f1a2b3c4d5e6f7g8h9i0j2",
    "templateId": "64f1a2b3c4d5e6f7g8h9i0j4",
    "timestamp": "2025-11-12T10:00:00.000Z",
    "from": "[email protected]",
    "to": {
      "email": "[email protected]",
      "name": "John Doe"
    },
    "subject": "Welcome to AutoSend"
  }
}
Use Cases:
  • Track when emails are successfully accepted by SES
  • Monitor email sending activity
  • Trigger follow-up workflows after email dispatch

email.delivered

Triggered when AutoSend successfully delivers an email to the recipient’s mail server.
Sample Payload:
{
  "event": "email.delivered",
  "timestamp": "2025-11-12T10:15:00.000Z",
  "data": {
    "createdAt": "2025-11-12T10:15:00.000Z",
    "emailId": "64f1a2b3c4d5e6f7g8h9i0j1",
    "campaignId": "64f1a2b3c4d5e6f7g8h9i0j2",
    "templateId": "64f1a2b3c4d5e6f7g8h9i0j4",
    "timestamp": "2025-11-12T10:15:00.000Z",
    "deliveredAt": "2025-11-12T10:15:00.000Z",
    "from": "[email protected]",
    "to": {
      "email": "[email protected]",
      "name": "John Doe"
    },
    "subject": "Welcome to AutoSend"
  }
}
Use Cases:
  • Confirm successful email delivery
  • Update delivery status in your database
  • Track delivery times and patterns

email.bounced

Triggered when an email bounces (fails to deliver).
Sample Payload:
{
  "event": "email.bounced",
  "timestamp": "2025-11-12T10:20:00.000Z",
  "data": {
    "createdAt": "2025-11-12T10:20:00.000Z",
    "emailId": "64f1a2b3c4d5e6f7g8h9i0j1",
    "campaignId": "64f1a2b3c4d5e6f7g8h9i0j2",
    "templateId": "64f1a2b3c4d5e6f7g8h9i0j4",
    "timestamp": "2025-11-12T10:20:00.000Z",
    "bounceType": "Permanent",
    "bounceSubType": "General",
    "bounceReason": "Mailbox does not exist",
    "bouncedAt": "2025-11-12T10:20:00.000Z",
    "from": "[email protected]",
    "to": {
      "email": "[email protected]",
      "name": "John Doe"
    },
    "subject": "Welcome to AutoSend"
  }
}
Bounce Types:
  • Permanent: Hard bounce - invalid email address, domain doesn’t exist
  • Transient: Soft bounce - mailbox full, server temporarily unavailable
Use Cases:
  • Remove hard bounced emails from your list
  • Retry soft bounces later
  • Monitor bounce rates for sender reputation

Email Engagement Events

email.opened

Triggered when a recipient opens an email.
Sample Payload:
{
  "event": "email.opened",
  "timestamp": "2025-11-12T10:30:00.000Z",
  "data": {
    "createdAt": "2025-11-12T10:30:00.000Z",
    "emailId": "64f1a2b3c4d5e6f7g8h9i0j1",
    "campaignId": "64f1a2b3c4d5e6f7g8h9i0j2",
    "templateId": "64f1a2b3c4d5e6f7g8h9i0j4",
    "timestamp": "2025-11-12T10:30:00.000Z",
    "openedAt": "2025-11-12T10:30:00.000Z",

    "from": "[email protected]",
    "to": {
      "email": "[email protected]",
      "name": "John Doe"
    },
    "subject": "Welcome to AutoSend"
  }
}

email.clicked

Triggered when a recipient clicks a link in an email.
Sample Payload:
{
  "event": "email.clicked",
  "timestamp": "2025-11-12T10:35:00.000Z",
  "data": {
    "createdAt": "2025-11-12T10:35:00.000Z",
    "emailId": "64f1a2b3c4d5e6f7g8h9i0j1",
    "campaignId": "64f1a2b3c4d5e6f7g8h9i0j2",
    "templateId": "64f1a2b3c4d5e6f7g8h9i0j4",
    "timestamp": "2025-11-12T10:35:00.000Z",
    "from": "[email protected]",
    "to": {
      "email": "[email protected]",
      "name": "John Doe"
    },
    "subject": "Welcome to AutoSend"
  }
}
Use Cases:
  • Track which links are most popular
  • Identify highly engaged contacts
  • Trigger follow-up campaigns based on clicked links

email.unsubscribed

Triggered when a recipient unsubscribes from your emails.
Sample Payload:
{
  "event": "email.unsubscribed",
  "timestamp": "2025-11-12T10:40:00.000Z",
  "data": {
    "createdAt": "2025-11-12T10:40:00.000Z",
    "emailId": "64f1a2b3c4d5e6f7g8h9i0j1",
    "campaignId": "64f1a2b3c4d5e6f7g8h9i0j2",
    "templateId": "64f1a2b3c4d5e6f7g8h9i0j4",
    "email": "[email protected]",
    "suppressedAt": "2025-11-12T10:40:00.000Z",
    "unsubscribeGroupId": "64f1a2b3c4d5e6f7g8h9i0j5"
  }
}
Use Cases:
  • Automatically remove contacts from mailing lists
  • Update contact preferences in your CRM
  • Track unsubscribe reasons for analytics

Contact Events

contact.created

Triggered when a new contact is created in your AutoSend project.
Sample Payload:
{
  "event": "contact.created",
  "timestamp": "2025-11-12T09:00:00.000Z",
  "data": {
    "createdAt": "2025-11-12T09:00:00.000Z",
    "contactId": "64f1a2b3c4d5e6f7g8h9i0j3",
    "email": "[email protected]",
    "firstName": "John",
    "lastName": "Doe",
    "userId": "user_12345"
  }
}
Use Cases:
  • Sync new contacts to your CRM
  • Trigger welcome email sequences
  • Update analytics dashboards

contact.updated

Triggered when an existing contact is updated.
Sample Payload:
{
  "event": "contact.updated",
  "timestamp": "2025-11-12T09:30:00.000Z",
  "data": {
    "createdAt": "2025-11-12T09:00:00.000Z",
    "contactId": "64f1a2b3c4d5e6f7g8h9i0j3",
    "email": "[email protected]",
    "userId": "user_12345",
    "firstName": "Jonathan",
    "lastName": "Doe",
    "updatedAt": "2025-11-12T09:30:00.000Z"
  }
}
Use Cases:
  • Keep contact data synchronized across systems
  • Track contact lifecycle changes
  • Trigger workflows based on specific field changes

contact.deleted

Triggered when a contact is deleted from your AutoSend project.
Sample Payload:
{
  "event": "contact.deleted",
  "timestamp": "2025-11-12T09:45:00.000Z",
  "data": {
    "contactId": "64f1a2b3c4d5e6f7g8h9i0j3",
    "email": "[email protected]",
    "userId": "user_12345",
    "deletedAt": "2025-11-12T09:45:00.000Z"
  }
}
Use Cases:
  • Remove contacts from external systems
  • Update contact counts and analytics
  • Maintain data consistency across platforms

Event Handling Examples

app.post("/webhooks/autosend", async (req, res) => {
  const { event, data } = req.body;

  switch (event) {
    case "email.opened":
      await handleEmailOpened(data);
      break;

    case "email.clicked":
      await handleEmailClicked(data);
      break;

    case "email.bounced":
      await handleEmailBounced(data);
      break;

    case "email.unsubscribed":
      await handleUnsubscribe(data);
      break;

    case "contact.created":
      await handleContactCreated(data);
      break;

    case "contact.updated":
      await handleContactUpdated(data);
      break;

    case "contact.deleted":
      await handleContactDeleted(data);
      break;

    default:
      console.log(`Unhandled event: ${event}`);
  }

  res.status(200).json({ received: true });
});

Get Available Events via API

You can programmatically fetch the list of available events:
curl -X GET https://api.autosend.io/v1/webhooks/events/available \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-project-id: YOUR_PROJECT_ID"
Response:
{
  "success": true,
  "data": {
    "events": [
      "email.sent",
      "email.delivered",
      "email.opened",
      "email.clicked",
      "email.bounced",
      "email.deferred",
      "email.unsubscribed",
      "email.spam_reported",
      "email.group_unsubscribed",
      "email.group_resubscribed",
      "contact.created",
      "contact.updated",
      "contact.deleted"
    ]
  }
}