Export events

📢

This feature is in private preview

This feature is in private preview and therefore is subject to change. If you would like to preview this feature please contact your customer representative or our support team



The export events functionality is designed to allow integrators to call a single service to retrieve events for activity across the whole of Dotdigital instead of having to retrieve data from multiple services. This greatly simplifies getting data out of Dotdigital.


How it works

The Events API allows you to define one or more subscriptions, to a maximum of five, that specify which events you would like capturing for retrieval to facilitate data synchronization with one or more systems.

Once subscriptions are made active, we start capturing and storing the specified events, so that you can then retrieve these events by calling the Retrieve events call on a regular basis to sync the captured events to your platform(s).

đźš«

We cannot sync historic events

We can only capture events that occur after a subscription is made active. It may take up to 5 minutes before we start capturing events.


Subscriptions

To get started, you must register a subscription using the Create subscription call. Each subscription must have a unique name and by default is created as inactive if you don't specify otherwise.

Event subscriptions

You must specify which event types you want to capture for the subscription, and optional filters to narrow these events down further.

đźš§

Only subscribe to what you need

To minimize processing overheads on all platforms involved, ensure that you only subscribe to those events you require, and, where possible, further refine the selection using filters.

Subscription status

The status of a subscription is returned and set using the status field. The field can have the following values and subsequent affects on the subscription:

Status valueAffect
inactiveEvents are not captured for this subscription whilst inactive; this can result in data loss.
activeEvents are captured; may take up to 5 minutes for capture to start after setting this status.

❗️

We suspend inactive subscriptions after 30 days

We monitor the calls to Retrieve events for each subscription to establish if they are still being used or not. If we don't see any calls to Retrieve events for a subscription within 30 days then we automatically set the status to inactive for that subscription.

This means events capture stops and data loss will likely occur.


Retrieving events

Periodically you must call Retrieve events for each active subscription.

The system uses checkpoints to track when events have been synced.

  1. For a subscription, initially call Retrieve events without the checkPoint parameter. This retrieves the earliest events captured for the subscription and returns a checkPoint which you must store.
  2. Store the retrieved events for processing later.
  3. On subsequent calls to Retrieve events, you must pass the previous checkPoint value so we know to retrieve events since the last successful call.
đźš§

Passing a checkPoint value clears data

Once you have sent the checkPoint for a page of events they are removed from the queue, so you must not try to retrieve the next page of events using the checkPoint value until you have successfully stored the retrieved page of events.

If we return no events in the events array then you have received all the currently queued events. Store the checkPoint and back off for a period of time. Use the stored checkPoint next time you want to sync to resume from where you left off.

Retrieving files and other large content

Our events are limited to 900KB in size to ensure they remain a manageable size for processing and handling. If the content of a field such as an attached file or a large message can exceed this limit then instead of passing the data in the event itself we will instead pass a LOB Id (Large OBject Identifier). This LOB Id can be used in with the Retrieve large object call to retrieve the actual data.


Events

Event families

The following families of events exist:

  • Contacts
    • contact.created
    • contact.removed
    • contact.updated
    • contact.membershipUpdated
    • contact.consentAdded
    • contact.preferenceUpdated
  • Messages
    • message.sent
    • message.received
    • message.status
  • Interactions
    • interaction.click
    • interaction.pushClick
    • interaction.socialShare
    • interaction.unsubscribe
  • Insight data
    • insightData.collectionCreated
    • insightData.collectionRemoved
    • insightData.set
    • insightData.removed

The event envelope

Each event will be placed in a standardized envelope to make handling the event simple by providing common attributes for events such as id, type, account and event date.

The envelope schema is:

