This is a README documant for English Version, 也有中文版的說明文件
We want to share an easy deployment chatbot script to help others to build a chatbot with their customized content in a short time.
Hopefully, you do not need to write a script but to configure some hidden key by adding config var in Heroku console.
- [Heroku] Press the button to create a Heroku App, and you will need to log in or register a new Heroku account.
- [Heroku] Fill the information inquired by Heroku to create the App.
- [Heroku] Take a note for the URL of your Heroku App. It will be something like https://YOUR_HEROKU_APP_NAME.herokuapp.com
- [LINE] Log in to your LINE developer account or register one if you do not have.
- [LINE] Go to your LINE developer account, and add a new Messaging API service.
- [LINE] Fill your Heroku App URL to URL column, disable "Auto-reply messages" and enable "Use webhooks". Addtionally, to enable "Allow bot to join group chats" if you want your bot able to join a chat group.
- [LINE] Take a note for the "Channel secret" and "Channel access token".
- [Heroku] Go back to Heroku portal, and goto "Setting" and select "Config Variables" by pressing button "Reveal Config Vars".
- [Heroku] Add variables for following things,
- Add "YOUR_CHANNEL_ACCESS_TOKEN" and fill "Channel access token" which you got from LINE Messaging API service portal.
- Add "YOUR_CHANNEL_SECRET" and fill "Channel secret" which you got from LINE Messaging API service portal.
- Now, you can add the chatbot as your LINE friend and start to do some test with limited function. To provide more interest things, you might need a database, please follow below steps to set up a Firebase database. We choose Firebase since we think it is easy to manage.
- [Firebase][Optional] Visit following link and log in or register a new account.
- [Firebase][Optional] Press "Console" next to your account photo.
- [Firebase][Optional] Launch a new project according to instruction of the webpage.
- [Firebase][Optional] Click the project and enter project console, and then select "Database". You will see the URL of your database such as https://YOUR_DATA_BASE_NAME.firebaseio.com
- [Heroku][Optional] Follow Step 9 to add
- "DATABASE_BASE_URL" => https://YOUR_DATA_BASE_NAME.firebaseio.com
- "DATABASE_BASE_NAME" => any word you like
To Be Edit. Or, you could read code directly to find it out.
Hidden Keys
- DATABASE_PAGE_RANDOM_PICKED : When match randon pick keyword "抽", chatbot will pick data from this page.
- YOUR_NAME_OF_THE_BOT : The keywords shows in Help message and return "有人在找<YOUR_NAME_OF_THE_BOT>嗎?" when it be mentioned.
- WHITE_LIST : Lock the feature "pick" for white listed group only, split by "," for groups into array.