--- title: Build LINE BOT with Hackmd tags: 7th-anniversary image: https://hackmd.io/_uploads/HycUGaOUi.png summary: I am a training/educator, often need to organize projects, teaching documents, but also need to assign homework and collect return homework, tried different software services in the market, HackMD is the most convenient, lightweight, based on the sharing of knowledge platform! author: "@wiimax" author-description: "training/educator" avatar: https://avatars.githubusercontent.com/u/2055349?s=96 bylink: "https://github.com/willismax" latest: false date: "2022-11-21" --- # Build LINE chat bot with Hackmd API ## Why I use HackMD - I am a training/educator, often need to organize projects, teaching documents, but also need to assign homework and collect return homework, tried different software services in the market, HackMD is the most convenient, lightweight, based on the sharing of knowledge platform! - HackMD is already a part of life. ## Awesome usage - Organize a series of 30 articles containing [Youtube videos](https://www.youtube.com/playlist?list=PL5vxsagL2iDDBRcNORi7zx7Q_cD6AlJlK) in [HackMD book mode](https://hackmd.io/@wiimax/intro-hackmd), and organize the [articles](https://ithelp.ithome.com.tw/users/20121130/ironman/5793) through grammatical components [Sliders](https://hackmd.io/@wiimax/intro-hackmd-slides) with `{%hackmd noteid %}` are all done by HackMD. - Now I manage my favorites information centrally through the LINE APP, it will automatically sync to hackmd! ## The LINE chatbot built with the HackMD API - The [code of the LINE chatbot built with the HackMD API](https://hackmd.io/@wiimax/HySvndc-j) has been made public[ GitHub](https://github.com/willismax/hackmd-line-bot-on-fly)。 ### What problems can be solved - You phone pictures, text, and links can eazily share to your LINE official account, and they will be automatically synced to HackMD for subsequent editing. | ![](https://i.imgur.com/o5xMA5A.jpg =270x) | ![](https://hackmd.io/_uploads/HJxLrFvBj.png) | | --- | --- | | Photo/text/link/share to LINE APP | Automatically sync to HackMD | ### How the chatbots works - There are many ways to build a LINE chatbot, for example, first you need to create an [LINE Developers](https://developers.line.biz/zh-hant/) channel, then get the [HackMD API](https://hackmd.io/@hackmd-api/developer-portal), and get [Imgure](https://imgur.com/account/settings/apps) ID. You need to modify the code to add the necessary parameters and deploy it in the [Fly.io](http://fly.io/), and finally fill in the Fly.io's exclusive URL like `https://[APP Name].fly.io/callback` to LINE WebHooks. - The easy steps are below to collapse the list, or refer to my [tutorial](https://hackmd.io/@wiimax/HySvndc-j#%E5%A6%82%E4%BD%95%E5%BB%BA%E7%AB%8B-LINE-bot). https://github.com/willismax/hackmd-line-bot-on-fly :::spoiler easy steps - [ ] Download the code from [<i class="fa fa-github" aria-hidden="true"></i> GitHub](https://github.com/willismax/hackmd-line-bot-on-fly), can be downloaded `zip` unzip or `git clone` down. You can Fork it! - [ ] Get [HackMD API](https://hackmd.io/@hackmd-api/developer-portal) `Token`, fill in `HACKMD_API_TOKEN`, and assign an `TEMP_NOTE_ID` in `config.py`. - [ ] Create an exclusive Channel in [LINE Developers](https://developers.line.biz/zh-hant/), get `Token`, `Secret`, fill in `CHANNEL_ACCESS_TOKEN` and `CHANNEL_SECRET`. - [ ] Get the [Imgure](https://imgur.com/account/settings/apps) `Client ID`, and fill in `IMGURE_CLIENT_ID` in `config.py`. - [ ] Create a cloud service on [Fly.io](http://fly.io/) and establish a development connection environment. - [ ] Finally, fill in your [Fly.io](http://fly.io/) link `https://[APP Name].fly.io/callback` into your LINE Channel Webhook, and enable Webhooks. :::