-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
2,228 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
.. _customerContact: | ||
|
||
Customer Contact Information Reference | ||
====================================== | ||
|
||
When a customer enables your Alexa skill, your skill can request the customer's permission to the their contact information, which includes name, email address and phone number, if the customer has consented. You can then use this data to support personalized intents to enhance the customer experience without account linking. For example, your skill may use customer contact information to make a reservation at a nearby restaurant and send a confirmation to the customer. | ||
|
||
.. js:function:: CustomerContact.constructor(voxaEvent) | ||
|
||
Constructor | ||
|
||
:param voxaEvent: Voxa Event object. | ||
|
||
.. js:function:: CustomerContact.getEmail() | ||
|
||
Gets user's email | ||
|
||
:returns Object: A string with user's email address | ||
|
||
.. js:function:: CustomerContact.getGivenName() | ||
|
||
Gets user's given name | ||
|
||
:returns Object: A string with user's given name | ||
|
||
.. js:function:: CustomerContact.getName() | ||
|
||
Gets user's full name | ||
|
||
:returns Object: A string with user's full name | ||
|
||
.. js:function:: CustomerContact.getPhoneNumber() | ||
|
||
Gets user's phone number | ||
|
||
:returns Object: A JSON object with user's phone number and country code | ||
|
||
.. js:function:: CustomerContact.getFullUserInformation() | ||
|
||
Gets name or given name, phone number, and email address | ||
|
||
:returns Object: A JSON object with user's info with the following structure | ||
|
||
.. code-block:: json | ||
{ | ||
"countryCode": "string", | ||
"email": "string", | ||
"givenName": "string", | ||
"name": "string", | ||
"phoneNumber": "string" | ||
} | ||
With Voxa, you can ask for the user's full name like this: | ||
|
||
.. code-block:: javascript | ||
app.onIntent('FullAddressIntent', async (voxaEvent) => { | ||
const name = await voxaEvent.alexa.customerContact.getName(); | ||
voxaEvent.model.name = name; | ||
return { ask: 'CustomerContact.Name' }; | ||
}); | ||
Voxa also has a method to request all parameters at once: | ||
|
||
.. code-block:: javascript | ||
app.onIntent('FullAddressIntent', async (voxaEvent) => { | ||
const info = await voxaEvent.alexa.customerContact.getFullUserInformation(); | ||
const { countryCode, email, name, phoneNumber } = info; | ||
voxaEvent.model.countryCode = countryCode; | ||
voxaEvent.model.email = email; | ||
voxaEvent.model.name = name; | ||
voxaEvent.model.phoneNumber = phoneNumber; | ||
return { ask: 'CustomerContact.FullInfo' }; | ||
}); | ||
To send a card requesting user the permission to access their information, you can simply add the card object to the view in your `views.js` file with the following format: | ||
|
||
.. code-block:: javascript | ||
ContactPermission: { | ||
tell: 'Before accessing your information, you need to give me permission. Go to your Alexa app, I just sent a link.', | ||
card: { | ||
type: 'AskForPermissionsConsent', | ||
permissions: [ | ||
'alexa::profile:name:read', | ||
'alexa::profile:email:read', | ||
'alexa::profile:mobile_number:read' | ||
], | ||
}, | ||
}, |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
.. _deviceAddress: | ||
|
||
Device Address Information Reference | ||
==================================== | ||
|
||
When a customer enables your Alexa skill, your skill can obtain the customer's permission to use address data associated with the customer's Alexa device. You can then use this address data to provide key functionality for the skill, or to enhance the customer experience. For example, your skill could provide a list of nearby store locations or provide restaurant recommendations using this address information. This document describes how to enable this capability and query the Device Address API for address data. | ||
|
||
Note that the address entered in the Alexa device may not represent the current physical address of the device. This API uses the address that the customer has entered manually in the Alexa app, and does not have any capability of testing for GPS or other location-based data. | ||
|
||
.. js:function:: DeviceAddress.constructor(voxaEvent) | ||
|
||
Constructor | ||
|
||
:param voxaEvent: Voxa Event object. | ||
|
||
.. js:function:: DeviceAddress.getAddress() | ||
|
||
Gets full address info | ||
|
||
:returns Object: A JSON object with the full address info | ||
|
||
.. js:function:: DeviceAddress.getCountryRegionPostalCode() | ||
|
||
Gets country/region and postal code | ||
|
||
:returns Object: A JSON object with country/region info | ||
|
||
With Voxa, you can ask for the full device's address like this: | ||
|
||
.. code-block:: javascript | ||
app.onIntent('FullAddressIntent', async (voxaEvent) => { | ||
const info = await voxaEvent.alexa.deviceAddress.getAddress(); | ||
voxaEvent.model.deviceInfo = `${info.addressLine1}, ${info.city}, ${info.countryCode}`; | ||
return { ask: 'DeviceAddress.FullAddress' }; | ||
}); | ||
You can decide to only get the country/region and postal code. You can do it this way: | ||
|
||
.. code-block:: javascript | ||
app.onIntent('PostalCodeIntent', async (voxaEvent) => { | ||
const info = await voxaEvent.alexa.deviceAddress.getCountryRegionPostalCode(); | ||
voxaEvent.model.deviceInfo = `${info.postalCode}, ${info.countryCode}`; | ||
return { ask: 'DeviceAddress.PostalCode' }; | ||
}); | ||
To send a card requesting user the permission to access the device address info, you can simply add the card object to the view in your `views.js` file with the following format: | ||
|
||
.. code-block:: javascript | ||
FullAddressPermision: { | ||
tell: 'Before accessing your full address, you need to give me permission. Go to your Alexa app, I just sent a link.', | ||
card: { | ||
type: 'AskForPermissionsConsent', | ||
permissions: [ | ||
'read::alexa:device:all:address', | ||
], | ||
}, | ||
}, | ||
PostalCodePermission: { | ||
tell: 'Before accessing your postal code, you need to give me permission. Go to your Alexa app, I just sent a link.', | ||
card: { | ||
type: 'AskForPermissionsConsent', | ||
permissions: [ | ||
'read::alexa:device:all:address:country_and_postal_code', | ||
], | ||
}, | ||
}, |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
.. _deviceSettings: | ||
|
||
Device Settings Reference | ||
========================= | ||
|
||
Alexa customers can set their timezone, distance measuring unit, and temperature measurement unit in the Alexa app. The Alexa Settings APIs allow developers to retrieve customer preferences for these settings in a unified view. | ||
|
||
.. js:function:: DeviceSettings.constructor(voxaEvent) | ||
|
||
Constructor | ||
|
||
:param voxaEvent: Alexa Event object. | ||
|
||
.. js:function:: DeviceSettings.getDistanceUnits() | ||
|
||
Gets distance units | ||
|
||
:returns Object: A string with the distance units | ||
|
||
.. js:function:: DeviceSettings.getTemperatureUnits() | ||
|
||
Gets temperature units | ||
|
||
:returns Object: A string with the temperature units | ||
|
||
.. js:function:: DeviceSettings.getTimezone() | ||
|
||
Gets timezone | ||
|
||
:returns Object: A string with the timezone value | ||
|
||
.. js:function:: DeviceSettings.getSettings() | ||
|
||
Gets all settings details | ||
|
||
:returns Object: A JSON object with device's info with the following structure | ||
|
||
.. code-block:: json | ||
{ | ||
"distanceUnits": "string", | ||
"temperatureUnits": "string", | ||
"timezone": "string" | ||
} | ||
With Voxa, you can ask for the full device's address like this: | ||
|
||
.. code-block:: javascript | ||
app.onIntent('FullSettingsIntent', async (voxaEvent) => { | ||
const info = await voxaEvent.alexa.deviceSettings.getSettings(); | ||
voxaEvent.model.settingsInfo = `${info.distanceUnits}, ${info.temperatureUnits}, ${info.timezone}`; | ||
return { ask: 'DeviceSettings.FullSettings' }; | ||
}); | ||
You don't need to request to the user the permission to access the device settings info. |
Oops, something went wrong.