Get location from Alexa Skills Kit (ASK)

前端 未结 5 1061
广开言路
广开言路 2020-12-15 05:06

I\'m looking for a way to get the user\'s location, ideally longitude/latitude but address would work too, from the Alexa Skill Kit request to my custom skill. Also, I don\'

5条回答
  •  無奈伤痛
    2020-12-15 06:10

    Please follow the below URL to Get location from Alexa Skills Kit (ASK)

    URL: https://api.eu.amazonalexa.com/v1/devices/{devicesId}/settings/address/countryAndPostalCode

    Your Header would be something like below :

    Host:api.eu.amazonalexa.com[keep your host you can get is from developer account during testing from json]
    Accept:application/json
    Authorization:Bearer [KEEP YOUR apiAccessToken here]
    

    if request went success your will get response as below:

    {
        "countryCode": "IN",
        "postalCode": "560102"
    }
    

    Make sure you have enabled permission in the Alexa app, and grants the permission of the respective skill please refer the bellow URL for more details of permission configuration

    https://developer.amazon.com/blogs/alexa/post/0c975fc7-17dd-4f5c-8343-a37024b66c99/alexa-skill-recipe-using-the-device-address-api-to-request-information

提交回复
热议问题