WEBHOOK
SendPostWebhooks
{
  "event": {
    "eventID": "edhg-123gh-afasdf-124egh",
    "groups": [
      "transactional",
      "user-onboarding"
    ],
    "ipID": 123,
    "ipPoolID": 123,
    "domainID": 123,
    "tpspId": 1,
    "messageType": "default",
    "messageSubject": "Welcome to Pied Piper :) + 1 quick question",
    "accountID": 117,
    "subAccountID": 117,
    "messageID": "mjhl-1401-sasdf-129324",
    "type": 2,
    "from": "richard@piedpiper.com",
    "fromName": "Richard",
    "to": "gavin@hooli.com",
    "toName": "Gavin",
    "submittedAt": 1567512491587205000,
    "smtpCode": 200,
    "smtpDescription": "email delivered successfully",
    "eventMetadata": {
      "smtpCode": 200,
      "smtpDescription": "email delivered successfully",
      "userAgent": {
        "Family": "Mozilla",
        "Major": "5.0",
        "Minor": "0",
        "Patch": "0"
      },
      "os": {
        "Family": "Windows",
        "Major": "10",
        "Minor": "0",
        "Patch": "0",
        "PatchMinor": "0"
      },
      "device": {
        "Family": ""
      },
      "geo": {
        "cityID": "123",
        "continentCode": "EU",
        "countryCode": "US",
        "postalCode": "12345",
        "timeZone": "America/Los_Angeles"
      },
      "clickedURL": "https://hooli.com",
      "trackedIP": "52.34.11.12",
      "rawUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
    }
  },
  "emailMessage": {
    "messageID": "mjhl-1401-sasdf-129324",
    "accountID": 117,
    "subAccountID": 117,
    "ipID": 123,
    "publicIP": "52.34.11.12",
    "localIP": "127.0.0.1",
    "emailType": "default",
    "submittedAt": 1567512491587205000,
    "from": {
      "name": "Richard",
      "email": "richard@piedpiper.com"
    },
    "replyTo": {
      "name": "Gavin",
      "email": "gavin@hooli.com"
    },
    "to": [
      {
        "name": "Gavin",
        "email": "gavin@hooli.com",
        "customFields": {
          "Company": "Hooli"
        },
        "cc": [
          {
            "name": "Dinesh",
            "email": "dinesh@bachmanity.com",
            "customFields": {
              "Company": "Hooli"
            }
          }
        ],
        "bcc": [
          {
            "name": "Jian",
            "email": "jian@bachmanity.com",
            "customFields": {
              "Company": "Hooli"
            }
          }
        ]
      }
    ],
    "groups": [
      "welcome",
      "user-onboarding"
    ],
    "ipPool": "transactional-piedpiper",
    "headers": {
      "X-Campaign-Id": "12345"
    },
    "customFields": {
      "Company": "Company Name",
      "Email": "user@example.com"
    },
    "trackOpens": true,
    "trackClicks": true,
    "webhookEndpoint": "https://webhook.example.com/webhook"
  }
}
Just to take a step back, when you use SendPost API call to send an email, the email message goes through a complete lifecycle:
  • API request will be processed
  • Decide to either drop the request if email is either invalid or is in suppression list
  • Decide to attempt email delivery
  • During email delivery if a hard bounce happens then raise an event. If a soft bounce happens then raise an event alongwith retrying after X time
  • If email is delivered successfully then raise a delivered event
Once email delivery has been done a recipient may decide to:
  • Open the email message. If open tracking is enabled then opened event is generated
  • Click the email message. If click tracking is enabled then clicked event is generated
  • Recipient may unsubscribe from receiving future emails in which case unsubscribed event is generated
  • And the worst scenario is if they mark your email as spam in which case a spam event is generated
For all the aforementioned events, SendPost can generate a webhook call. The event structure across these call remains same however some fields may remain empty or have data based on event webhook that is raised. Also as explained earlier, for a single emailMessage multiple events are generated. The emailMessage sent via HTTP Post will remain same across different events during the lifecycle of the email message. Every event generated as SendPost webhook will have type field in event object:
Webhook EventType Field Value
Processed0
Dropped1
Delivered2
SoftBounced3
HardBounced4
Opened5
Clicked6
Unsubscribed7
Spam8
Below specified are event specific fields. All these fields are contained inside eventMetadata sub-object inside event object. These fields are set for specific webhook events only.
Field TypeEvents for which it is set
clickedURLClicked
smtpCodeDelivered, SoftBounced and HardBounced
smtpDescrptionDelivered, SoftBounced and HardBounced
userAgentOpened and Clicked
osOpened and Clicked
deviceOpened and Clicked
geoOpened and Clicked
trackedIPOpened and Clicked
rawUserAgentOpened and Clicked

Body

application/json

Response

200

Return a 200 status to indicate that the data was received successfully