Giter VIP home page Giter VIP 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

How to Connect With Dialogflow

Step 1 - Open the Google Console for Cloud Functions (here) and make sure you have the Google Project of your Dialogflow chatbot selected.

Step 2 - Click on "Create Function" to open the interface for function creation.

Step 3- Set the name of the function (twilio-conector is a good option)

Step 4- On the Source Code option, select Inline Editor .

Step 5- In the index.js tab, copy and paste the code from the index.js file in this repository.

Step 6- In the package.json tab, copy and paste the code from the package.json file in this repository.

Step 7 - Set the Function to Execute field to "TwilioWebhook"

Step 8 - Click on the Dropdown "Variables, Networking and Advanced Settings"

Step 9 - In the Enviroment Variables section, look for Runtime Enviroment Variables and click on "Add Variable"

Step 10 - Add variables called:

  • projectId (the project ID found on your Dialogflow's agent settings page)

  • accountSid (your twilio account Sid value, found on the main dashboard of your Twilio project)

  • authToken (the authentication token for your Twilio acconut, found on the main dashboard of your Twilio project)

Step 11 - Click on "Create". In 1-2 minutes your integration will be up and running.

Step 12 - Click on your created function. Open the Trigger tab and copy the URL.

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

Step 14 - 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

Watchers

 avatar

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.