# Set up a smart chatbot on discourse 🤖

**URL:** https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632
**Category:** Developers
**Tags:** how-to
**Created:** [March 9, 2018, 4:50pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632 "2018-03-09T16:50:11Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Timothy\_Vail](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/timothy_vail/32/90872_2.png) [@Timothy\_Vail](https://meta.discourse.org/u/Timothy_Vail)
#### Post date: [March 9, 2018, 4:50pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/1 "2018-03-09T16:50:11Z")

</div>

Hello,

After weeks of tinkering, I finally managed to set up an AI bot, similar to discobot but one that learns and is more responsive. Here is how I did it for anyone interested in setting it up. There is quite a few steps, but once you get it all set up, the result is amazing.

1. Install the hubot plugin for discourse [Hubot Adapter for Discourse](https://meta.discourse.org/t/hubot-adapter-for-discourse/63419), to install hubot on your discourse, the hubot variables like HUBOT\_DISCOURSE\_USERNAME are entered into (yourhubotfolder)/bin/hubot file, just nano or edit it to write export HUBOT\_DISCOURSE\_USERNAME=mybot) For more details go here [Discobot for training - #10 by featheredtoast](https://meta.discourse.org/t/discobot-for-training/81316/10)

2. Sign up and make a new bot on [https://dialogflow.com/](https://dialogflow.com/)

3. Install a hubot / apiai (dialogueflow) adapter from here: [GitHub - ojacques/hubot-apiai: Add smartness and conversational UX to Hubot with API.AI as back-end · GitHub](https://github.com/ojacques/hubot-apiai) 3a. in the bin/hubot file, make sure you have the following variables set

You will have to download a google application credential json, which you can get following this guide: [https://cloud.google.com/genomics/downloading-credentials-for-api-access](https://cloud.google.com/genomics/downloading-credentials-for-api-access)

1. Now boot up your hubot by typing `bin/hubot -a discourse-adapter` to run it. If you want it to run even when you are not in the terminal, type `nohup bin/hubot -a discourse-adapter &amp;`

2. Private message the bot for testing. If you set up the dialogflow bot with small talk, you can say hi, how are you and engage in small talk right away. Other dialogue you have to set up. There are a few tutorials on youtube that are a good start. [https://youtu.be/HqfN9qjNj9A](https://youtu.be/HqfN9qjNj9A)

Here is a demo

 ![examplegifai](https://global.discourse-cdn.com/meta/original/3X/e/c/ec96c1fb651b7b4ac62c75a3f0b352f2610c6211.gif)

If you have any questions, feel free to ask.

Also, a proper thank you to @codinghorror and the team for developing discourse, and @awole20 for developing the hubot plugin, couldn’t have done it without you!

---

<div class="post-metadata">

### Author: ![William04GamerA](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@William04GamerA](https://meta.discourse.org/u/William04GamerA)
#### Post date: [March 12, 2018, 6:01pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/2 "2018-03-12T18:01:00Z")

</div>

This is just plain awesome! I am not too experienced with this myself, but do you know if this would work to deploy on Heroku or not? Thanks for the tutorial!

---

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [March 12, 2018, 6:04pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/3 "2018-03-12T18:04:24Z")

</div>

Hubot is indeed able to be installed on Heroku - check out the Hubot docs for more info: [Deploying to Heroku | HUBOT](https://hubot.github.com/docs/deploying/heroku/)

---

<div class="post-metadata">

### Author: ![William04GamerA](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@William04GamerA](https://meta.discourse.org/u/William04GamerA)
#### Post date: [March 12, 2018, 6:08pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/4 "2018-03-12T18:08:02Z")

</div>

That’s cool. I’ll look further into this.

---

<div class="post-metadata">

### Author: ![William04GamerA](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@William04GamerA](https://meta.discourse.org/u/William04GamerA)
#### Post date: [March 13, 2018, 2:44pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/5 "2018-03-13T14:44:18Z")

</div>

@awole20 @Timothy_Vail I know I sound absolutely hilarious by saying this, but is there any way to make a bot that you guys know of without being an admin (a.k.a having an api key)?

---

<div class="post-metadata">

### Author: ![Timothy\_Vail](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/timothy_vail/32/90872_2.png) [@Timothy\_Vail](https://meta.discourse.org/u/Timothy_Vail)
#### Post date: [March 13, 2018, 3:16pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/6 "2018-03-13T15:16:39Z")

</div>

You need to be the admin of not only discourse but of the server it sits on. No way around that one.

---

<div class="post-metadata">

### Author: ![William04GamerA](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@William04GamerA](https://meta.discourse.org/u/William04GamerA)
#### Post date: [March 13, 2018, 4:46pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/7 "2018-03-13T16:46:27Z")

</div>

That´s a bummer. Thanks for the information though.

---

<div class="post-metadata">

### Author: ![Michael\_McCrae](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael_mccrae/32/143362_2.png) [@Michael\_McCrae](https://meta.discourse.org/u/Michael_McCrae)
#### Post date: [June 15, 2019, 7:57pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/8 "2019-06-15T19:57:22Z")

</div>

I am slowly working my way through this. What threw me at the first stage was access errors when running **yo hubot --adapter=discourse-adapte** r per the [installation instructions for the plugin](https://github.com/featheredtoast/hubot-discourse-adapter). It looks like you have to change the permission for the folders. [Fix is documented here](https://github.com/yeoman/yeoman.io/issues/282).

---

<div class="post-metadata">

### Author: ![Michael\_McCrae](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael_mccrae/32/143362_2.png) [@Michael\_McCrae](https://meta.discourse.org/u/Michael_McCrae)
#### Post date: [June 25, 2019, 9:23pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/9 "2019-06-25T21:23:08Z")

</div>

So, as I discussed above, I hit an error installing NPM. Error was using root when installing, a common gotcha that leads to a lot of EACCES and permission errors. This is a well-documented error. I believe a lot of people are on Digital Ocean. Follow their documentation for correctly setting up NPM on your droplet.

---

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [April 15, 2020, 5:32am UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/10 "2020-04-15T05:32:02Z")

</div>

Thanks for sharing this, Tim. I’m curious to know what types of dialogue you’ve set up for the chatbot. How are your forum users engaging with it in the real world?

---

<div class="post-metadata">

### Author: ![Timothy\_Vail](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/timothy_vail/32/90872_2.png) [@Timothy\_Vail](https://meta.discourse.org/u/Timothy_Vail)
#### Post date: [April 16, 2020, 1:25pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/11 "2020-04-16T13:25:01Z")

</div>

Hello Nacho,

It’s actually been awhile since I’ve used the chatbot, but am planning on using it again for an upcoming project. Mostly it was used for training sessions for teachers, they would go through a course using chatbot and learn about teaching through the dialogue. Let me know if you have any questions.

---

<div class="post-metadata">

### Author: ![Marley\_Merl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marley_merl/32/183803_2.png) [@Marley\_Merl](https://meta.discourse.org/u/Marley_Merl)
#### Post date: [June 12, 2020, 1:20am UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/12 "2020-06-12T01:20:53Z")

</div>

Thanks, great post! Love it

---

<div class="post-metadata">

### Author: ![Muwonge\_Ronald](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/muwonge_ronald/32/160546_2.png) [@Muwonge\_Ronald](https://meta.discourse.org/u/Muwonge_Ronald)
#### Post date: [May 17, 2021, 11:16am UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/13 "2021-05-17T11:16:54Z")

</div>

Wow loved this and I must sleep on it these days.  
I need some AI on my discourse site

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 12, 2022, 6:04pm UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/15 "2022-09-12T18:04:17Z")

</div>

Before I dive into implementing this on my Discourse (and since I am only somewhat proficient, but good at following directions 🤓 ) … are these instructions in this thread still working? Or… is there a more current or preferred way to integrate an AI bot?

---

<div class="post-metadata">

### Author: ![SimonBiggs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simonbiggs/32/292760_2.png) [@SimonBiggs](https://meta.discourse.org/u/SimonBiggs)
#### Post date: [February 9, 2023, 12:52am UTC](https://meta.discourse.org/t/set-up-a-smart-chatbot-on-discourse/82632/16 "2023-02-09T00:52:36Z")

</div>

> [@denvergeeks](#):
>
> Before I dive into implementing this on my Discourse (and since I am only somewhat proficient, but good at following directions 🤓 ) … are these instructions in this thread still working? Or… is there a more current or preferred way to integrate an AI bot?

There’s been a few conversations. Here is one with more recent developments:

> [@Integrating GPT3-like bots?](https://meta.discourse.org/t/integrating-gpt3-like-bots/242665/35):
>
> Here is a great implementation of a GPT bot that is able to use the entire website context built ontop of supabase (open source): [[ClippyGPT - How I Built Supabase’s OpenAI Doc Search (Embeddings)] ](https://www.youtube.com/watch?v=Yhtjd7yGGGA) I suspect, Discourse and supabase would be a great alignment here. A plugin that undergoes forum embeddings using the approach in that video above, and then creates a user backed by that would be amazing. I would certainly be interested. But unfortunately, I think if it’s not in the ope…
