Campaign event data stream from Amazon Pinpoint - Amazon Pinpoint

Campaign event data stream from Amazon Pinpoint

If you use Amazon Pinpoint to send campaigns through a channel, Amazon Pinpoint can stream event data about those campaigns. After you set up event streaming, Amazon Pinpoint retrieves your app's event data for email or SMS messages that you send from a campaign from the destination that you specified during setup for you to view. For detailed information about the data that Amazon Pinpoint streams for email and SMS messages, see Email event data stream from Amazon Pinpoint and SMS event data stream from Amazon Pinpoint. For information about how to set up event streaming, see Set up Amazon Pinpoint to stream app event data through Amazon Kinesis or Amazon Data Firehose .

Campaign event example

The JSON object for a campaign event contains the data shown in the following example.

{ "event_type": "_campaign.send", "event_timestamp": 1562109497426, "arrival_timestamp": 1562109497494, "event_version": "3.1", "application": { "app_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6", "sdk": {} }, "client": { "client_id": "d8dcf7c5-e81a-48ae-8313-f540cexample" }, "device": { "platform": {} }, "session": {}, "attributes": { "treatment_id": "0", "campaign_activity_id": "5473285727f04865bc673e527example", "delivery_type": "GCM", "campaign_id": "4f8d6097c2e8400fa3081d875example", "campaign_send_status": "SUCCESS" }, "client_context": { "custom": { "endpoint": "{\"ChannelType\":\"GCM\",\"EndpointStatus\":\"ACTIVE\", ↳\"OptOut\":\"NONE\",\"RequestId\":\"ec229696-9d1e-11e9-8bf1-85d0aexample\", ↳\"EffectiveDate\":\"2019-07-02T23:12:54.836Z\",\"User\":{}}" } }, "awsAccountId": "123456789012" }

Campaign event attributes

This section defines the attributes that are included in the campaign event stream.

Attribute Description
event_type

The type of event. Possible values are:

  • _campaign.send – Amazon Pinpoint executed the campaign.

  • _campaign.opened_notification – For push notification campaigns, this event type indicates that the recipient tapped the notification to open it.

  • _campaign.received_foreground – For push notification campaigns, this event type indicates that the recipient received the message as a foreground notification.

  • _campaign.received_background – For push notification campaigns, this event type indicates that the recipient received the message as a background notification.

    Note

    _campaign.opened_notification, _campaign.received_foreground, and _campaign.received_background are returned only if you use AWS Amplify. For more information on integrating your app with AWS Amplify. See Connect your frontend application to Amazon Pinpoint using AWS Amplify.

event_timestamp

The time when the event was reported, shown as Unix time in milliseconds.

arrival_timestamp

The time when the event was received by Amazon Pinpoint, shown as Unix time in milliseconds.

event_version

The version of the event JSON schema.

Tip

Check this version in your event-processing application so that you know when to update the application in response to a schema update.

application

Information about the Amazon Pinpoint project that's associated with the event. For more information, see the Application table.

client

Information about the endpoint that the event is associated with. For more information, see the Client table.

device

Information about the device that reported the event. For campaign and transactional messages, this object is empty.

session

Information about the session that generated the event. For campaigns, this object is empty.

attributes

Attributes that are associated with the event. For events that are reported by one of your apps, this object can include custom attributes that are defined by the app. For events that are created when you send a campaign, this object contains attributes that are associated with the campaign. For events that are generated when you send transactional messages, this object contains information that's related to the message itself.

For more information, see the Attributes table.

client_context Contains a custom object, which contains an endpoint property. The endpoint property contains the contents of the endpoint record for the endpoint that the campaign was sent to.
awsAccountId

The ID of the AWS account that was used to send the message.

Application

Includes information about the Amazon Pinpoint project that the event is associated with.

Attribute Description
app_id

The unique ID of the Amazon Pinpoint project that reported the event.

sdk

The SDK that was used to report the event.

Attributes

Includes information about the campaign that produced the event.

Attribute Description
treatment_id

If the message was sent using an A/B test campaign, this value represents the treatment number of the message. For standard campaigns, this value is 0.

campaign_activity_id The unique ID that Amazon Pinpoint generates when the event occurs.
delivery_type

The delivery method for the campaign. Don't confuse this attribute with the ChannelType field specified under the endpoint property of client_context. The ChannelType field is typically based on the endpoint that the message is being sent to.

For channels that support only one endpoint type, the delivery_type and ChannelType fields have the same value. For example, for the email channel, the delivery_type and ChannelType fields have the same value of EMAIL.

However, this condition isn't always true for channels that support different endpoint types, such as custom channels. You can use a custom channel for different endpoints, such as EMAIL, SMS, CUSTOM, and so on. In this case, the delivery_type identifies a custom delivery event, CUSTOM, and the ChannelType specifies the type of endpoint that the campaign was sent to, such as EMAIL, SMS, CUSTOM, and so on. For more information on creating custom channels, see Create a custom channel in Amazon Pinpoint using a webhook or Lambda function.

Possible values are:

  • EMAIL

  • SMS

  • ADM

  • APNS

  • APNS_SANDBOX

  • APNS_VOIP

  • APNS_VOIP_SANDBOX

  • VOICE

  • GCM

  • BAIDU

  • PUSH

  • CUSTOM

campaign_id

The unique ID of the campaign that the message was sent from.

campaign_send_status Indicates the status of the campaign for the target endpoint. Possible values include:
  • SUCCESS – The campaign was successfully sent to the endpoint.

  • FAILURE – The campaign wasn't sent to the endpoint.

  • DAILY_CAP – The campaign wasn't sent to the endpoint because the maximum number of daily messages have already been sent to the endpoint.

  • EXPIRED – The campaign wasn’t sent to the endpoint because sending it would exceed the maximum duration or sending rate settings for the campaign.

  • QUIET_TIME – The campaign wasn't sent to the endpoint because of quiet time restrictions.

  • HOLDOUT – The campaign wasn't sent to the endpoint because the endpoint was a member of the holdout group.

  • DUPLICATE_ADDRESS – There are duplicate endpoint addresses in the segment. The campaign was sent once to the endpoint address.

  • QUIET_TIME – The campaign wasn't sent to the endpoint because of quiet time restrictions.

  • CAMPAIGN_CAP – The campaign wasn't sent to the endpoint because the maximum number of messages have already been sent to the endpoint from this campaign.

  • FAILURE_PERMANENT – A permanent failure occurred when sending to the endpoint.

  • TRANSIENT_FAILURE – A transient failure occurred when sending to the endpoint.

  • THROTTLED – Sending was throttled.

  • UNKNOWN – Unknown failure.

  • HOOK_FAILURE – Campaign hook failed.

  • CUSTOM_DELIVERY_FAILURE – Custom delivery failed.

  • RECOMMENDATION_FAILURE – Recommender failed.

  • UNSUPPORTED_CHANNEL – Channel is not supported.

Client

Includes information about the endpoint that was targeted by the campaign.

Attribute Description
client_id The ID of the endpoint that the campaign was sent to.