Page updated Nov 9, 2023

Update Endpoint

An endpoint uniquely identifies your app within Pinpoint. In order to update your endpoint use the updateEndpoint() method:

1import { Analytics } from 'aws-amplify';
2
3// NOTE: All fields are OPTIONAL
4await Analytics.updateEndpoint({
5 address: 'xxxxxxx', // The unique identifier for the recipient. For example, an address could be a device token, email address, or mobile phone number.
6 attributes: {
7 // Custom attributes that your app reports to Amazon Pinpoint. You can use these attributes as selection criteria when you create a segment.
8 hobbies: ['piano', 'hiking'] // MUST be an array, even single value
9 },
10 channelType: 'APNS', // The channel type. Valid values: APNS, GCM
11 demographic: {
12 appVersion: 'xxxxxxx', // The version of the application associated with the endpoint.
13 locale: 'xxxxxx', // 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
14 make: 'xxxxxx', // The manufacturer of the endpoint device, such as Apple or Samsung.
15 model: 'xxxxxx', // The model name or number of the endpoint device, such as iPhone.
16 modelVersion: 'xxxxxx', // The model version of the endpoint device.
17 platform: 'xxxxxx', // The platform of the endpoint device, such as iOS or Android.
18 platformVersion: 'xxxxxx', // The platform version of the endpoint device.
19 timezone: 'xxxxxx' // The timezone of the endpoint. Specified as a tz database value, such as Americas/Los_Angeles.
20 },
21 location: {
22 city: 'xxxxxx', // The city where the endpoint is located.
23 country: 'xxxxxx', // 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.
24 latitude: 0, // The latitude of the endpoint location, rounded to one decimal place.
25 longitude: 0, // The longitude of the endpoint location, rounded to one decimal place.
26 postalCode: 'xxxxxx', // The postal code or zip code of the endpoint.
27 region: 'xxxxxx' // The region of the endpoint location. For example, in the United States, this corresponds to a state.
28 },
29 metrics: {
30 // Custom metrics that your app reports to Amazon Pinpoint.
31 },
32 /** Indicates whether a user has opted out of receiving messages with one of the following values:
33 * ALL - User has opted out of all messages.
34 * NONE - Users has not opted out and receives all messages.
35 */
36 optOut: 'ALL',
37 // Customized userId
38 userId: 'XXXXXXXXXXXX',
39 // User attributes
40 userAttributes: {
41 interests: ['football', 'basketball', 'AWS']
42 // ...
43 }
44}).then(() => {});

There is a limit of 15 unique endpoints per user ID. See Pinpoint's documentation on endpoint quotas to learn more.

Learn more about Amazon Pinpoint and Endpoints.