FieldTypeRequiredDescription
idstringYesUnique identifier for the event.
accountIdintegerYesDotdigital account id
processedDatestringYesDate time in ISO 8601 format based on UTC when the event was processed by the Events API.
eventDatestringYesDate time in ISO 8601 format based on UTC when the event occurred.
typestringYesThe type of event contained with the data field.
dataobjectYesThe events data as a object.
{
  "id": "",
  "accountId": 12345,
  "processedDate": "",
  "eventDate": "",
  "type": "contact.created",
  "data": {
		<< Event data here >>    
  }
}
{
  "id": "",
  "accountId": 12345,
  "processedDate": "",
  "eventDate": "",
  "type": "contact.created",
  "data": {
    "contactId": 321332,
    "identifiers": {
      "email": "[email protected]",
      "mobileNumber": "447123123123",
      "customId1": "1234dcf"
    },
    "channelProperties": {
      "email": {
        "emailType": "Html",
        "optInType": "Double",
        "status": "notSubscribed"
      },
      "sms/mms/rcs": {
        "countryCode": "GB",
        "status": "notSubscribed"
      },
      "whatsApp": {
        "status": "notSubscribed"
      }
    },
    "dataFields": {
      "firstName": "John",
      "lastName": "Doe",
      "gender": "male",
      "brandFan": true,
      "age": 21,
      "lastPurchasedDate": null
    }
  }
}

Contact events

contact.created

Contact Created

Triggered when a new contact is created / added to the account.

  • All identifiers are sent to allow correlation.
  • All data fields are included.
  • All channel properties are included.
  • null values are sent for fields that have no value.

Event data fields

These are the fields in the data field of the event envelope

Fields

Required

Data type

Description

contactId

Yes

integer

The immutable identifier for the contact

identifiers

Yes

object

Any identifiers for the contact. we include all the standard identifiers email and mobileNumber as well as any defined custom ids. If an identifier is not set then a null is returned.

channelProperties

Yes

object, see below:

Current channel statuses

  • email

No

object, see below:

Email channel properties

  • optinType

Yes

string, enum:

- unknown
- single
- double
- verifiedDouble

Channel opt-in type for the contact

  • status

Yes

string, enum:

- subscribed
- unsubscribed
- softBounced
- hardBounced
-ispComplained
- pendingOptIn
- directComplaint
- spamTrap
- deleted blockedlocalpart
- sharedsuppression
- sharedDomainSuppression
- suppressed
- binned
- domainSuppressed

Current marketing status of the channel for the contact

  • sms/mms/rcs

No

object, see below:

SMS channel properties

  • countryCode

Yes

string

ISO 3166-1 alpha-2 country code the contacts mobileNumber

  • status

Yes

string, enum:

- subscribed
- unsubscribed
- softBounced
- hardBounced
- deleted
- suppressed
- binned

Current marketing status of the channel for the contact

  • whatsApp

No

object, see below:

WhatsApp channel properties

  • status

Yes

string, enum:

- subscribed
- unsubscribed
- suppressed
- notSubscribed

Current marketing status of the channel for the contact

dataFields

Yes

object

The data fields for the contact.

Example

{
  "id": "",
  "accountId": 12345,
  "processedDate": "",
  "eventDate": "",
  "type": "contact.created",
  "data": {
    "contactId": 321332,
    "identifiers": {
      "email": "[email protected]",
      "mobileNumber": "447123123123",
      "customId1": "1234dcf"
    },
    "channelProperties": {
      "email": {
        "emailType": "Html",
        "optInType": "Double",
        "status": "notSubscribed"
      },
      "sms/mms/rcs": {
        "countryCode": "GB",
        "status": "notSubscribed"
      },
      "whatsApp": {
        "status": "notSubscribed"
      }
    },
    "dataFields": {
      "firstName": "John",
      "lastName": "Doe",
      "gender": "male",
      "brandFan": true,
      "age": 21,
      "lastPurchasedDate": null
    }
  }
}

contact.removed

Contact Removed

Triggered when a contact is removed from the account, when an API or manual action deletes a contact.

  • All identifiers are sent to allow correlation.

Event data fields

These are the fields in the data field of the event envelope

FieldsRequiredData typeDescription
contactIdYesintegerThe immutable identifier for the contact
identifiersYesobjectAny identifiers for the contact. we include all the standard identifiers email and mobileNumber as well as any defined custom ids. If an identifier is not set then a null is returned.

Example

{
  "id": "",
  "accountId": 12345,
  "processedDate": "",
  "eventDate": "",
  "type": "contact.removed",
  "data": {
    "contactId": 321332,
    "identifiers": {
      "email": "[email protected]",
      "mobileNumber": "447123123123",
      "customId1": "1234dcf"
    }
  }
}


contact.updated

Contact Updated

Triggered when a contact is updated; changes covered are with identifiers, data fields and channel properties.

  • All identifiers are sent to allow correlation.
  • All data fields are included.
  • All channel properties are included.
  • null values are sent for fields that have no value.

