Code Monkey home page Code Monkey logo

dialogflow-agent-bot-demo's Introduction

Archiving the Repo

Dialogflow is now available as a native integration in Chatwoot. So it is recommended to use it instead.

Also, refer to Chatwoot Implementation Samples for other examples.


Chatwoot Agent Bot Implementation using DialogFlow

chat-958d13cc16f58d1649ab8a35bb579586

This repo contains a sample rails api which acts an agent bot and showcases an example use case of hotel booking via bot It relies on google dialogflow to for its NLP processing and makes use of bot messages in chatwoot to deliver a rich experiance.

Learn more about agent bots

Getting Started on Local

Set up Dialogflow

  1. Create a google cloud Project [ Unless you already have one]
  2. Create a Dialogflow ES Bot under the project
  3. Go to small talk and enable the small talk
  4. Go to Intents and import the given intenets in dialogflow_intents folder in this repo.

Setup Chatwoot installation

  1. Create an AgentBot by running the following in your chatwoot rails console
bot = AgentBot.create!(name: "Booking Bot", outgoing_url: "http://localhost:4000")
AgentBotInbox.create!(inbox: Inbox.first, agent_bot: bot)
# returns the token
bot.access_token.token

# if you want to update the image of the bot
avatar_resource = LocalResource.new("your image url")
AgentBot.first.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding)

Setting Up the Repo

  1. Clone the repo to your local
  2. Copy .env.example to .env and update the values as mentions
  3. run rails s -p 4000

You should be able to connect to the agent Bot from 'localchatwooturl/widget_tests` and test the bot out

Deploying for production

Deploying to Google Cloud run

Setup Chatwoot Production instance

run following on your production Chatwoot Instance to set up the agent bot

  bot = AgentBot.create!(name: "Booking Bot", outgoing_url: "http://localhost:4000")
  # choose your inbox instead of Inbox.first
  AgentBotInbox.create!(inbox: Inbox.first, agent_bot: bot)
  # returns the token
  bot.access_token.token

  # if you want to update the image of the bot
  avatar_resource = LocalResource.new("your image url")
  AgentBot.first.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding)

Create a new cloud run

  1. Run the following and generate an image for google cloud
# replace project_id with your id
gcloud config set project $PROJECT_ID
gcloud builds submit --tag gcr.io/$PROJECT_ID/agent_bot
  1. Go to cloud run and click create new service

  2. Choose the region and service name 1

  3. Choose the agent_bot image upload now, and toggle advanced settings

3

  1. Add the environment variables as required by .env.example

2 copy

  1. Allow all traffic and unauthenticated requests

4

  1. Click Deploy

Update your chatwoot Agent Bot with the cloud run url

run the following in your console

# chose agent bot
bot = AgentBot.first
bot.outgoing_url = "your cloud run url"
bot.save!

Other Providers

Build a docker image using the provided docker file. Deploy with the required environment variables provided

dialogflow-agent-bot-demo's People

Contributors

sojan-official avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dialogflow-agent-bot-demo's Issues

DIALOGFLOW_CREDENTIALS env value

Hi I've set up my DF integration with chatwoot based on this repo Readme.md
but I've problem on put value on DIALOGFLOW_CREDENTIALS at env file

Off course i have create servie on my DF Account and already have key/token as JSON Format

Please help me

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.