1

I am trying to send the Alert/Remainder via POSTMan to my skill.

Option 1: Authentication token API with Scope "alexa:skill_messaging"

POST /auth/o2/token HTTP/1.1
Host: api.amazon.com
Content-Type: application/x-www-form-urlencoded
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 2ae7afa3-c3f8-493f-b6e3-2db1e44e3a17,a4e45e8e-d0eb-4b3f-a612-e7d1959fdbe6
Host: api.amazon.com
Accept-Encoding: gzip, deflate
Content-Length: 236
Connection: keep-alive
cache-control: no-cache

grant_type=client_credentials&client_id=******************&client_secret=***********17a4f7b348982bdb4&scope=alexa%3Askill_messaging

Screenshote: enter image description here

option 2: Authentication token API with Scope "alexa::alerts:reminders:skill:readwrite"

POST /auth/o2/token HTTP/1.1
Host: api.amazon.com
Content-Type: application/x-www-form-urlencoded
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 2ae7afa3-c3f8-493f-b6e3-2db1e44e3a17,c6765f77-6e35-419f-b614-780dae20ad4e
Host: api.amazon.com
Accept-Encoding: gzip, deflate
Content-Length: 236
Connection: keep-alive
cache-control: no-cache

grant_type=client_credentials&client_id=**************************&client_secret=************************&scope=alexa%3A%3Aalerts%3Areminders%3Askill%3Areadwrite

enter image description here

Step 2: Submitting the Alert request using token generated by Scope "alexa:skill_messaging" getting Invalide Bearer token

enter image description here

Let me know if I am missing anything and also where can find different scope for Alexa Authenictaion Token API

Tân
  • 1
  • 15
  • 56
  • 102
bgara
  • 143
  • 1
  • 12

1 Answers1

0

Unfortunately,

"That's a limitation of the Reminders API - you need to use the in-session access token to create reminders. You can run GET, UPDATE and DELETE operations out of session as well, so check this out for more information."

Only speaking with the device is possible get in-session access token to create reminders.

Out-session - Get reminders created by the skill (Skill Messaging API):

    const IncomingMessageHandler = {
        canHandle(handlerInput) {
            const request = handlerInput.requestEnvelope.request;
            return request.type === 'Messaging.MessageReceived'
        },
        async handle(handlerInput) {
            const { requestEnvelope, context } = handlerInput;
            console.log(`Message content: ${JSON.stringify(requestEnvelope.request.message)}`);

            try {
              const client = handlerInput.serviceClientFactory.getReminderManagementServiceClient();
              const remindersResponse = await client.getReminders();
              console.log(JSON.stringify(remindersResponse));
            } catch (error) {
              console.log(`error message: ${error.message}`);
              console.log(`error stack: ${error.stack}`);
              console.log(`error status code: ${error.statusCode}`);
              console.log(`error response: ${error.response}`);
            }

            context.succeed();
        }
    }

https://developer.amazon.com/docs/smapi/alexa-reminders-api-reference.html#in-session-and-out-of-session-behavior-for-alexa-reminders-api

https://forums.developer.amazon.com/questions/196445/reminders-can-only-be-created-in-session.html#answer-196860

https://developer.amazon.com/pt-BR/docs/alexa/smapi/skill-messaging-api-reference.html

Deividson Damasio
  • 431
  • 1
  • 6
  • 15