

**End of support notice:** On October 30, 2026, AWS will end support for Amazon Pinpoint. After October 30, 2026, you will no longer be able to access the Amazon Pinpoint console or Amazon Pinpoint resources (endpoints, segments, campaigns, journeys, and analytics). For more information, see [Amazon Pinpoint end of support](https://docs.aws.amazon.com/console/pinpoint/migration-guide). **Note:** APIs related to SMS, voice, mobile push, OTP, and phone number validate are not impacted by this change and are supported by AWS End User Messaging.

# Stream app event data through Kinesis and Firehose using Amazon Pinpoint
<a name="event-streams"></a>

In Amazon Pinpoint, an *event* is an action that occurs when a user interacts with one of your applications, when you send a message from a campaign or journey, or when you send a transactional SMS or email message. For example, if you send an email message, several events occur:
+ When you send the message, a *send* event occurs.
+ When the message reaches the recipient's inbox, a *delivered* event occurs.
+ When the recipient opens the message, an *open* event occurs. 

You can configure Amazon Pinpoint to send information about events to Amazon Kinesis. The Kinesis platform offers services that you can use to collect, process, and analyze data from AWS services in real time. Amazon Pinpoint can send event data to Firehose, which streams this data to AWS data stores such as Amazon S3 or Amazon Redshift. Amazon Pinpoint can also stream data to Kinesis Data Streams, which ingests and stores multiple data streams for processing by analytics applications.

The Amazon Pinpoint event stream includes information about user interactions with applications (apps) that you connect to Amazon Pinpoint. It also includes information about all the messages that you send from campaigns, through any channel, and from journeys. This can also include any custom events that you've defined. Finally, it includes information about all the transactional email and SMS messages that you send.

**Note**  
Amazon Pinpoint doesn't stream information about transactional push notifications or voice messages.

This chapter provides information about setting up Amazon Pinpoint to stream event data to Kinesis. It also contains examples of the event data that Amazon Pinpoint streams.

**Topics**
+ [

# Set up Amazon Pinpoint to stream app event data through Amazon Kinesis or Amazon Data Firehose
](event-streams-setup.md)
+ [

# App event data stream from Amazon Pinpoint
](event-streams-data-app.md)
+ [

# Campaign event data stream from Amazon Pinpoint
](event-streams-data-campaign.md)
+ [

# Journey event data from Amazon Pinpoint
](event-streams-data-journey.md)
+ [

# Email event data stream from Amazon Pinpoint
](event-streams-data-email.md)
+ [

# SMS event data stream from Amazon Pinpoint
](event-streams-data-sms.md)
+ [

# Delete an event stream from Amazon Pinpoint
](event-streams-disable.md)

# Set up Amazon Pinpoint to stream app event data through Amazon Kinesis or Amazon Data Firehose
<a name="event-streams-setup"></a>

You can set up Amazon Pinpoint to send event data to an Amazon Kinesis stream or an Amazon Data Firehose delivery stream. Amazon Pinpoint can send event data for campaigns, journeys, and transactional email and SMS messages.

This section includes information about setting up event streaming programmatically. You can also use the Amazon Pinpoint console to set up event streaming. For information about setting up event streaming by using the Amazon Pinpoint console, see [Event stream settings](https://docs.aws.amazon.com/pinpoint/latest/userguide/settings-event-streams.html) in the *Amazon Pinpoint User Guide*.

## Prerequisites
<a name="event-streams-setup-prerequisites"></a>

The examples in this section require the following input:
+ The application ID of an application that's integrated with Amazon Pinpoint and reporting events. For information about how to integrate, see [Integrate Amazon Pinpoint with your application](integrate.md).
+ The Amazon Resource Name (ARN) of a Kinesis stream or Firehose delivery stream in your AWS account. For information about creating these resources, see [Creating and Managing Streams](https://docs.aws.amazon.com/streams/latest/dev/working-with-streams.html) in the *Amazon Kinesis Data Streams Developer Guide* or [Creating an Amazon Data Firehose delivery stream](https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html) in the *Amazon Data Firehose Developer Guide*.
+ The ARN of an AWS Identity and Access Management (IAM) role that authorizes Amazon Pinpoint to send data to the stream. For information about creating a role, see [IAM role for streaming events to Kinesis](permissions-streams.md).

## AWS CLI
<a name="event-streams-setup-cli"></a>

The following AWS CLI example uses the [put-event-stream](https://docs.aws.amazon.com/cli/latest/reference/pinpoint/put-event-stream.html) command. This command configures Amazon Pinpoint to send events to a Kinesis stream:

```
aws pinpoint put-event-stream \
--application-id projectId \
--write-event-stream DestinationStreamArn=streamArn,RoleArn=roleArn
```

## AWS SDK for Java
<a name="event-streams-setup-java"></a>

The following Java example configures Amazon Pinpoint to send events to a Kinesis stream:

```
public PutEventStreamResult createEventStream(AmazonPinpoint pinClient, 
        String appId, String streamArn, String roleArn) {
        
    WriteEventStream stream = new WriteEventStream()
            .withDestinationStreamArn(streamArn)
            .withRoleArn(roleArn);

    PutEventStreamRequest request = new PutEventStreamRequest()
            .withApplicationId(appId)
            .withWriteEventStream(stream);

    return pinClient.putEventStream(request);
}
```

This example constructs a `WriteEventStream` object that stores the ARNs of the Kinesis stream and the IAM role. The `WriteEventStream` object is passed to a `PutEventStreamRequest` object to configure Amazon Pinpoint to stream events for a specific application. The `PutEventStreamRequest` object is passed to the `putEventStream` method of the Amazon Pinpoint client.

You can assign a Kinesis stream to multiple applications. If you do this, Amazon Pinpoint sends event data encoded in base64 from each application to the stream, which enables you to analyze the data as a collection. The following example method accepts a list of application (app) IDs, and it uses the previous example method, `createEventStream`, to assign a stream to each application:

```
public List<PutEventStreamResult> createEventStreamFromAppList(
        AmazonPinpoint pinClient, List<String> appIDs, 
        String streamArn, String roleArn) {

    return appIDs.stream()
            .map(appId -> createEventStream(pinClient, appId, streamArn, 
                    roleArn))
            .collect(Collectors.toList());
}
```

Although you can assign one stream to multiple applications, you can't assign multiple streams to one application.

# App event data stream from Amazon Pinpoint
<a name="event-streams-data-app"></a>

After you integrate your application (app) with Amazon Pinpoint and set up event streaming, Amazon Pinpoint retrieves your app's user activity, custom events, and message delivery data from the destination that you specified during setup for you to view. For information about how to set up event streaming so you can view your event data, see [Set up Amazon Pinpoint to stream app event data through Amazon Kinesis or Amazon Data Firehose](event-streams-setup.md).

## App event example
<a name="event-streams-data-app-example"></a>

The JSON object for an app event contains the data shown in the following example.

```
{
  "event_type": "_session.stop",
  "event_timestamp": 1487973802507,
  "arrival_timestamp": 1487973803515,
  "event_version": "3.0",
  "application": {
    "app_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "cognito_identity_pool_id": "us-east-1:a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
    "package_name": "main.page",
    "sdk": {
      "name": "aws-sdk-mobile-analytics-js",
      "version": "0.9.1:2.4.8"
    },
    "title": "title",
    "version_name": "1.0",
    "version_code": "1"
  },
  "client": {
    "client_id": "m3n4o5p6-a1b2-c3d4-e5f6-g7h8i9j0k1l2",
    "cognito_id": "us-east-1:i9j0k1l2-m3n4-o5p6-a1b2-c3d4e5f6g7h8"
  },
  "device": {
    "locale": {
      "code": "en_US",
      "country": "US",
      "language": "en"
    },
    "make": "generic web browser",
    "model": "Unknown",
    "platform": {
      "name": "android",
      "version": "10.10"
    }
  },
  "session": {
    "session_id": "f549dea9-1090-945d-c3d1-e4967example",
    "start_timestamp": 1487973202531,
    "stop_timestamp": 1487973802507
  },
  "attributes": {},
  "metrics": {}
}
```

## App event attributes
<a name="event-streams-data-app-attributes"></a>

This section defines the attributes that are included in the previous example of the app event stream.


| Attribute | Description | 
| --- | --- | 
| event\$1type |  The type of event. Possible values are: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-app.html)  | 
| event\$1timestamp | The time when the event was reported, shown as Unix time in milliseconds. | 
| arrival\$1timestamp | The time when the event was received by Amazon Pinpoint, shown as Unix time in milliseconds. | 
| event\$1version |  The version of the event JSON schema.  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](#event-streams-data-app-attributes-application) table. | 
| client | Information about the endpoint that reported the event. For more information, see the [Client](#event-streams-data-app-attributes-client) table. | 
| device | Information about the device that reported the event. For more information, see the [Device](#event-streams-data-app-attributes-device) table. | 
| session | Information about the session that generated the event. For more information, see the [Session](#event-streams-data-app-attributes-session) table. | 
| attributes |  Attributes that are associated with the event. For events that are reported by your apps, this object includes custom attributes that you define.  | 
| metrics | Metrics that are related to the event. You can optionally configure your apps to send custom metrics to Amazon Pinpoint. | 

### Application
<a name="event-streams-data-app-attributes-application"></a>

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


| Attribute | Description | 
| --- | --- | 
| app\$1id |  The unique ID of the Amazon Pinpoint project that reported the event.  | 
| cognito\$1identity\$1pool\$1id |  The ID of the Amazon Cognito Identity Pool that the endpoint is associated with.  | 
| package\$1name |  The name of the app package, such as `com.example.my_app`.  | 
| sdk |  Information about the SDK that was used to report the event. For more information, see the [SDK](#event-streams-data-app-attributes-application-sdk) table.  | 
| title |  The name of the app.  | 
| version\$1name |  The name of the version of the app, such as `V2.5`.  | 
| version\$1code |  The version number of the app, such as `3`.  | 

#### SDK
<a name="event-streams-data-app-attributes-application-sdk"></a>

Includes information about the SDK that was used to report the event.


| Attribute | Description | 
| --- | --- | 
| name | The name of the SDK that was used to report the event. | 
| version | The version of the SDK. | 

### Client
<a name="event-streams-data-app-attributes-client"></a>

Includes information about the endpoint that generated the event.


| Attribute | Description | 
| --- | --- | 
| client\$1id | The ID of the endpoint. | 
| cognito\$1id | The Amazon Cognito ID token that's associated with the endpoint. | 

### Device
<a name="event-streams-data-app-attributes-device"></a>

Includes information about the device of the endpoint that generated the event.


| Attribute | Description | 
| --- | --- | 
| locale |  Information about the language and region settings for the endpoint's device. For more information, see the [Locale](#event-streams-data-app-attributes-device-locale) table.  | 
| make | The manufacturer of the endpoint's device. | 
| model | The model identifier of the endpoint's device. | 
| platform |  Information about the operating system on the endpoint's device. For more information, see the [Platform](#event-streams-data-app-attributes-device-platform) table.  | 

#### Locale
<a name="event-streams-data-app-attributes-device-locale"></a>

Includes information about the language and region settings for the endpoint's device.


| Attribute | Description | 
| --- | --- | 
| code | The locale identifier that's associated with the device. | 
| country | The country or region that's associated with the device's locale. | 
| language | The language that's associated with the device's locale. | 

#### Platform
<a name="event-streams-data-app-attributes-device-platform"></a>

Includes information about the operating system on the endpoint's device.


| Attribute | Description | 
| --- | --- | 
| name | The name of the operating system on the device. | 
| version | The version of the operating system on the device. | 

### Session
<a name="event-streams-data-app-attributes-session"></a>

Includes information about the session that generated the event.


| Attribute | Description | 
| --- | --- | 
| session\$1id | A unique ID that identifies the session. | 
| start\$1timestamp | The date and time when the session began, shown as Unix time in milliseconds. | 
| stop\$1timestamp | The date and time when the session ended, shown as Unix time in milliseconds. | 

# Campaign event data stream from Amazon Pinpoint
<a name="event-streams-data-campaign"></a>

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](event-streams-data-email.md) and [SMS event data stream from Amazon Pinpoint](event-streams-data-sms.md). 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](event-streams-setup.md). 

## Campaign event example
<a name="event-streams-data-campaign-example"></a>

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
<a name="event-streams-data-campaign-attributes"></a>

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


| Attribute | Description | 
| --- | --- | 
| event\$1type |  The type of event. Possible values are: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-campaign.html)  | 
| event\$1timestamp | The time when the event was reported, shown as Unix time in milliseconds. | 
| arrival\$1timestamp | The time when the event was received by Amazon Pinpoint, shown as Unix time in milliseconds. | 
| event\$1version |  The version of the event JSON schema.  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](#event-streams-data-campaign-attributes-application) table. | 
| client | Information about the endpoint that the event is associated with. For more information, see the [Client](#event-streams-data-campaign-attributes-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](#event-streams-data-campaign-attributes-attrs) table.  | 
| client\$1context | 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
<a name="event-streams-data-campaign-attributes-application"></a>

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


| Attribute | Description | 
| --- | --- | 
| app\$1id |  The unique ID of the Amazon Pinpoint project that reported the event.  | 
| sdk |  The SDK that was used to report the event.   | 

### Attributes
<a name="event-streams-data-campaign-attributes-attrs"></a>

Includes information about the campaign that produced the event.


| Attribute | Description | 
| --- | --- | 
| treatment\$1id |  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\$1activity\$1id | The unique ID that Amazon Pinpoint generates when the event occurs. | 
| delivery\$1type |  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](channels-custom.md). Possible values are: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-campaign.html)  | 
| campaign\$1id |  The unique ID of the campaign that the message was sent from.  | 
| campaign\$1send\$1status | Indicates the status of the campaign for the target endpoint. Possible values include:[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-campaign.html)  | 

### Client
<a name="event-streams-data-campaign-attributes-client"></a>

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


| Attribute | Description | 
| --- | --- | 
| client\$1id | The ID of the endpoint that the campaign was sent to. | 

# Journey event data from Amazon Pinpoint
<a name="event-streams-data-journey"></a>

When you publish a journey, Amazon Pinpoint can stream event data for email, SMS, push, and custom messages that you send from the journey. After you set up event streaming, Amazon Pinpoint retrieves the data 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](event-streams-data-email.md) and [SMS event data stream from Amazon Pinpoint](event-streams-data-sms.md). 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](event-streams-setup.md).

## Journey event example
<a name="event-streams-data-journey-example"></a>

The JSON object for a journey event contains the data shown in the following sample.

```
{
   "event_type":"_journey.send",
   "event_timestamp":1572989078843,
   "arrival_timestamp":1572989078843,
   "event_version":"3.1",
   "application":{
      "app_id":"a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
      "sdk":{

      }
   },
   "client":{
      "client_id":"d8dcf7c5-e81a-48ae-8313-f540cexample"
   },
   "device":{
      "platform":{

      }
   },
   "session":{

   },
   "attributes":{
      "journey_run_id":"edc9a0b577164d1daf72ebd15example",
      "journey_send_status":"SUCCESS",
      "journey_id":"546401670c5547b08811ac6a9example",
      "journey_activity_id":"0yKexample",
      "journey_activity_type": "EMAIL",
      "journey_send_status_message": "200", 
      "journey_send_status_code": "200"
   },
   "client_context":{
      "custom":{
         "endpoint":"{\"ChannelType\":\"EMAIL\",\"EndpointStatus\":\"ACTIVE\",\"OptOut\":\"NONE\",\"Demographic\":{\"Timezone\":\"America/Los_Angeles\"}}"
      }
   },
   "awsAccountId":"123456789012"
}
```

## Journey event attributes
<a name="event-streams-data-journey-attributes"></a>

This section defines the attributes that are included in the event stream data that Amazon Pinpoint generates for a journey.


| Attribute | Description | 
| --- | --- | 
| event\$1type |  The type of event. For journey events, the value for this attribute is always `_journey.send`, which indicates that Amazon Pinpoint executed the journey.  | 
| event\$1timestamp | The time when the event was reported, shown as Unix time in milliseconds. | 
| arrival\$1timestamp | The time when the event was received by Amazon Pinpoint, shown as Unix time in milliseconds. | 
| event\$1version |  The version of the event JSON schema.  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](#event-streams-data-journey-attributes-application) table. | 
| client | Information about the endpoint that's associated with the event. For more information, see the [Client](#event-streams-data-journey-attributes-client) table. | 
| device | Information about the device that reported the event. For journeys, this object is empty. | 
| session | Information about the session that generated the event. For journeys, this object is empty. | 
| attributes |  Attributes that are associated with the journey and journey activity that generated the event. For more information, see the [Attributes](#event-streams-data-journey-attributes-attrs) table.  | 
| client\$1context | Contains a custom object, which contains an endpoint property. The endpoint property contains the contents of the endpoint record for the endpoint that's associated with the event. | 
| awsAccountId |  The ID of the AWS account that was used to execute the journey.  | 

### Application
<a name="event-streams-data-journey-attributes-application"></a>

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


| Attribute | Description | 
| --- | --- | 
| app\$1id |  The unique ID of the Amazon Pinpoint project that reported the event.  | 
| sdk |  The SDK that was used to report the event.   | 

### Client
<a name="event-streams-data-journey-attributes-client"></a>

Includes information about the endpoint that's associated with the event.


| Attribute | Description | 
| --- | --- | 
| client\$1id | The ID of the endpoint. | 

### Attributes
<a name="event-streams-data-journey-attributes-attrs"></a>

Includes information about the journey that generated the event.


| Attribute | Description | 
| --- | --- | 
| journey\$1run\$1id |  The unique ID of the journey run that generated the event. Amazon Pinpoint generates and assigns this ID automatically to each new run of a journey.  | 
| journey\$1send\$1status |  Indicates the delivery status of the message that's associated with the event. Possible values include: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-journey.html)  | 
| journey\$1id |  The unique ID of the journey that generated the event.  | 
| journey\$1activity\$1id |  The unique ID of the journey activity that generated the event.  | 
| journey\$1activity\$1type |  The event's journey activity type. This can be **EMAIL**, **SMS**, **PUSH**, **CONTACT\$1CENTER**, or **CUSTOM**.   **VOICE **is not a supported journey activity type. The `journey_activity_type` field is not present when `journey_send_status` is set to **QUIET\$1TIME\$1WAIT\$1FINISHED**.   | 
|  `journey_send_status_message`  | The description of the status of the send event. | 
| journey\$1send\$1status\$1code | The HTTP status code of the request. | 

# Email event data stream from Amazon Pinpoint
<a name="event-streams-data-email"></a>

If you use Amazon Pinpoint to send emails, Amazon Pinpoint can stream event data about those emails. After you set up event streaming, Amazon Pinpoint retrieves your event data from the destination that you specified during setup for you to view. 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](event-streams-setup.md). Amazon Pinpoint streams data about the following types of events for email messages:
+ Sends
+ Deliveries
+ Bounces
+ Complaints
+ Opens
+ Clicks
+ Rejections
+ Unsubscribes
+ Rendering failures

These event types are explained in detail in [Email event attributes](#event-streams-data-email-attributes).

Depending on the API and settings that you use to send email messages, you might see additional event types or different data. For example, if you send messages using configuration sets that publish event data to Amazon Kinesis, such as those provided by Amazon Simple Email Service (Amazon SES), the data can also include events for template-rendering failures. For information about that data, see [Monitoring using Amazon SES event publishing](https://docs.aws.amazon.com/ses/latest/dg/monitor-using-event-publishing.html) in the *Amazon Simple Email Service Developer Guide*. Before you can view your events you have to setup event streaming, see [Set up Amazon Pinpoint to stream app event data through Amazon Kinesis or Amazon Data Firehose](event-streams-setup.md). When setting up event streaming you specify a destination for your event data to be saved to and then you can use the destination to retrieve your event data for viewing.

## Email event examples
<a name="event-streams-data-email-example"></a>

**Email send**  
The JSON object for an *email send* event contains the data shown in the following example.

```
{
  "event_type": "_email.send",
  "event_timestamp": 1564618621380,
  "arrival_timestamp": 1564618622025,
  "event_version": "3.1",
  "application": {
    "app_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "sdk": {}
  },
  "client": {
    "client_id": "9a311b17-6f8e-4093-be61-4d0bbexample"
  },
  "device": {
    "platform": {}
  },
  "session": {},
  "attributes": {
    "feedback": "received"
  },
  "awsAccountId": "123456789012",
  "facets": {
    "email_channel": {
      "mail_event": {
        "mail": {
          "message_id": "0200000073rnbmd1-mbvdg3uo-q8ia-m3ku-ibd3-ms77kexample-000000",
          "message_send_timestamp": 1564618621380,
          "from_address": "sender@example.com",
          "destination": ["recipient@example.com"],
          "headers_truncated": false,
          "headers": [{
            "name": "From",
            "value": "sender@example.com"
          }, {
            "name": "To",
            "value": "recipient@example.com"
          }, {
            "name": "Subject",
            "value": "Amazon Pinpoint Test"
          }, {
            "name": "MIME-Version",
            "value": "1.0"
          }, {
            "name": "Content-Type",
            "value": "multipart/alternative;  boundary=\"----=_Part_314159_271828\""
          }],
          "common_headers": {
            "from": "sender@example.com",
            "to": ["recipient@example.com"],
            "subject": "Amazon Pinpoint Test"
          }
        },
        "send": {}
      }
    }
  }
}
```

**Email delivered**  
The JSON object for an *email delivered* event contains the data shown in the following example.

```
{
  "event_type": "_email.delivered",
  "event_timestamp": 1564618621380,
  "arrival_timestamp": 1564618622690,
  "event_version": "3.1",
  "application": {
    "app_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "sdk": {}
  },
  "client": {
    "client_id": "e9a3000d-daa2-40dc-ac47-1cd34example"
  },
  "device": {
    "platform": {}
  },
  "session": {},
  "attributes": {
    "feedback": "delivered"
  },
  "awsAccountId": "123456789012",
  "facets": {
    "email_channel": {
      "mail_event": {
        "mail": {
          "message_id": "0200000073rnbmd1-mbvdg3uo-q8ia-m3ku-ibd3-ms77kexample-000000",
          "message_send_timestamp": 1564618621380,
          "from_address": "sender@example.com",
          "destination": ["recipient@example.com"],
          "headers_truncated": false,
          "headers": [{
            "name": "From",
            "value": "sender@example.com"
          }, {
            "name": "To",
            "value": "recipient@example.com"
          }, {
            "name": "Subject",
            "value": "Amazon Pinpoint Test"
          }, {
            "name": "MIME-Version",
            "value": "1.0"
          }, {
            "name": "Content-Type",
            "value": "multipart/alternative;  boundary=\"----=_Part_314159_271828\""
          }],
          "common_headers": {
            "from": "sender@example.com",
            "to": ["recipient@example.com"],
            "subject": "Amazon Pinpoint Test"
          }
        },
        "delivery": {
          "smtp_response": "250 ok:  Message 82080542 accepted",
          "reporting_mta": "a8-53.smtp-out.amazonses.com",
          "recipients": ["recipient@example.com"],
          "processing_time_millis": 1310
        }
      }
    }
  }
}
```

**Email click**  
The JSON object for an *email click* event contains the data shown in the following example.

```
{
  "event_type": "_email.click",
  "event_timestamp": 1564618621380,
  "arrival_timestamp": 1564618713751,
  "event_version": "3.1",
  "application": {
    "app_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "sdk": {}
  },
  "client": {
    "client_id": "49c1413e-a69c-46dc-b1c4-6470eexample"
  },
  "device": {
    "platform": {}
  },
  "session": {},
  "attributes": {
    "feedback": "https://aws.amazon.com/pinpoint/"
  },
  "awsAccountId": "123456789012",
  "facets": {
    "email_channel": {
      "mail_event": {
        "mail": {
          "message_id": "0200000073rnbmd1-mbvdg3uo-q8ia-m3ku-ibd3-ms77kexample-000000",
          "message_send_timestamp": 1564618621380,
          "from_address": "sender@example.com",
          "destination": ["recipient@example.com"],
          "headers_truncated": false,
          "headers": [{
            "name": "From",
            "value": "sender@example.com"
          }, {
            "name": "To",
            "value": "recipient@example.com"
          }, {
            "name": "Subject",
            "value": "Amazon Pinpoint Test"
          }, {
            "name": "MIME-Version",
            "value": "1.0"
          }, {
            "name": "Content-Type",
            "value": "multipart/alternative;  boundary=\"----=_Part_314159_271828\""
          }, {
            "name": "Message-ID",
            "value": "null"
          }],
          "common_headers": {
            "from": "sender@example.com",
            "to": ["recipient@example.com"],
            "subject": "Amazon Pinpoint Test"
          }
        },
        "click": {
          "ip_address": "72.21.198.67",
          "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15",
          "link": "https://aws.amazon.com/pinpoint/"
        }
      }
    }
  }
}
```

**Email open**  
The JSON object for an *email open* event contains the data shown in the following example.

```
{
  "event_type": "_email.open",
  "event_timestamp": 1564618621380,
  "arrival_timestamp": 1564618712316,
  "event_version": "3.1",
  "application": {
    "app_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "sdk": {}
  },
  "client": {
    "client_id": "8dc1f651-b3ec-46fc-9b67-2a050example"
  },
  "device": {
    "platform": {}
  },
  "session": {},
  "attributes": {
    "feedback": "opened"
  },
  "awsAccountId": "123456789012",
  "facets": {
    "email_channel": {
      "mail_event": {
        "mail": {
          "message_id": "0200000073rnbmd1-mbvdg3uo-q8ia-m3ku-ibd3-ms77kexample-000000",
          "message_send_timestamp": 1564618621380,
          "from_address": "sender@example.com",
          "destination": ["recipient@example.com"],
          "headers_truncated": false,
          "headers": [{
            "name": "From",
            "value": "sender@example.com"
          }, {
            "name": "To",
            "value": "recipient@example.com"
          }, {
            "name": "Subject",
            "value": "Amazon Pinpoint Test"
          }, {
            "name": "MIME-Version",
            "value": "1.0"
          }, {
            "name": "Content-Type",
            "value": "multipart/alternative;  boundary=\"----=_Part_314159_271828\""
          }, {
            "name": "Message-ID",
            "value": "null"
          }],
          "common_headers": {
            "from": "sender@example.com",
            "to": ["recipient@example.com"],
            "subject": "Amazon Pinpoint Test"
          }
        },
        "open": {
          "ip_address": "72.21.198.67",
          "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko)"
        }
      }
    }
  }
}
```

## Email event attributes
<a name="event-streams-data-email-attributes"></a>

This section defines the attributes that are included in the previous example of the event stream data that Amazon Pinpoint generates when you send email messages.


| Attribute | Description | 
| --- | --- | 
| event\$1type |  The type of event. Possible values are: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-email.html)  | 
| event\$1timestamp |  The time when the message was sent, shown as Unix time in milliseconds. This value is typically the same for all the events that are generated for a message.  | 
| arrival\$1timestamp |  The time when the event was received by Amazon Pinpoint, shown as Unix time in milliseconds.  | 
| event\$1version |  The version of the event JSON schema.  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. See the *Application* table for more information.  | 
| client |  Information about the app client that's installed on the device that reported the event. For more information, see the *Client* table.  | 
| device |  Information about the device that reported the event. For more information, see the *Device* table. For email events, this object is empty.  | 
| session | For email events, this object is empty. | 
| attributes |  Attributes that are associated with the event. For more information, see the *Attributes* table. 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 message from a campaign or journey, this object contains attributes that are associated with the campaign or journey. For events that are generated when you send transactional messages, this object contains information that's related to the message itself.  | 
| client\$1context | For email events, this object contains a custom object, which contains a legacy\$1identifier attribute. The value for the legacy\$1identifier attribute is the ID of the project that the message was sent from. | 
| facets |  Additional information about the message, such as the email headers. See the *Facets* table for more information.  | 
| awsAccountId |  The ID of the AWS account that was used to send the message.  | 

### Application
<a name="event-streams-data-email-attributes-application"></a>

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


| Attribute | Description | 
| --- | --- | 
| app\$1id |  The unique ID of the Amazon Pinpoint project that reported the event.  | 
| sdk |  The SDK that was used to report the event. If you send a transactional email message by calling the Amazon Pinpoint API directly or by using the Amazon Pinpoint console, this object is empty.  | 

### Attributes
<a name="event-streams-data-email-attributes-attrs"></a>

Includes information about the campaign or journey that produced the event.

#### Campaign
<a name="event-streams-data-email-attributes-attrs-campaigns"></a>

Includes information about the campaign that produced the event.


| Attribute | Description | 
| --- | --- | 
| feedback |  For `_email.click` events, the value for this attribute is the URL of the link that the recipient clicked in the message to generate the event. For other events, this value represents the event type, such as `received`, `opened`, or `clicked`.  | 
| treatment\$1id |  If the message was sent using an A/B test campaign, this value represents the treatment number of the message. For standard campaigns and transactional email messages, this value is `0`.  | 
| campaign\$1activity\$1id | The unique ID that Amazon Pinpoint generates when the event occurs. | 
| campaign\$1id |  The unique ID of the campaign that sent the message.  | 

#### Journey
<a name="event-streams-data-email-attributes-attrs-journey"></a>

Includes information about the journey that produced the event.


| Attribute | Description | 
| --- | --- | 
| journey\$1run\$1id | The unique ID of the journey run that sent the message. Amazon Pinpoint generates and assigns this ID automatically to each new run of a journey. | 
| feedback |  For `_email.click` events, the value for this attribute is the URL of the link that the recipient clicked in the message to generate the event. For other events, this value represents the event type, such as `received`, `delivered`, or `opened`.  | 
| journey\$1id | The unique ID of the journey that sent the message. | 
| journey\$1activity\$1id | The unique ID of the journey activity that sent the message. | 

### Client
<a name="event-streams-data-email-attributes-client"></a>

The unique identifier of the client that was targeted by the campaign or journey.


| Attribute | Description | 
| --- | --- | 
| client\$1id | The ID of the client. The value is the Endpoint ID for campaigns and journeys, and for Transactional sending, it is a UUID. | 

### Facets
<a name="event-streams-data-email-attributes-facets"></a>

Includes information about the message and the event type.


| Attribute | Description | 
| --- | --- | 
| email\$1channel |  Contains a `mail_event` object, which contains two objects: `mail`, and an object that corresponds with the event type.  | 

### Mail
<a name="event-streams-data-email-attributes-mail"></a>

Includes information about the content of the email message, and metadata about the message.


| Attribute | Description | 
| --- | --- | 
| message\$1id |  The unique ID of the message. Amazon Pinpoint automatically generates this ID when it accepts the message.  | 
| message\$1send\$1timestamp |  The date and time when the message was sent, in the format specified in [RFC 822](https://datatracker.ietf.org/doc/html/rfc822).  | 
| from\$1address |  The email address that the message was sent from.  | 
| destination |  An array that contains the email addresses that the message was sent to.  | 
| headers\$1truncated |  A Boolean value that indicates whether the email headers were truncated.  | 
| headers |  An object that contains several name-value pairs that correspond to the headers in the message. This object typically contains information about the following headers: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-email.html)  | 
| common\$1headers |  Contains information about several common headers for email messages. The information can include the date when the message was sent, and the to, from, and subject lines of the message.  | 

# SMS event data stream from Amazon Pinpoint
<a name="event-streams-data-sms"></a>

If the SMS channel is enabled for a project, Amazon Pinpoint can stream event data about SMS message deliveries for the project. After you set up event streaming, Amazon Pinpoint retrieves your event data from the destination that you specified during setup for you to view. 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](event-streams-setup.md). 

**Note**  
SMS events that are generated by carriers can take up to 72 hours to be received and shouldn't be used to determine if there is a delay in outbound message delivery. After 72 hours, if Amazon Pinpoint hasn't received a final event from a carrier, the service automatically returns an UNKNOWN record\$1status, as Amazon Pinpoint doesn't know what happened to that message.

## SMS event example
<a name="event-streams-data-sms-example"></a>

The JSON object for an SMS event contains the data shown in the following example.

```
{
  "event_type": "_SMS.SUCCESS",
  "event_timestamp": 1553104954322,
  "arrival_timestamp": 1553104954064,
  "event_version": "3.1",
  "application": {
    "app_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "sdk": {}
  },
  "client": {
    "client_id": "123456789012"
  },
  "device": {
    "platform": {}
  },
  "session": {},
  "attributes": {
    "sender_request_id": "565d4425-4b3a-11e9-b0a5-example",
    "campaign_activity_id": "cbcfc3c5e3bd48a8ae2b9cb41example",
    "origination_phone_number": "+12065550142",
    "destination_phone_number": "+14255550199",
    "record_status": "DELIVERED",
    "iso_country_code": "US",
    "treatment_id": "0",
    "number_of_message_parts": "1",
    "message_id": "1111-2222-3333",
    "message_type": "Transactional",
    "campaign_id": "52dc44b35c4742c98c5935269example"
    "customer_context": "{\"userId\":\"user-id-4\"}"
  },
  "metrics": {
    "price_in_millicents_usd": 645.0
  },
  "awsAccountId": "123456789012"
}
```

## SMS event attributes
<a name="event-streams-data-sms-attributes"></a>

This section defines the attributes that are included in the previous example of the event stream data that Amazon Pinpoint generates when you send SMS messages.


**Event**  

| Attribute | Description | 
| --- | --- | 
| event\$1type |  The type of event. Possible values are: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-sms.html)  | 
| event\$1timestamp | The time when the event was reported, shown as Unix time in milliseconds. | 
| arrival\$1timestamp | The time when the event was received by Amazon Pinpoint, shown as Unix time in milliseconds. | 
| event\$1version |  The version of the event JSON schema.  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](#event-streams-data-sms-attributes-application) table. | 
| client | Information about the app client installed on the device that reported the event. For more information, see the [Client](#event-streams-data-sms-attributes-client) table. | 
| device | Information about the device that reported the event. For more information, see the [Device](#event-streams-data-sms-attributes-device) table. For SMS events, this object is empty. | 
| session | For SMS events, 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](#event-streams-data-sms-attributes-attrs) table.  | 
| metrics |  Additional metrics that are associated with the event. For more information, see the [Metrics](#event-streams-data-sms-attributes-metrics) table.  | 
| awsAccountId |  The ID of the AWS account that was used to send the message.  | 

### Application
<a name="event-streams-data-sms-attributes-application"></a>

Includes information about the Amazon Pinpoint project that the event is associated with and, if applicable, the SDK that was used to report the event.


| Attribute | Description | 
| --- | --- | 
| app\$1id |  The unique ID of the Amazon Pinpoint project that reported the event.  | 
| sdk |  The SDK that was used to report the event. If you send a transactional SMS message by calling the Amazon Pinpoint API directly or by using the Amazon Pinpoint console, this object is empty.  | 

### Attributes
<a name="event-streams-data-sms-attributes-attrs"></a>

Includes information about the attributes that are associated with the event.


| Attribute | Description | 
| --- | --- | 
| sender\$1request\$1id | A unique ID that's associated with the request to send the SMS message. | 
| campaign\$1activity\$1id | The unique ID of the activity within the campaign. | 
| origination\$1phone\$1number |  The phone number that the message was sent from.  | 
| destination\$1phone\$1number |  The phone number that you attempted to send the message to.  | 
| record\$1status |  Additional information about the status of the message. Possible values include: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/pinpoint/latest/developerguide/event-streams-data-sms.html)  | 
| iso\$1country\$1code |  The country that's associated with the recipient's phone number, shown in ISO 3166-1 alpha-2 format.  | 
| treatment\$1id |  The ID of the message treatment, if the message was sent in an A/B campaign.  | 
| treatment\$1id |  If the message was sent using an A/B test campaign, this value represents the treatment number of the message. For transactional SMS messages, this value is 0.  | 
| number\$1of\$1message\$1parts |  The number of message parts that Amazon Pinpoint created in order to send the message. Generally, SMS messages can contain only 160 GSM-7 characters or 67 non-GSM characters, although these limits can vary by country . If you send a message that exceeds these limits, Amazon Pinpoint automatically splits the message into smaller parts. We bill you based on the number of message parts that you send.  | 
| message\$1id |  The unique ID that Amazon Pinpoint generates when it accepts the message.  | 
| message\$1type |  The type of message. Possible values are **Promotional** and **Transactional**. You specify this value when you create a campaign, or when you send transactional messages by using the [SendMessages](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#SendMessages) operation in the Amazon Pinpoint API.  | 
| campaign\$1id |  The unique ID of the Amazon Pinpoint campaign that sent the message.  | 
| customer\$1context | A JSON string of the contents from the `Context` map sent in a Amazon Pinpoint [SendMessages](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-messages.html#SendMessages) operation. | 

### Client
<a name="event-streams-data-sms-attributes-client"></a>

Includes information about the app client that's installed on the device that reported the event.


| Attribute | Description | 
| --- | --- | 
| client\$1id |  For events that are generated by apps, this value is the unique ID of the app client that's installed on the device. This ID is automatically generated by the AWS Mobile SDK for iOS and the AWS Mobile SDK for Android. For events that are generated when you send campaigns and transactional messages, this value is equal to the ID of the endpoint that you sent the message to.  | 
| cognito\$1id | The unique ID assigned to the app client in the Amazon Cognito identity pool used by your app. | 

### Device
<a name="event-streams-data-sms-attributes-device"></a>

Includes information about the device that reported the event.


| Attribute | Description | 
| --- | --- | 
| locale | The device locale. | 
| make | The device make, such as Apple or Samsung. | 
| model | The device model, such as iPhone. | 
| platform | The device platform, such as ios or android. | 

### Metrics
<a name="event-streams-data-sms-attributes-metrics"></a>

Includes information about metrics that are associated with the event.


| Attribute | Description | 
| --- | --- | 
| price\$1in\$1millicents\$1usd | The amount that we charged you to send the message. This price is shown in thousandths of a United States cent. For example, if the value of this attribute is `645`, then we charged you 0.645¢ to send the message (645 / 1000 = 0.645¢ = \$10.00645).  This property doesn't appear for messages with an `event_type` of **\$1SMS.BUFFERED**.   | 

# Delete an event stream from Amazon Pinpoint
<a name="event-streams-disable"></a>

If you assign a Kinesis stream to an application, you can disable event streaming for that application. Amazon Pinpoint stops streaming the events to Kinesis, but you can view event analytics by using the Amazon Pinpoint console.

## AWS CLI
<a name="event-streams-disable-cli"></a>

Use the [https://docs.aws.amazon.com/cli/latest/reference/pinpoint/delete-event-stream.html](https://docs.aws.amazon.com/cli/latest/reference/pinpoint/delete-event-stream.html) command:

```
aws pinpoint delete-event-stream --application-id application-id
```

## AWS SDK for Java
<a name="event-streams-disable-java"></a>

Use the [https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/pinpoint/model/DeleteEventStreamRequest.html](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/pinpoint/model/DeleteEventStreamRequest.html) method of the Amazon Pinpoint client:

```
pinClient.deleteEventStream(new DeleteEventStreamRequest().withApplicationId(appId));
```