Skip to content

douglara/chatwoot-botpress-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a bridge connection chatwoot botpress.

Chatwoot Botpress

Running local

You need ruby 3.2.2 Clone this project:

git clone https://github.com/douglara/chatwoot-botpress-bridge.git
cd chatwoot-botpress-bridge

Copy configuration file:

cp .env.example .env

Edit vars in file .env:

BOTPRESS_ENDPOINT=
BOTPRESS_BOT_ID=
CHATWOOT_ENDPOINT=
CHATWOOT_BOT_TOKEN=

Install dependencies

bundle install

Start server:

rails s

Running tests

rails test

Create an agent bot

Go to your chatwoot directory. Start a rails console in your directory.

bundle exec rails c

Inside the rails console, type the following commands to create an agent bot and get its access token. Save the retrieved token as you would need it in further step.

bot = AgentBot.create!(name: "Botpress Bot", outgoing_url: "https://CHATWOOT_BOTPRESS_BRIDGE_URL/chatwoot/webhook")
bot.access_token.token

Connect Agent Bot to your inbox by running the following command

inbox = Inbox.last
AgentBotInbox.create!(inbox: inbox, agent_bot: bot)

Deploy CapRover

1 - Create new app

2 - Configure env vars

RAILS_ENV=production
CHATWOOT_ENDPOINT=
CHATWOOT_BOT_TOKEN=
BOTPRESS_ENDPOINT=
BOTPRESS_BOT_ID=
SECRET_KEY_BASE=

Generate random SECRET_KEY_BASE with

rake secret

3 - Configure http port In http settings set Container HTTP Port to 3000

4 - Deploy container In deployment settings set Deploy via ImageName with douglara/chatwoot-botpress-bridge:1 and deploy now.

Using Botpress Cloud

Setup bridge with Botpress Cloud

1. Enable Bot API

Active Bot API in your Botpress Cloud integrations and set env var BOTPRESS_CLOUD_WEBHOOK_TOKEN with the token generated. Configure Webhook URL with your bridge url https://CHATWOOT_BOTPRESS_BRIDGE_URL/botpress/webhook

2. Generate User token

Replace the WEBHOOK_ID with your Botpress Cloud webhook ID, id parameter if necessary and run the command to generate a user token

Set the environment variable BOTPRESS_CLOUD_USER_TOKEN with the token generated.

  curl --request POST \
  --url https://chat.botpress.cloud/WEBHOOK_ID/users \
  --header 'Content-Type: application/json' \
  --data '{"id": "1"}'

3. Get Bot ID

Get your Bot ID from Botpress Cloud studio and set it in environment var BOTPRESS_BOT_ID

4. Configure environment variables

BOTPRESS_ENDPOINT=https://chat.botpress.cloud
BOTPRESS_BOT_ID=
BOTPRESS_CLOUD_USER_TOKEN=
BOTPRESS_CLOUD_WEBHOOK_TOKEN=

Articles

Support

Community support: https://t.me/chatwoot_botpress_bridge Paid support: douglasdelaras@gmail.com

About

Connect Chatwoot to Botpress

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •