anthonywong555 / Twilio-Flex-Google-Dialogflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Twilio Flex - Google Dialogflow

This project is to showcase how to connect Google Dialogflow into Twilio Flex.

Prerequisites

Before you can get started you will need the following:

Setup Twilio

  1. Go to the ./twilio/flex/plugin-dialogflow folder and
npm build

the asset. The output should be plugin-dialogflow.js

  1. Go to Twilio Assets and import the following:
  • Your Service Account Key as the file name google-dialogflow-service-account-key.json -- Enable Make Private
  • plugin-dialogflow.js
  1. Go to Twilio Functions - Configure

  2. Add the following Environment Variables:

Key Value
GOOGLE_DIALOGFLOW_PROJECT_ID ********
  1. Add the following Dependencies:
  • google-oauth-jwt
  • request-promise
  1. Go to Twilio Functions and deploy the functions in the ./twilio/functions directory.

The function paths should match the function file names

  1. Go to Twilio Studio and import the studio flows in the ./twilio/studio directory.

When you import the studio flow you might have to change the Run Function Widget's Function URL

  1. Go to Twilio Phone Numbers and select your Flex Phone Number.

  2. Under A CALL COMES IN select Studio Flow Google-Dialogflow-Voice-IVR.

  3. Go to Twilio Flex - Messaging.

  4. Under Manager Flex Flows have the following:

CHANNEL IDENTITY FRIENDLY NAME INTEGRATION TYPE CONFIGURATION
sms +1XXXXXXXXXX Flex Messaging Channel Flow Studio Google-Dialogflow-Messaging-Flow
web FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Flex Web Channel Flow Studio Google-Dialogflow-Webchat-Flow

Testing

I would highly recommend running the google-dialogflow-test function to test to see if you get a response from Dialogflow.

Author

  • Anthony Wong

About

License:MIT License


Languages

Language:JavaScript 85.9%Language:HTML 14.1%