Skip to main content

Event Structure

All webhook events follow the same structure:
{
  "event": "event.type",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    // Event-specific data
  }
}
FieldTypeDescription
eventstringEvent type identifier
timestampstringISO 8601 timestamp when event occurred
dataobjectEvent-specific payload

email.received

Triggered when a new email is received in any monitored mailbox.

Payload

{
  "event": "email.received",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "id": "12345",
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "cc": ["[email protected]"],
    "subject": "Project Update",
    "account": "[email protected]",
    "folder": "INBOX",
    "text": "Hi,\n\nHere's the latest update...",
    "html": "<p>Hi,</p><p>Here's the latest update...</p>",
    "attachments": [
      {
        "filename": "report.pdf",
        "contentType": "application/pdf",
        "size": 102400
      }
    ]
  }
}

Fields

FieldTypeDescription
idstringEmail UID
messageIdstringRFC 2822 Message-ID
fromstringSender email address
tostring[]Recipients
ccstring[]CC recipients (optional)
subjectstringEmail subject
accountstringYour email account
folderstringMailbox folder
textstringPlain text body
htmlstringHTML body
attachmentsobject[]Attachment metadata

Use Cases

  • AI agents processing incoming emails
  • Auto-reply systems
  • Email classification and routing
  • CRM integrations

email.sent

Triggered when an email is successfully sent via the API.

Payload

{
  "event": "email.sent",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "id": "<[email protected]>",
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "cc": ["[email protected]"],
    "subject": "Hello from Jasni!",
    "account": "[email protected]",
    "text": "Message content...",
    "html": "<p>Message content...</p>"
  }
}

Fields

FieldTypeDescription
idstringEmail Message-ID
messageIdstringRFC 2822 Message-ID
fromstringSender address
tostring[]Recipients
ccstring[]CC recipients (optional)
subjectstringEmail subject
accountstringSending account
textstringPlain text body
htmlstringHTML body

Use Cases

  • Tracking sent emails
  • Analytics and reporting
  • Confirmation workflows

email.delivered

Triggered when an email is successfully delivered to the recipient’s mail server.

Payload

{
  "event": "email.delivered",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "id": "<[email protected]>",
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "subject": "Hello from Jasni!",
    "account": "[email protected]",
    "deliveredAt": "2024-01-15T10:30:05.000Z",
    "smtpResponse": "250 2.0.0 OK"
  }
}

Fields

FieldTypeDescription
idstringEmail Message-ID
messageIdstringRFC 2822 Message-ID
fromstringSender address
tostring[]Recipients
subjectstringEmail subject
accountstringSending account
deliveredAtstringDelivery timestamp
smtpResponsestringSMTP server response

Use Cases

  • Delivery confirmation tracking
  • SLA monitoring
  • Analytics and reporting
  • Delivery rate optimization

email.bounced

Triggered when an email fails to deliver (bounce).

Payload

{
  "event": "email.bounced",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "id": "<[email protected]>",
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "subject": "Original subject",
    "account": "[email protected]",
    "bounceType": "hard",
    "bounceReason": "550 5.1.1 User unknown"
  }
}

Fields

FieldTypeDescription
idstringOriginal message ID
messageIdstringOriginal Message-ID
fromstringOriginal sender
tostring[]Failed recipients
subjectstringOriginal subject
accountstringSending account
bounceTypestringType: “hard” or “soft”
bounceReasonstringBounce error message

Use Cases

  • Clean invalid addresses from lists
  • Notify users of delivery failures
  • Monitor email deliverability

email.spam

Triggered when a recipient marks your email as spam (complaint).

Payload

{
  "event": "email.spam",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "id": "<[email protected]>",
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "subject": "Your Newsletter",
    "account": "[email protected]",
    "complainedAt": "2024-01-15T10:30:00.000Z",
    "feedbackType": "abuse"
  }
}

Fields

FieldTypeDescription
idstringEmail Message-ID
messageIdstringMessage-ID
fromstringSender address
tostring[]Recipients who complained
subjectstringEmail subject
accountstringSending account
complainedAtstringComplaint timestamp
feedbackTypestringFeedback type (abuse, fraud, etc.)

Use Cases

  • Unsubscribe complainers automatically
  • Monitor sender reputation
  • Compliance tracking
  • Improve email content

email.rejected

Triggered when an email is rejected before delivery (e.g., policy violation, spam filter).

Payload

{
  "event": "email.rejected",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "id": "<[email protected]>",
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "subject": "Rejected Email",
    "account": "[email protected]",
    "rejectionReason": "Policy violation: suspected spam content",
    "rejectionCode": "550"
  }
}

Fields

FieldTypeDescription
idstringEmail Message-ID
messageIdstringRFC 2822 Message-ID
fromstringSender address
tostring[]Intended recipients
subjectstringEmail subject
accountstringSending account
rejectionReasonstringReason for rejection
rejectionCodestringSMTP rejection code

Use Cases

  • Monitor policy violations
  • Debug delivery issues
  • Improve email content
  • Alert on suspicious activity

email.deleted

Triggered when an email is deleted via the API.

Payload

{
  "event": "email.deleted",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "id": "12345",
    "account": "[email protected]"
  }
}

Fields

FieldTypeDescription
idstringDeleted email UID
accountstringEmail account

Use Cases

  • Audit logging
  • Sync with external systems
  • Compliance tracking

domain.verified

Triggered when a custom domain is successfully verified.

Payload

{
  "event": "domain.verified",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "data": {
    "domain": "example.com",
    "verifiedAt": "2024-01-15T10:30:00.000Z",
    "dnsRecords": {
      "mx": true,
      "spf": true,
      "dkim": true,
      "dmarc": true
    }
  }
}

Fields

FieldTypeDescription
domainstringVerified domain name
verifiedAtstringVerification timestamp
dnsRecordsobjectDNS verification status
dnsRecords.mxbooleanMX record verified
dnsRecords.spfbooleanSPF record verified
dnsRecords.dkimbooleanDKIM record verified
dnsRecords.dmarcbooleanDMARC record verified

Use Cases

  • Notify users when domain setup is complete
  • Trigger onboarding workflows
  • Enable domain-specific features
  • Analytics tracking

Example Handler

Handle all events in one endpoint:
app.post('/webhooks/jasni', async (req, res) => {
  const { event, timestamp, data } = req.body;
  
  console.log(`[${timestamp}] ${event}`);
  
  switch (event) {
    case 'email.received':
      // New email arrived
      await processIncomingEmail(data);
      break;
      
    case 'email.sent':
      // Email sent successfully
      await logSentEmail(data);
      break;
      
    case 'email.delivered':
      // Email delivered to recipient server
      await confirmDelivery(data);
      break;
      
    case 'email.bounced':
      // Email failed to deliver
      await handleBounce(data);
      break;
      
    case 'email.spam':
      // Recipient marked as spam
      await handleComplaint(data);
      break;
      
    case 'email.rejected':
      // Email rejected before delivery
      await handleRejection(data);
      break;
      
    case 'email.deleted':
      // Email deleted
      await syncDeletion(data);
      break;
      
    case 'domain.verified':
      // Custom domain verified
      await notifyDomainVerified(data);
      break;
      
    default:
      console.log('Unknown event:', event);
  }
  
  res.status(200).send('OK');
});