This project is to showcase how to connect Google Dialogflow into Twilio Flex.
Before you can get started you will need the following:
- Go to the ./twilio/flex/plugin-dialogflow folder and
npm build
the asset. The output should be plugin-dialogflow.js
- 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
-
Add the following Environment Variables:
Key | Value |
---|---|
GOOGLE_DIALOGFLOW_PROJECT_ID | ******** |
- Add the following Dependencies:
- google-oauth-jwt
- request-promise
- Go to Twilio Functions and deploy the functions in the ./twilio/functions directory.
The function paths should match the function file names
- 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
-
Go to Twilio Phone Numbers and select your Flex Phone Number.
-
Under A CALL COMES IN select Studio Flow Google-Dialogflow-Voice-IVR.
-
Go to Twilio Flex - Messaging.
-
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 |
I would highly recommend running the google-dialogflow-test function to test to see if you get a response from Dialogflow.
- Anthony Wong