Notification in alexa and google action

google-assistant
amazon-alexa

#1

I have some time recorded in google sheet and I will be setting or updating the notification according to the time in the google sheet using notification API.

Is there a way to update the time in the remainder without invoking the skill. I mean there is some time in the google sheet and reminders are set for that time after some time the time in the google sheet is changed. Is there a way to change the remainder time in Alexa without again invoking the skill?


#2

Hey! Looks like it’s possible for both. Here’s what I found.

Alexa

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

Google Assistant


#3

Can you please give some example codes to work with out of session remainders in jovo in alexa. I tried but I did’nt get the correct idea to implement this. Thanks in advance


#4

You have to do a few steps. I’m copying the relevant parts from the Alexa docs

Step 1:
Obtain Skill AccessToken https://developer.amazon.com/en-US/docs/alexa/smapi/skill-messaging-api-reference.html#obtain-the-skill-messaging-token

You get the client id and the client secret for your skill in your build -> permissions tab in the developer console.

SKILL_CLIENT_ID='YOUR_SKILL_CLIENT_ID'
SKILL_CLIENT_SECRET='YOUR_SKILL_CLIENT_SECRET'
API_URL='https://api.amazon.com/auth/O2/token'

curl -k -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -d "grant_type=client_credentials&scope=alexa:skill_messaging&client_id=$SKILL_CLIENT_ID&client_secret=$SKILL_CLIENT_SECRET" \
    $API_URL

You will get an access token. Use this access token posting messages to your skills via the messaging API.

Step 2: Send a message to your skill with the Alexa user id (where you want to change the reminders)

ALEXA_USER_ID='ReplaceWithUserId'
SKILL_MESSAGING_TOKEN='ReplaceWithToken'
MESSAGE='{"data":{ "sampleMessage": "Sample Message"}, "expiresAfterSeconds": 60}'
API_URL=https://api.amazonalexa.com/v1/skillmessages/users/$ALEXA_USER_ID

 curl -v -s -k -X POST \
      -H "Authorization: Bearer $SKILL_MESSAGING_TOKEN" \
      -H "Content-Type: application/json" \
      -d "$MESSAGE" \
      $API_URL

Step 3: Receive the message in your skill and view/change reminders as always. I just checked. It’s not the cleanest approach but it should work:

// 
async ON_REQUEST() {
        if ((this.$request as AlexaRequest).request?.type === 'Messaging.MessageReceived') {
            const reminders = await this.$alexaSkill!.$user.getAllReminders();
            console.log(reminders);
            return;
        }
    },

Hope this helps


Alexa notification anouncement (proactive events)
#6

Thank you so much for the detailed explanation .But when I do the second curl request I got the error invalid user id. first curl request was success and I got the token.

curl -v -s -k -X POST
-H “Authorization: Bearer Atc|MQEB****************”
-H “Content-Type: application/json”
-d ‘{“data”:{ “sampleMessage”: “Sample Message”}, “expiresAfterSeconds”: 60}’
https://api.amazonalexa.com/v1/skillmessages/users/amzn1.ask.account.AH7*************


#7

This could be different for you.

I had to change to https://api.eu.amazonalexa.com. It depends on your region. You get your apiEndpointUrl in the request json.