Event data fields

These are the fields in the data field of the event envelope

Fields

Required

Data type

Description

contactId

Yes

integer

The immutable identifier for the contact

identifiers

Yes

object

Any identifiers for the contact. we include all the standard identifiers email and mobileNumber as well as any defined custom ids. If an identifier is not set then a null is returned.

channelProperties

Yes

object, see below:

Current channel statuses

  • email

No

object, see below:

Email channel properties

  • emailType

Yes

string, enum:

- plainText
- html

The format the contact expects emails in.

  • optinType

Yes

string, enum:

- unknown
- single
- souble
- verifiedDouble

Channel opt-in type for the contact

  • status

Yes

string, enum:

- subscribed
- unsubscribed
- softBounced
- hardBounced ispComplained
- pendingOptIn
- directComplaint
- spamTrap
- deleted blockedlocalpart
- sharedsuppression
- sharedDomainSuppression
- suppressed
- purchased
- knownComplainer
- knownLitigator
- binned
- domainSuppressed

Current marketing status of the channel for the contact

  • sms/mms/rcs

No

object, see below:

SMS channel properties

  • countryCode

Yes

string

ISO 3166-1 alpha-2 country code the contacts mobileNumber

  • status

Yes

string, enum:

- subscribed
- unsubscribed
- softBounced
- hardBounced
- deleted
- suppressed
- binned

Current marketing status of the channel for the contact

  • whatsApp

No

object, see below:

WhatsApp channel properties

  • status

Yes

string, enum:

- subscribed
- unsubscribed
- suppressed
- notSubscribed

Current marketing status of the channel for the contact

dataFields

Yes

object

The data fields for the contact.

Example

{
  "id": "",
  "accountId": 12345,
  "processedDate": "",
  "eventDate": "",
  "type": "contact.removed",
  "data": {
    "contactId": 321332,
    "identifiers": {
      "email": "[email protected]",
      "mobileNumber": "447123123123",
      "customId1": "1234dcf"
    }
  }
}


Message events

message.sent

Message sent

Triggered when a message is sent on any channel.

Event data fields

These are the fields in the data field of the event envelope

Fields

Required

Data type

Description

messageId

Yes

string

Unique id for message

channel

Yes

string enum:

- email
- transactionalEmail
- sms
- mms
- whatsapp
- push

The channel the message was sent on.

to

Yes

object (see below)

Any identifiers for the recipient

  • contactId

No

integer

The immutable identifier for the contact

  • recipient

Yes

string

The recipients identifier, so email, phone number, etc…

  • identifiers

No

object

Any identifiers for the contact. we include all the standard identifiers email and mobileNumber as well as any defined custom ids. If an identifier is not set then a null is returned.

from

Yes

string

Any identifiers for the sender email, phone number etc… for push the app id from the push profile

campaignDetails

No

object (see below)

Details of the campaign that sent it if applicable

  • id

Yes

integer

The campaign identifier

  • name

Yes

string

The campaigns name

  • type

No

string enum:

- standard
- triggered

The type of campaign

program

No

object see below:

Automation program details if applicable

  • id

Yes

int

Automation program id if applicable

  • name

Yes

string

Automation program name

message

No

string

The message content, if available

attachments

No

Array of objects (see below)

Any attachments to the message

  • mimeType

Yes

string

MIME type of the attachment

  • url

Yes

string

Link to the attachment

channelData

No

object

Any additional channel data

metaData

No

object

Any customer metadata associated with the send, used for correlation etc…

Examples

{
  "id": "",
  "accountId": 12345,
  "processedDate": "",
  "eventDate": "",
  "type": "contact.created",
  "data": {
    "messageId": "3343556",
    "channel": "email",
    "to": {
      "contactId": 12345,
      "recipient": "[email protected]",
      "identifiers": {
        "email": "[email protected]",
        "mobileNumber": "447123123123",
        "customId1": "1234dcf"
      }
    },
    "from": "[email protected]",
    "campaignDetails": {
      "id": 245334,
      "name": "Special offer promo",
      "type": "standard"
    },
    "message": "<Email body>",
    "channelData": {
      "sendId": 47474874,
      "subject": "Don't miss out of this great offer!",
      "sendStatus": "sent",
      "sendStatusReason": ""
    }
  }
}