Coder Social home page Coder Social logo

dialogflow-twilio-whatsapp-conector's Introduction

Dialogflow WhatsApp (Twilio) Integration

A simple way to connect and integrate Dialogflow and Twilio to create WhatsApp Chatbots

2021 Update: Altered to use Twilio Functions instead of Google Cloud Functions due to a more simple workflow with a more secure infrastructure.

How to Connect With Twilio with Dialogflow

Before Starting - Create your Dialogflow project and also a Twilio project, we will use both of them for the connection.

Part 1 -- Dialogflow Service Account

Step 1 - Open the Google Console for Service Accounts (here) and select the Google Project of your Dialogflow chatbot.

Step 2 - Fill a name for your service account. ("TwilioConnector" is a good option) and click on Create.

Step 3- Add the Owner role (Quick Start -> Basic -> Owner) and click on Done to finish this process.

Step 4- Select the created service account then click on Keys --> Add Key --> Create New Key --> Create

Step 5- A json file will be downloaded. Rename it to dialogflow.json

Part 2 -- Twilio Function

Step 6- Open the Twilio Functions page (here) and create a new service (I recommend naming it DialogflowService).

Step 7- Click on Add then Add Function. Set the path to /dialogflow

Step 8- Copy the code from the index.js in this repository and paste it to the code editor. Click on save.

Step 9- In settings, add a new Enviroment Variable with the key DIALOGFLOW_PROJECT_ID and set its value to your dialogflow project ID (you can find it in your Dialogflow agent's settings)

Step 10- Also in settings, click in Dependencies and add the module dialogflow with version 1.2

Step 11- Click on Add then Upload File. Select your dialogflow.json file. Set it's visibility to private. Click on Upload.

Step 12- Click on Deploy All

Part 3 -- Twilio Sandbox

Step 13- Click on the three dots next to your created function name and select copy URL.

Step 14 - In your Twilio Sandbox configuration (link), paste the URL into the "when a message comes in" field and click save.

Step 15 - Test your chatbot. You should now be able to talk to your Dialogflow chatbot through the Twilio Sandbox's WhatsApp number.

How to Send Media Files

You can also send media files such as Images, Audios, PDFs and Videos. To do so, add a "Custom Payload" response in your Dialogflow intent with the code:

{
    "mediaUrl": "YOUR_URL"
}

You can optionally include a text paramater to send a message alongside the image:

{
    "mediaUrl": "YOUR_URL",
    "text": "YOUR_MESSAGE"
}

See here Twilio's documentation to learn more about the limitations for sending media files.

dialogflow-twilio-whatsapp-conector's People

Contributors

michaelbarney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialogflow-twilio-whatsapp-conector's Issues

Schema Validation Warning

Looking to the TwillioDashboard I found this "12200 - Schema Validation Warning" notification.

Screenshots from the Twillio debugger: (I removed the personal account data)

image

image

image

Use GitHub repository as template

Recently GitHub has developed the "template" feature, I think it applies well here.

To apply this you just need to mark the checkbox "Template repository" in settings, just bellow the repository name.

Schema validation warning

Boa tarde pessoal,
realizei o passo-a-passo ontem e estou recebendo este erro ao utilizar o sandbox, alguém passou por isso?


Warning - 12200
Schema validation warning
The provided XML does not conform to the Twilio Markup XML schema. Please refer to the specific error and correct the problem.

Erro 12200 na Twilio Help Michael!

B45B58B4-7D2E-4793-85BD-CBC5C39C6947

Ocultei tudo pq não entendo nada kkk, mas então, fiz tudo certinho como vi nos vídeos, e deu esse problema, já procurei várias soluções em inglês, mas nada... tudo indica que é um erro no código, consegue me ajudar passar por isso?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.