/fulfillment-webhook-importer-nodejs

API.AI's Importer for Alexa Skills to import a Alexa Skill to API.AI

Primary LanguageJavaScriptApache License 2.0Apache-2.0

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

  1. Sign up or login to your API.AI account.
  2. Open the API.AI console, click on Create Agent in the left navigation and fill in the required fields.
  3. Click Save to save the project.
  4. Click on the gear icon to see the project settings.
  5. Select Export and Import.
  6. Select Restore from zip. Follow the directions to restore from the apiai/APIAIAgent.zip file in this repo.
  7. Deploy the fulfillment webhook provided in the apiai/functions folder using Google Cloud Functions for Firebase:
    1. Create a Firebase project in the Firebase Console if you don't have one already.
    2. 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.
    3. Run firebase deploy --only functions and take note of the endpoint where the fulfillment webhook has been published. It should look like Function URL (conversationComponent): https://us-central1-YOUR_PROJECT.cloudfunctions.net/conversationComponent
  8. 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.
  9. Select Integrations from the left navigation menu and open the Settings menu for Actions on Google.
  10. Click Test.
  11. Click View to open the Actions on Google simulator.
  12. Type Talk to my test app in the simulator, or say OK 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

  1. 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.