Proactive Suggestion REST API Reference
en-US
.Use the Proactive Suggestion REST API to display interactive content on Alexa-enabled devices with a screen. With this API, you provide visual content to Alexa as suggestions. To create the visual experience for your suggestions, you use Alexa Presentation Language (APL).
For more details, see Add Content to the Home Screen of Alexa Devices.
API endpoint
The endpoint of the Proactive Suggestion API is https://api.amazonalexa.com
.
Authentication
Each API request must have an authorization header whose value is the access token retrieved from Login with Amazon (LWA). For details, see Get an Access Token for SMAPI.
Operations
The Proactive Suggestion API includes the following operations.
Description | HTTP method and path |
---|---|
| |
| |
| |
|
Create campaign
Creates a campaign that renders the content as a suggestion to targeted recipients.
Request
To create a campaign, you make a POST
request to the /v1/proactive/campaigns
resource.
Request path and header example
POST /v1/proactive/campaigns
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Header |
String |
Yes |
Request body example
The following example shows a campaign entity that encapsulates the suggestion along with recipients and scheduling specifics for the information.
{
"suggestion": {
"variants": [{
"placement": {
"channel": "HOME"
},
"content": {
"values": [{
"locale": "en-US",
"document": {
"type": "Link",
"src": "doc://alexa/apl/documents/home/cards/textWrapping"
},
"datasources": {
"displayText": {
"headerText": "YourHeaderText",
"primaryText": "YourPrimaryText",
"secondaryText": "YourSecondaryText",
"attributionText": "YourAttributionText",
"hintText": "Try \"{WakeWord}, open SkillName\"",
"action": {
"type": "SkillConnection",
"uri": "connection://AMAZON.ColdLaunch/1?provider=amzn1.ask.skill.1",
"input": {}
}
},
"background": {
"backgroundImageSource": "http://url-of-background-image"
}
}
}]
}
}]
},
"targeting": {
"type": "SKILL_SUBSCRIBERS"
},
"scheduling": {
"activationWindow": {
"start": "2021-09-20T21:25:27.179Z",
"end": "2021-10-22T00:25:27.179Z"
}
}
}
Request body properties
Property | Description | Type | Required |
---|---|---|---|
|
Information that Alexa can proactively deliver to users. |
Object |
Yes |
|
List of suggestion variants to present to users. The list must contain at least one variant. |
Array of objects |
Yes |
|
Indicates where to render the content. |
|
Yes |
|
Presentation data to render. |
|
Yes |
|
Defines the recipients of the campaign. |
|
Yes |
|
Defines the schedule to activate the campaign. |
|
Yes |
Response
A successful response returns HTTP 202 Accepted
, along with the list metadata.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message. The response also includes X-Amzn-RequestId
, a unique string identifier that Amazon uses to troubleshoot when a problem occurs.
Response body example
The following example shows a response.
"campaignId": "campaign.id.1"
Response body properties
Property | Description | Type |
---|---|---|
|
Identifies the campaign. |
String |
HTTP status codes
Status | Description |
---|---|
|
Campaign successfully created. |
|
Indicates that one or more properties in the request body aren't valid.
|
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as number of requests per unit of time, exceeded. Retry the request by using exponential back-off. |
|
Error occurred on the server. Retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Delete campaign
Deletes a campaign.
Request
To delete a campaign, you make a DELETE
request to the /v1/proactive/campaigns
resource.
Request path and header example
DELETE /v1/proactive/campaigns/{campaignId}
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the campaign. |
String |
Yes |
|
Header |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 202 Accepted
.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message. The response also includes X-Amzn-RequestId
, a unique string identifier that Amazon uses to troubleshoot when a problem occurs.
Response body example
The response has no body.
Response body properties
The response has no body.
HTTP status codes
Status | Description |
---|---|
|
Campaign deleted successfully. |
|
Indicates that one or more properties in the request body aren't valid.
|
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as number of requests per unit of time, exceeded. Retry the request by using exponential back-off. |
|
Error occurred on the server. Retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Get campaign
Retrieve the specified campaign.
Request
To get a campaign, you make a GET
request to the /v1/proactive/campaigns
resource.
Request path and header example
GET /v1/proactive/campaigns/{campaignId}
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the campaign. |
String |
Yes |
|
Header |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 200 OK
, along with the specified campaign.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message.The response also includes X-Amzn-RequestId
, a unique string identifier that Amazon uses to troubleshoot when a problem occurs.
Response body example
{
"campaignId": "campaign.id.1",
"suggestion": {
"variants": [{
"placement": {
"channel": "HOME"
},
"content": {
"values": [{
"locale": "en-US",
"document": {
"type": "Link",
"src": "doc://alexa/apl/documents/home/cards/textWrapping"
},
"datasources": {
"displayText": {
"headerText": "YourHeaderText",
"primaryText": "YourPrimaryText",
"secondaryText": "YourSecondaryText",
"attributionText": "YourAttributionText",
"hintText": "Try \"{WakeWord}, open SkillName\"",
"action": {
"type": "SkillConnection",
"uri": "connection://AMAZON.ColdLaunch/1?provider=amzn1.ask.skill.1",
"input": {}
}
},
"background": {
"backgroundImageSource": "http://url-of-background-image"
}
}
}]
}
}]
},
"targeting": {
"type": "SKILL_SUBSCRIBERS"
},
"scheduling": {
"activationWindow": {
"start": "2021-01-01T10:00:00.00Z",
"end": "2021-01-31T10:00:00.00Z"
}
},
"validationStatus": {
"value": "APPROVED",
"reason": "Explanation"
}
}
Response body properties
Property | Description | Type |
---|---|---|
|
Identifies the campaign. |
String |
|
Information that Alexa can proactively deliver to users. |
Object |
|
List of suggestions to present to users. The list must contain at least one variant. |
Array of objects |
|
Indicates where to render the content. |
|
|
Presentation data to render. |
|
|
Defines the recipients of the campaign. |
|
|
Defines the schedule to activate the campaign. |
|
|
Latest status for the campaign. |
Object |
|
Validation status of the campaign. |
String |
|
Explanation, if applicable, for the validation status value. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains the specified campaign details. |
|
Indicates that one or more properties in the request body aren't valid.
|
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as number of requests per unit of time, exceeded. Retry the request by using exponential back-off. |
|
Error occurred on the server. Retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
List campaigns
Lists the campaigns that you created.
Request
To list campaigns, you make a GET
request to the /v1/proactive/campaigns
resource.
Request path and header example
GET /v1/proactive/campaigns?maxResults={maxResults}&nextToken={nextToken}
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Query |
Maximum number of results to return in the response. |
Integer |
No |
|
Query |
Token from the previous response. |
String |
No |
|
Header |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 200 OK
, along with a list of campaigns.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message. The response also includes X-Amzn-RequestId
, a unique string identifier that Amazon uses to troubleshoot when a problem occurs.
Response body example
{
"results": [{
"campaignId": "campaign.id.2",
"suggestion": {
"variants": [{
"placement": {
"channel": "HOME"
},
"content": {
"values": [{
"locale": "en-US",
"document": {
"type": "Link",
"src": "doc://alexa/apl/documents/home/cards/textWrapping"
},
"datasources": {
"displayText": {
"headerText": "YourHeaderText",
"primaryText": "YourPrimaryText",
"secondaryText": "YourSecondaryText",
"attributionText": "YourAttributionText",
"hintText": "Try \"{WakeWord}, open SkillName\"",
"action": {
"type": "SkillConnection",
"uri": "connection://AMAZON.ColdLaunch/1?provider=amzn1.ask.skill.1",
"input": {}
}
},
"background": {
"backgroundImageSource": "http://url-of-background-image"
}
}
}]
}
}]
},
"targeting": {
"type": "USERS",
"values": [{
"id": "amzn1.ask.account.1"
}]
},
"scheduling": {
"activationWindow": {
"start": "2021-01-01T10:00:00.00Z",
"end": "2021-01-31T10:00:00.00Z"
}
},
"validationStatus": {
"value": "IN_PROGRESS",
"reason": "Explanation"
}
}],
"paginationContext": {
"nextToken": "someToken.1"
}
}
Response body properties
Property | Description | Type |
---|---|---|
|
List of campaigns you created, along with a validation status for each campaign. |
Array of objects |
|
Identifies the campaign. |
String |
|
Information that Alexa can proactively deliver to users. |
Object |
|
List of suggestions to present to users. The list must contain at least one variant. |
Array of objects |
|
Indicates where to render the content. |
|
|
Presentation data to render. |
|
|
Defines the recipients of the campaign. |
|
|
Defines the schedule to activate the campaign. |
|
|
Latest status for the campaign. |
Object |
|
Validation status of the campaign. |
String |
|
Explanation, if applicable, for the validation status value. |
String |
|
Object containing pagination information. Included if iterating over a paginated response. If omitted, all results were already returned. |
Object |
|
Identifies the next set of campaigns to return. Use in the next call to List campaigns. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains a list of campaigns. |
|
Indicates that one or more properties in the request body aren't valid.
|
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as number of requests per unit of time, exceeded. Retry the request by using exponential back-off. |
|
Error occurred on the server. Retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Object definitions
The Proactive Suggestion API defines the following object definitions.
Content object
The Content object encapsulates the presentation data to render for the campaign.
Property | Description | Type | Required |
---|---|---|---|
|
List of localized presentation data specific to the default content type. At least one localized presentation data element must be present. |
List of objects |
Yes |
|
Locale in which to render the content. |
String |
Yes |
|
Link to the APL document to render. |
Object |
Yes |
|
APL document type. |
String |
Yes |
|
APL document link. |
String |
Yes |
|
Use to bind data to the APL document. |
Map of |
Yes |
|
Text to render in the title field of the document. |
String |
No |
|
Text to render in the body field of the document. |
String |
No |
Placement object
The Placement
object defines where to render the suggestion on the screen.
Property | Description | Type | Required |
---|---|---|---|
|
Name of the channel. |
String |
Yes |
Scheduling object
The Scheduling
object defines the schedule to activate the campaign.
Property | Description | Type | Required |
---|---|---|---|
|
Specifies the time in which a campaign is active. If not included in a request, Alexa uses default values. |
Object |
No |
|
Start time of the activation window. |
String |
No |
|
End of the time of the activation window. |
String |
No |
Target object
The Target
object defines either users or skills that the campaign targets.
Property | Description | Type | Required |
---|---|---|---|
|
Type of targeting criteria to apply. |
String |
Yes |
|
List of user IDs. |
Array of strings |
Yes |
|
User ID formatted as |
String |
Yes |
Related topics
Last updated: May 29, 2024