API.AI: Fulfillment Importer Sample
A simple sample showing how to use API.AI's Importer for Alexa Skills to import a Alexa Skill to API.AI, deploy it to the Google Assistant developer platform, Actions on Google, and export the API.AI agent back to Amazon's Alexa Skill Kit platform.
Please see https://api.ai/docs/examples/importer-for-alexa-skills for a comprehensive walkthrough of this sample.
Setup Instructions
This sample is divided into two parts, the first in the skill
directory and the second in the apiai
directory. The directory skill
has all the files for deployment and fulfillment of a simple Alexa Skill that responds to a single query for the most popular videos on YouTube. When deployed properly to Lambda and Alexa, the Alexa Skill responds with the 5 most popular YouTube videos in the United States at the time. The directory apiai
contains all the Alexa Skill's files imported into API.AI. These include the API.AI agent exported to a zip file and fulfillment designed to be hosted on Cloud Functions for Firebase.
Steps to deploy the API.AI agent to Actions on Google
- Sign up or login to your API.AI account.
- Open the API.AI console, click on Create Agent in the left navigation and fill in the required fields.
- Click Save to save the project.
- Click on the gear icon to see the project settings.
- Select Export and Import.
- Select Restore from zip. Follow the directions to restore from the
apiai/APIAIAgent.zip
file in this repo. - Deploy the fulfillment webhook provided in the
apiai/functions
folder using Google Cloud Functions for Firebase:- Create a Firebase project in the Firebase Console if you don't have one already.
- Follow the instructions to set up and initialize Firebase SDK for Cloud Functions. Make sure to reply "N" when asked to overwrite existing files by the Firebase CLI.
- Run
firebase deploy --only functions
and take note of the endpoint where the fulfillment webhook has been published. It should look likeFunction URL (conversationComponent): https://us-central1-YOUR_PROJECT.cloudfunctions.net/conversationComponent
- Go back to the API.AI console and select Fulfillment from the left navigation menu. Enable Webhook, set the value of URL to the
Function URL
from the preiovus step, then click Save. - Select Integrations from the left navigation menu and open the Settings menu for Actions on Google.
- Click Test.
- Click View to open the Actions on Google simulator.
- Type
Talk to my test app
in the simulator, or sayOK Google, talk to my test app
to any Actions on Google enabled device signed into your developer account.
Steps to deploy the Alexa Skill to Alexa Skills Kit
- Please see Alexa's Build An Alexa Fact Skill documentation for information on how to deploy the Alexa Skill
How to make contributions?
Please read and follow the steps in the CONTRIBUTING.md.
License
See LICENSE.
Terms
Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service.