Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 2.04 KB

File metadata and controls

72 lines (53 loc) · 2.04 KB

Learn more about how to get access to user information.

Introduction

User information is mainly used to offer a more personalized expierence, but you can't access it right away. First you have to ask for permission.

Location

You can use the user's address data to provide location specific features, but you have to obtain their permission first. permission card will do the job:

// Country and Postal Code
this.alexaSkill().showAskForCountryAndPostalCodeCard();

// Device Address
this.alexaSkill().showAskForAddressCard();

Get the country and postal code:

this.alexaSkill().getCountryAndPostalCode();

// example
this.user().getCountryAndPostalCode()
    .then((data) => {
        this.tell('Your address is ' + data.postalCode + ' in ' + data.countryCode);
    }).catch((error) => {
        if (error.code === 'NO_USER_PERMISSION') {
            this.alexaSkill().showAskForCountryAndPostalCodeCard()
                .tell('Please grant access to your address');
        }
    });

Get the address:

this.user().getDeviceAddress();

// example
this.user().getDeviceAddress()
    .then((data) => {
        this.tell('I got your address');
    }).catch((error) => {
        if (error.code === 'NO_USER_PERMISSION') {
            this.alexaSkill().showAskForAddressCard()
                .tell('Please grant access to your address');
        }
    });

Official Documentation

Account Linking

The Account Linking card is used to prompt the user to connect their account by providing the authorization url you defined in the configuration of your Skill in the Amazon developer console.

this.alexaSkill().showAccountLinkingCard();
// or
const {AlexaSkill} = require('jovo-framework');

this.alexaSkill().showCard(new AlexaSkill.LinkAccountCard());