Last active
May 19, 2019 11:03
-
-
Save pschild/288b1135b304dfad75fedd0820455df5 to your computer and use it in GitHub Desktop.
Alexa Proactive Events API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) POST to https://api.amazon.com/auth/o2/token | |
body { | |
grant_type: client_credentials, | |
client_id: amzn1.application..., | |
client_secret: ..., | |
scope: alexa::proactive_events | |
} | |
Response: | |
{ | |
"access_token": "<ACCESS_TOKEN>", | |
"scope": "alexa::proactive_events", | |
"token_type": "bearer", | |
"expires_in": 3600 | |
} | |
2) POST to https://api.eu.amazonalexa.com/v1/proactiveEvents/stages/development | |
headers { | |
Content-Type: application/json, | |
Authorization: Bearer <ACCESS_TOKEN> | |
} | |
body { | |
"timestamp": "2019-05-18T19:22:00.00Z", | |
"referenceId": "unique-id-of-this-instance", | |
"expiryTime": "2019-05-18T19:22:00.00Z", | |
"event": { | |
"name": "AMAZON.MessageAlert.Activated", | |
"payload": { | |
"state": { | |
"status": "UNREAD", | |
"freshness": "NEW" | |
}, | |
"messageGroup": { | |
"creator": { | |
"name": "Test" | |
}, | |
"count": 6, | |
"urgency": "URGENT" | |
} | |
} | |
}, | |
"localizedAttributes": [], | |
"relevantAudience": { | |
"type": "Unicast", | |
"payload": { | |
"user": "amzn1.ask.account...." // get with console.log(request.context.System.user.userId); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest": { | |
"publishingInformation": {...}, | |
"apis": {...}, | |
"manifestVersion": "1.0", | |
"permissions": [ | |
{ | |
"name": "alexa::devices:all:notifications:write" | |
} | |
], | |
"events": { | |
"publications": [ | |
{ | |
"eventName": "AMAZON.MessageAlert.Activated" | |
} | |
], | |
"endpoint": { | |
"uri": "<DYNAMIC>" | |
}, | |
"subscriptions": [ | |
{ | |
"eventName": "SKILL_PROACTIVE_SUBSCRIPTION_CHANGED" | |
} | |
], | |
"regions": { | |
"NA": { | |
"endpoint": { | |
"uri": "<DYNAMIC>" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment