GetInAppMessages Amazon Pinpoint API response JSON example - Amazon Pinpoint

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. 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.

GetInAppMessages Amazon Pinpoint API response JSON example

When you call the GetInAppMessages API operation, it returns a list of messages that the specified endpoint is entitled to. Your app can then render the message based on the values in the response.

The following is an example of the JSON object that is returned when you call the GetInAppMessages API:

{ "InAppMessagesResponse":{ "InAppMessageCampaigns":[ { "CampaignId":"inAppTestCampaign-4c545b28d21a490cb51b0b364example", "DailyCap":0, "InAppMessage":{ "Content":[ { "BackgroundColor":"#f8e71c", "BodyConfig":{ "Alignment":"CENTER", "Body":"This is a sample in-app message sent using Amazon Pinpoint.", "TextColor":"#d0021b" }, "HeaderConfig":{ "Alignment":"CENTER", "Header":"Sample In-App Message", "TextColor":"#d0021b" }, "ImageUrl":"https://example.com/images/thumbnail.png", "PrimaryBtn":{ "DefaultConfig":{ "BackgroundColor":"#d0021b", "BorderRadius":50, "ButtonAction":"CLOSE", "Text":"Dismiss", "TextColor":"#f8e71c" } } } ], "Layout":"MIDDLE_BANNER" }, "Priority":3, "Schedule":{ "EndDate":"2021-11-06T00:08:05Z", "EventFilter":{ "Dimensions":{ "Attributes":{ }, "EventType":{ "DimensionType":"INCLUSIVE", "Values":[ "_session.start" ] }, "Metrics":{ } } } }, "SessionCap":0, "TotalCap":0, "TreatmentId":"0" } ] } }

The following sections provide information about the components of this response, and their attributes.

InAppMessageCampaigns object

The InAppMessageCampaigns object contains the following attributes:

Attribute Description Where it's set

CampaignId

A string that contains the name and unique campaign ID of the Amazon Pinpoint campaign that the message was sent from. The name precedes the campaign ID. The two values are separated with a hyphen (-).

Automatically created by Amazon Pinpoint when you create the campaign.

TreatmentId

An integer that represents the ID of the campaign treatment for this message. If the campaign only has one treatment, the value is 0.

Priority

The priority of the in-app message, expressed as an integer between 1 and 5, inclusive, where 1 indicates the highest priority, and 5 indicates the lowest priority.

Step 1 of the campaign creation process.

InAppMessage

An InAppMessage object that contains information about how the message is rendered.

Based on the content in the in-app message template that was specified for the campaign.

Schedule

A Schedule object that contains information about when the message was sent.

Step 4 of the campaign creation process (if the campaign was created in the console) or the Schedule object (if the campaign was created using the API or an SDK).

DailyCap

The number of times, shown as an integer, that an in-app message can be shown to the user during a 24-hour period.

Inherited from project-level settings. If the campaign includes settings that override the project settings, then those are used instead.

SessionCap

The number of times, expressed as an integer, that an in-app message can be shown to the user during an application session.

TotalCap

The total number of times, expressed as an integer, that any in-app message can be shown to an endpoint per campaign.

InAppMessage object

The InAppMessage object contains the following attributes:

Attribute Description Where it's set

Content

An array containing an InAppMessageContent object, which describes the content of the message.

Based on the content in the in-app message template that was specified for the campaign.

Layout

A string that describes how the in-app message will appear on the recipient's device. Possible values are:

  • BOTTOM_BANNER – a message that appears as a banner at the bottom of the page.

  • TOP_BANNER – a message that appears as a banner at the top of the page.

  • OVERLAYS – a message that covers entire screen.

  • MOBILE_FEED – a message that appears in a window in front of the page.

  • MIDDLE_BANNER – a message that appears as a banner in the middle of the page.

  • CAROUSEL – a scrollable layout of up to five unique messages.

HeaderConfig object

The HeaderConfig object contains the following attributes:

Attribute Description Where it's set

Alignment

A string that specifies the text alignment of the header text. Possible values are LEFT, CENTER, and RIGHT.

