Skip to content

Commit

Permalink
Merge 369644e into f708415
Browse files Browse the repository at this point in the history
  • Loading branch information
omenocal committed Sep 4, 2018
2 parents f708415 + 369644e commit c9f3161
Show file tree
Hide file tree
Showing 36 changed files with 2,228 additions and 69 deletions.
10 changes: 5 additions & 5 deletions docs/alexa-directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ In Voxa you can send cards using a view or returning a Card like structure direc
};
skill.onState('someState', () => {
app.onState('someState', () => {
return {
alexaCard: 'Card',
};
});
skill.onState('someState', () => {
app.onState('someState', () => {
return {
alexaCard: {
image: {
Expand All @@ -62,7 +62,7 @@ An account linking card is sent with the `alexaAccountLinkingCard` key in your c
.. code-block:: javascript
skill.onState('someState', () => {
app.onState('someState', () => {
return {
alexaAccountLinkingCard: null,
};
Expand All @@ -81,7 +81,7 @@ Voxa provides a `DisplayTemplate` builder that can be used with the `alexaRender
const voxa = require('voxa');
const { DisplayTemplate } = voxa.alexa;
skill.onState('someState', () => {
app.onState('someState', () => {
const template = new DisplayTemplate("BodyTemplate1")
.setToken("token")
.setTitle("This is the title")
Expand All @@ -106,7 +106,7 @@ PlayAudio
const voxa = require('voxa');
const { PlayAudio } = voxa.alexa;
skill.onState('someState', () => {
app.onState('someState', () => {
const playAudio = new PlayAudio(
'http://example.com/example.mp3',
'{}',
Expand Down
2 changes: 1 addition & 1 deletion docs/canFulfillIntentRequest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In Voxa, you can take advantage of this feature by following this example:

.. code-block:: javascript
skill.onCanFulfillIntentRequest((alexaEvent, reply) => {
app.onCanFulfillIntentRequest((alexaEvent, reply) => {
if (alexaEvent.intent.name === 'InfluencerIntent') {
reply.fulfillIntent('YES');
Expand Down
10 changes: 5 additions & 5 deletions docs/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ States come in one of two ways, they can be an object of mappings from intent na

.. code-block:: javascript
skill.onState('entry', {
app.onState('entry', {
LaunchIntent: 'launch',
'AMAZON.HelpIntent': 'help',
});
Expand All @@ -19,7 +19,7 @@ Or they can be a function that gets a :ref:`voxaEvent <voxa-event>` object.

.. code-block:: javascript
skill.onState('launch', (voxaEvent) => {
app.onState('launch', (voxaEvent) => {
return { tell: 'LaunchIntent.OpenResponse' };
});
Expand All @@ -34,7 +34,7 @@ For example in the next snipped there's a ``waiting`` state that expects an ``AM

.. code-block:: javascript
skill.onState('waiting', (voxaEvent) => {
app.onState('waiting', (voxaEvent) => {
if (voxaEvent.intent.name === 'AMAZON.NextIntent') {
voxaEvent.model.index += 1;
return { ask: 'Ingredients.Describe', to: 'waiting' }
Expand All @@ -52,15 +52,15 @@ For the simple pattern of having a controller respond to an specific intent the

.. code-block:: javascript
skill.onIntent('LaunchIntent', (voxaEvent) => {
app.onIntent('LaunchIntent', (voxaEvent) => {
return { tell: 'LaunchIntent.OpenResponse' };
});
If you receive a Display.ElementSelected type request, you could use the same approach for intents and state. Voxa receives this type of request and turns it into ``DisplayElementSelected`` Intent

.. code-block:: javascript
skill.onIntent('DisplayElementSelected', (voxaEvent) => {
app.onIntent('DisplayElementSelected', (voxaEvent) => {
return { tell: 'DisplayElementSelected.OpenResponse' };
});
Expand Down
95 changes: 95 additions & 0 deletions docs/customerContact.rst
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'
],
},
},
72 changes: 72 additions & 0 deletions docs/deviceAddress.rst
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',
],
},
},
57 changes: 57 additions & 0 deletions docs/deviceSettings.rst
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.

0 comments on commit c9f3161

Please sign in to comment.