Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialogflow API v2 changes to master #9

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AlexaApiAiBridge
Bridge to connect Amazon Alexa to Api.ai using an AWS Lambda Function.
# AlexaDialogflowBridge
Bridge to connect Amazon Alexa to Dialogflow *(aka. Api.ai)* using an AWS Lambda Function. This version uses v2 API of dialogflow

## Steps
### 1. Create a new Alexa Skill
Expand Down Expand Up @@ -56,10 +56,12 @@ Bridge to connect Amazon Alexa to Api.ai using an AWS Lambda Function.
* Select **AWS Lambda ARN (Amazon Resource Name)** as *Service Endpoint Type*.
* Select *Region* depending on your Lambda region and paste your Lambda **ANR** into the *Endpoint* field when you have it.

### 2. Create a new Api.ai Agent
### 2. Create a new Dialogflow Agent
#### Account
* Log in to the [Api.ai console](https://console.api.ai/api-client/).
* [Create a new agent](https://console.api.ai/api-client/#/newAgent) and fill all necessary information. Then click **Save** to continue.
* Log in to the [Dialogflow console](https://console.dialogflow.com/api-client/).
* [Create a new agent](https://console.dialogflow.com/api-client/#/newAgent) and fill all necessary information.
* Enable **Dialogflow V2 API**.
* Click **Save** to continue.

#### Intents
* Select **Default Welcome Intent**:
Expand All @@ -83,6 +85,26 @@ Bridge to connect Amazon Alexa to Api.ai using an AWS Lambda Function.
* Select the gear icon (upper-left corner) and go to **Settings**.
* Copy your **Developer access token** to use it later in the [Final Configuration section](#final-configuration).

#### Dialogflow and GCP settings
1. Select or create a Cloud Platform project.

[Go to the projects page][projects]

1. Enable billing for your project.

[Enable billing][billing]

1. Enable the Dialogflow API.

[Enable the API][enable_api]

1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation and AWS. Download your authentication json file and save as `gcp-credentials.json`. This file is to be added to code before uploading to AWS Lambda.

[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=dialogflow.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started

### 3. Create an AWS Lambda Function
#### AWS Account
Expand All @@ -101,7 +123,8 @@ Bridge to connect Amazon Alexa to Api.ai using an AWS Lambda Function.
* Enter a **Name** and choose **Node.js 6.x** as the *Runtime*.

##### Lambda function code
* [**Download the `AlexaApiAiBridge.zip` file**](https://github.com/Gnzlt/AlexaApiAiBridge/releases/latest) from the latest release of this repo.
* [**Download the `AlexaDialogflowBridge.zip` file**](https://github.com/Gnzlt/AlexaDialogflowBridge/releases/latest) from the latest release of this repo.
* Add the `gcp-credentials.json` file for authentication in the zip file.
* Drop down the *Code entry type* menu and select **Upload a .ZIP file**.
* Click on the **Function package** upload button and choose the file you just downloaded.

Expand All @@ -118,13 +141,9 @@ Bridge to connect Amazon Alexa to Api.ai using an AWS Lambda Function.

### Final Configuration
* Copy the Lambda **ARN** (upper-right corner) and use in the [Alexa Skill Configuration section](#skill-configuration).
* Go to your Lambda **Code** tab.
* Replace `ALEXA_APP_ID` with your **Alexa App Id** and `APIAI_DEVELOPER_ACCESS_TOKEN` with your **Api.ai Developer Access Token**:

```
const ALEXA_APP_ID = 'amzn1.ask.skill.app.your-skill-id';
const APIAI_DEVELOPER_ACCESS_TOKEN = 'your-apiai-developer-access-token';
```
* Go to your Lambda function tab.
* Add environment variable `ALEXA_APP_ID` with your **Alexa App Id** and `GOOGLE_PROJECT_ID` with your Project Id. You can find Google project id @ //https://dialogflow.com/docs/agents#settings
* Add environment variable as `GOOGLE_APPLICATION_CREDENTIALS` with value as `gcp-credentials.json`
* Go to [Alexa Manager](http://alexa.amazon.com/spa/index.html#settings) and change the language of your device to **English (United States)** inside the Settings menu.


Expand Down
Loading