A quick introduction to the botstack framework for rapid chatbot development.
While Social Media allows you broad communication to your customers chatbots can provide you a direct communication to them. For basic bots you could use one of the available Bot As A Service Tools. If you want to check them out Dominik Felix wrote a great article about them.
Ok great, most of you will already have this two things installed. So the next thing you need is the botstack code:
Now open up settings.local.yml and fill out the values for page_access_token, verify_token and app_secret. You can get this values from your admin panel at developer.facebook.com — for the verify token use a random string.
We need to allow facebook to connect to our local machine. I recommend using ngrok. Just download it and start it with the following command in the same directory as the executable:
fancy! you just started a tunnel between you machine and a subdomain on ngrok.com
If it worked you will see something like above. Just copy the https:// url and head over to the facebook developer site and enter the url and your verify token to the form. When you hit the Verify and Save button Facebook will try to connect to your botstack app.
We can put our logic into /lib/bot/bot_logic.rb
The example below will just answer “Hello World!” back to you for every message. But you could also start playing around with modules and some other examples.
simple hello world bot
You may ask yourself why we need this whole thing. This is just the beginning, botstack offers you various modules to add functionality like notifications / subscriptions or html rendering for your bot. It is free and open source so everybody can contribute new features to it.
About The Author
David Mann is the creator of tipdoge and the botstack framework.