This repository showcases how to create a simple Trivia Bot on MessengerX.io using Open Trivia Database API and host it on Heroku.
Visit https://blog.messengerx.io/tutorials/create-a-trivia-bot-with-node-js-and-heroku/ for more information.
-
Fork this repo. - Click the fork symbol on rightmost top corner of your window.
-
Clone the forked repo. - Click the green button saying "Code" with a download button.
-
Visit https://github.com/machaao/TriviaBot/issues and comment your username. - Thereby I would be able to assign this issue to you for contribution.
-
Solve and Test your application. - You can do this in your own system with preferred editos.
-
Create a Pull Request. - After making changes, click on pull requests button that opens a window saying "Create a Pull Request". Here you complete the formalities and do it!
git clone https://github.com/machaao/TriviaBot.git
cd TriviaBot
- Get Bot Token from https://portal.messengerx.io
- Open
index.js
in an editor - Place the bot token at line 4.
const lib = new MxSdk('<----Bot Token----->', 'prod', server);
- npm install
- Commit the repo.
git add .
git commit -m "added Bot token"
Deploying it on heroku
# For Ubuntu
sudo snap install --classic heroku
# For MacOS
brew tap heroku/brew && brew install heroku
# For other OS
# Visit https://devcenter.heroku.com/articles/heroku-cli
# Log into your account
heroku login
# Create an app
heroku create
# Uploading the files
git push heroku master
If deployment went good, update the chatbot endpoint -> https://<heroku-app-name>.herokuapp.com/incoming
on https://portal.messengerx.io.
- MessengerX API
- Trivia Quiz API
- Heroku