Amazon Pinpoint

2019/01/17 - Amazon Pinpoint - 1 updated api methods

Changes  This release updates the PutEvents operation. AppPackageName, AppTitle, AppVersionCode, SdkName fields will now be accepted as a part of the event when submitting events.

PutEvents (updated) Link ΒΆ
Changes (request)
{'EventsRequest': {'BatchItem': {'Events': {'AppPackageName': 'string',
                                            'AppTitle': 'string',
                                            'AppVersionCode': 'string',
                                            'SdkName': 'string'}}}}

Use to record events for endpoints. This method creates events and creates or updates the endpoints that those events are associated with.

See also: AWS API Documentation

Request Syntax

client.put_events(
    ApplicationId='string',
    EventsRequest={
        'BatchItem': {
            'string': {
                'Endpoint': {
                    'Address': 'string',
                    'Attributes': {
                        'string': [
                            'string',
                        ]
                    },
                    'ChannelType': 'GCM'|'APNS'|'APNS_SANDBOX'|'APNS_VOIP'|'APNS_VOIP_SANDBOX'|'ADM'|'SMS'|'VOICE'|'EMAIL'|'BAIDU'|'CUSTOM',
                    'Demographic': {
                        'AppVersion': 'string',
                        'Locale': 'string',
                        'Make': 'string',
                        'Model': 'string',
                        'ModelVersion': 'string',
                        'Platform': 'string',
                        'PlatformVersion': 'string',
                        'Timezone': 'string'
                    },
                    'EffectiveDate': 'string',
                    'EndpointStatus': 'string',
                    'Location': {
                        'City': 'string',
                        'Country': 'string',
                        'Latitude': 123.0,
                        'Longitude': 123.0,
                        'PostalCode': 'string',
                        'Region': 'string'
                    },
                    'Metrics': {
                        'string': 123.0
                    },
                    'OptOut': 'string',
                    'RequestId': 'string',
                    'User': {
                        'UserAttributes': {
                            'string': [
                                'string',
                            ]
                        },
                        'UserId': 'string'
                    }
                },
                'Events': {
                    'string': {
                        'AppPackageName': 'string',
                        'AppTitle': 'string',
                        'AppVersionCode': 'string',
                        'Attributes': {
                            'string': 'string'
                        },
                        'ClientSdkVersion': 'string',
                        'EventType': 'string',
                        'Metrics': {
                            'string': 123.0
                        },
                        'SdkName': 'string',
                        'Session': {
                            'Duration': 123,
                            'Id': 'string',
                            'StartTimestamp': 'string',
                            'StopTimestamp': 'string'
                        },
                        'Timestamp': 'string'
                    }
                }
            }
        }
    }
)
type ApplicationId

string

param ApplicationId

[REQUIRED] The unique ID of your Amazon Pinpoint application.

type EventsRequest

dict

param EventsRequest

