Webhook
SendPost Webhook Object
WEBHOOK
When you use SendPost API to send an email, SendPost generates webhook events throughout the email lifecycle. Each webhook event contains an
Order/Transaction Tracking:
Customer Segmentation:
event object and an emailMessage object. The emailMessage object remains the same across all events for a given email, allowing you to correlate events using the messageID.
For a detailed explanation of the email lifecycle and what each event type means, see Understanding Webhook Event Lifecycle.
Complete Webhook Payload Structure
Every webhook payload sent by SendPost follows this structure:Event Object Fields
Theevent object contains information about the specific webhook event that occurred.
Event Types
Every event generated as SendPost webhook will have atype field in the event object:
Event Metadata Fields
TheeventMetadata object contains event-specific information. Different fields are populated depending on the event type.
userAgent Object Fields
TheuserAgent object provides parsed browser/email client information:
os Object Fields
Theos object provides parsed operating system information:
device Object Fields
Thedevice object provides parsed hardware device information:
geo Object Fields
Thegeo object provides geographic location information based on IP geolocation:
Geographic data is derived from IP address lookups and may not always be 100% accurate. The precision depends on the IP geolocation database and the nature of the recipient’s network connection.
Email Message Object Fields
TheemailMessage object contains information about the original email that was sent. This object remains identical across all webhook events for the same email.
from Object Fields
Thefrom object contains sender information:
to Array Item Fields
Each item in theto array represents a recipient:
headers Object
Theheaders object is a key-value store for custom headers:
Custom headers you send with your email are preserved and returned in all webhook events. This allows you to track emails throughout their lifecycle using your own identifiers.
groups Array
Thegroups array contains classification tags:
SMTP Code and Description in Webhook Events
SMTP codes and descriptions provide detailed information about email delivery status. These fields are available in specific webhook events to help you understand delivery outcomes.Availability by Event Type
Common SMTP Codes
Example: Delivered Event with SMTP Code
Example: HardBounced Event with SMTP Code
SMTP codes and descriptions are available in both the top-level
event object and within event.eventMetadata. Both locations contain the same values for consistency and ease of access.Example: Opened Event with Full Metadata
Example: Clicked Event with URL
Custom Headers in Webhook Payloads
Any custom headers you include in your email request are preserved and included in all webhook event payloads. This allows you to track campaigns, add custom identifiers, or pass metadata through the entire email lifecycle.How Headers are Preserved
- Included in All Events: Custom headers sent in your email request are included in the
emailMessage.headersobject in all webhook events (Processed, Dropped, Delivered, Opened, Clicked, Bounced, Unsubscribed, Spam). - Same Across Lifecycle: The headers remain the same across all events for a given email message, allowing you to correlate events using your custom identifiers.
- Original Format: Headers are returned exactly as you sent them in your email request.
Example: Email Request with Custom Headers
Example: Webhook Payload with Preserved Headers
Use Cases for Custom Headers
Campaign Tracking:Custom headers are included in every webhook event for the email, allowing you to filter and process webhooks based on your custom identifiers or metadata.