Based on the content in the in-app message template that was specified for the campaign.

Header

The message header text.

TextColor

The color of the header text, expressed as string describing the hex color code (such as "#000000" for black).

BodyConfig object

The BodyConfig object contains the following attributes:

Attribute Description Where it's set

Alignment

A string that specifies the text alignment of the message body. Possible values are LEFT, CENTER, and RIGHT.

Based on the content in the in-app message template that was specified for the campaign.

Body

The main body text of the message.

TextColor

The color of the body text, expressed as a string containing a hex color code (such as "#000000" for black).

InAppMessageContent object

The InAppMessageContent object contains the following attributes:

Attribute Description Where it's set

BackgroundColor

The background color of the in-app message, expressed as a string containing a hex color code (such as "#000000" for black).

Based on the content in the in-app message template that was specified for the campaign.

BodyConfig

A BodyConfig object, which contains information related to the main body content of the message.

HeaderConfig

A HeaderConfig object, which contains information related to the header or title of the message.

ImageUrl

The URL of the image that appears in the message.

PrimaryBtn

An InAppMessageButton object that contains information about the main button in the message.

SecondaryBtn

An InAppMessageButton object that contains information about the secondary button in the message. Not present if the in-app message template doesn't specify a secondary button.

Schedule object

The Schedule object contains the following attributes:

Attribute Description Where it's set

EndDate

The scheduled time, in ISO 8601 format, when the campaign will end.

Step 4 of the campaign creation process (if the campaign was created in the console) or the Schedule object (if the campaign was created using the API or an SDK).

EventFilter

Information about the event that causes the in-app message to be shown. When you generate an event that matches with an Amazon Pinpoint in-app campaign, the message is displayed.

InAppMessageButton object

An InAppMessageButton object contains the following attributes:

Attribute Description Where it's set

DefaultConfig

A DefaultButtonConfig object that contains information about the default settings for a button in an in-app message.

Based on the content in the in-app message template that was specified for the campaign.

Android

An OverrideButtonConfig object that specifies the way the button behaves on Android devices. This overrides the default button configuration detailed in the DefaultConfig object.

IOS

An OverrideButtonConfig object that specifies the way the button behaves on iOS devices. This overrides the default button configuration detailed in the DefaultConfig object.

Web

An OverrideButtonConfig object that specifies the way the button behaves in web apps. This overrides the default button configuration detailed in the DefaultConfig object.

DefaultButtonConfig object

An DefaultButtonConfig object contains the following attributes:

Attribute Description Where it's set

BackgroundColor

The background color of the button, expressed as a string containing a hex color code (such as "#000000" for black).

Based on the content in the in-app message template that was specified for the campaign.

BorderRadius

The radius of the button's border in pixels, expressed as an integer. A larger number results in more rounded corners.

ButtonAction

A string that describes the action that occurs when a recipient chooses a button in the in-app message. Possible values are:

  • LINK – A link to a web destination.

  • DEEP_LINK – A link to a specific page in an application.

  • CLOSE – Dismisses the message.

Link

The destination URL for a button. Not present for buttons where the ButtonAction is CLOSE.

Text

The text that appears on the button.

TextColor

The color of the text on the button, expressed as a string containing a hex color code (such as "#000000" for black).

OverrideButtonConfig object

The OverrideButtonConfig object is only present if the in-app message template uses override buttons. An override button is a button that has a specific configuration for a particular device type, such as an iOS device, Android device, or a web browser.

An OverrideButtonConfig object contains the following attributes:

Attribute Description Where it's set

ButtonAction

The action that occurs when a recipient chooses a button in the in-app message. Possible values are:

  • LINK – A link to a web destination.

  • DEEP_LINK – A link to a specific page in an application.

  • CLOSE – Dismisses the message.

Based on the content in the in-app message template that was specified for the campaign.

Link

The destination URL for a button. Not present for buttons where the ButtonAction is CLOSE.

Text

The text that appears on the button.

TextColor

The color of the text on the button, expressed as a string containing a hex color code (such as "#000000" for black).