[REQUIRED] A set of events to process.

  • BatchItem (dict) -- A batch of events to process. Each BatchItem consists of an endpoint ID as the key, and an EventsBatch object as the value.

    • (string) --

      • (dict) -- A batch of PublicEndpoints and Events to process.

        • Endpoint (dict) -- The PublicEndpoint attached to the EndpointId from the request.

          • Address (string) -- The unique identifier for the recipient. For example, an address could be a device token, email address, or mobile phone number.

          • Attributes (dict) -- Custom attributes that your app reports to Amazon Pinpoint. You can use these attributes as selection criteria when you create a segment.

            • (string) --

              • (list) --

                • (string) --

          • ChannelType (string) -- The channel type. Valid values: APNS, GCM

          • Demographic (dict) -- The endpoint demographic attributes.

            • AppVersion (string) -- The version of the application associated with the endpoint.

            • Locale (string) -- The endpoint locale in the following format: The ISO 639-1 alpha-2 code, followed by an underscore, followed by an ISO 3166-1 alpha-2 value.

            • Make (string) -- The manufacturer of the endpoint device, such as Apple or Samsung.

            • Model (string) -- The model name or number of the endpoint device, such as iPhone.

            • ModelVersion (string) -- The model version of the endpoint device.

            • Platform (string) -- The platform of the endpoint device, such as iOS or Android.

            • PlatformVersion (string) -- The platform version of the endpoint device.

            • Timezone (string) -- The timezone of the endpoint. Specified as a tz database value, such as Americas/Los_Angeles.

          • EffectiveDate (string) -- The date and time when the endpoint was last updated, in ISO 8601 format.

          • EndpointStatus (string) -- The status of the endpoint. If the update fails, the value is INACTIVE. If the endpoint is updated successfully, the value is ACTIVE.

          • Location (dict) -- The endpoint location attributes.

            • City (string) -- The city where the endpoint is located.

            • Country (string) -- The two-letter code for the country or region of the endpoint. Specified as an ISO 3166-1 alpha-2 code, such as "US" for the United States.

            • Latitude (float) -- The latitude of the endpoint location, rounded to one decimal place.

            • Longitude (float) -- The longitude of the endpoint location, rounded to one decimal place.

            • PostalCode (string) -- The postal code or zip code of the endpoint.

            • Region (string) -- The region of the endpoint location. For example, in the United States, this corresponds to a state.

          • Metrics (dict) -- Custom metrics that your app reports to Amazon Pinpoint.

            • (string) --

              • (float) --

          • OptOut (string) -- Indicates whether a user has opted out of receiving messages with one of the following values: ALL - User has opted out of all messages. NONE - Users has not opted out and receives all messages.

          • RequestId (string) -- A unique identifier that is generated each time the endpoint is updated.

          • User (dict) -- Custom user-specific attributes that your app reports to Amazon Pinpoint.

            • UserAttributes (dict) -- Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes.

              • (string) --

                • (list) --

                  • (string) --

            • UserId (string) -- The unique ID of the user.

        • Events (dict) -- An object that contains a set of events associated with the endpoint.

          • (string) --

            • (dict) -- Model for creating or updating events.

              • AppPackageName (string) -- The package name associated with the app that's recording the event.

              • AppTitle (string) -- The title of the app that's recording the event.

              • AppVersionCode (string) -- The version number of the app that's recording the event.

              • Attributes (dict) -- Custom attributes that are associated with the event you're adding or updating.

                • (string) --

                  • (string) --

              • ClientSdkVersion (string) -- The version of the SDK that's running on the client device.

              • EventType (string) -- The name of the custom event that you're recording.

              • Metrics (dict) -- Custom metrics related to the event.

                • (string) --

                  • (float) --

              • SdkName (string) -- The name of the SDK that's being used to record the event.

              • Session (dict) -- Information about the session in which the event occurred.

                • Duration (integer) -- The duration of the session, in milliseconds.

                • Id (string) -- A unique identifier for the session.

                • StartTimestamp (string) -- The date and time when the session began.

                • StopTimestamp (string) -- The date and time when the session ended.

              • Timestamp (string) -- The date and time when the event occurred, in ISO 8601 format.

rtype

dict

returns

Response Syntax

{
    'EventsResponse': {
        'Results': {
            'string': {
                'EndpointItemResponse': {
                    'Message': 'string',
                    'StatusCode': 123
                },
                'EventsItemResponse': {
                    'string': {
                        'Message': 'string',
                        'StatusCode': 123
                    }
                }
            }
        }
    }
}

Response Structure

  • (dict) -- 202 response

    • EventsResponse (dict) -- Custom messages associated with events.

      • Results (dict) -- A map that contains a multipart response for each endpoint. Each item in this object uses the endpoint ID as the key, and the item response as the value. If no item response exists, the value can also be one of the following: 202 (if the request was processed successfully) or 400 (if the payload was invalid, or required fields were missing).

        • (string) --

          • (dict) -- The response that's provided after registering the endpoint.

            • EndpointItemResponse (dict) -- The response received after the endpoint was accepted.

              • Message (string) -- A custom message associated with the registration of an endpoint when issuing a response.

              • StatusCode (integer) -- The status code associated with the merging of an endpoint when issuing a response.

            • EventsItemResponse (dict) -- A multipart response object that contains a key and value for each event ID in the request. In each object, the event ID is the key, and an EventItemResponse object is the value.

              • (string) --

                • (dict) -- A complex object that holds the status code and message as a result of processing an event.

                  • Message (string) -- A custom message that is associated with the processing of an event.

                  • StatusCode (integer) -- The status returned in the response as a result of processing the event. Possible values: 400 (for invalid events) and 202 (for events that were accepted).