Build LINE Bot web application with Node.js and Heroku
- Oct
- 02
- Posted by Lin
- Posted in Heroku, Node.js, Salesforce
Overview
In order to check the operation of the LINE Bot web application that using the LINE Messaging API, you need a server that can be accessed externally.
This post shares the creation procedure of LineBot web application using Heroku.
Basic flow
1. Heroku development environment
For web online development environment, Heroku + Cloud 9 is recommended.
Please refer to the following article for the procedure from Heroku’s account registration to “Hello World!”.
Node.jsの快適な開発デプロイ環境を構築(Heroku+Cloud9)
※ Note the domain “https://myapp.herokuapp.com” generated above.
2. LINE Business account
Please refer to the following:
わずか5分。新LINE Messaging APIでbotを作ってみた手順全公開
Note:
① Be sure to set the following in the LINE Business account request setting.
・Webhook送信:「利用する」.
・自動応答メッセージ:「利用しない」
② In “Webhook URL” setting of LINE Developers setting page, input: domain + ‘/webhook’ [http://myapp.herokuapp.com/webhook] and save it.
※ webhook:The callBack process is created in Step 3.
※ Channel Secret and アクセストークン are required afterwards.
3.LINE Bot program creation
① Install necessary packages in Console.
> npm install @line/bot-sdk –s
> npm install express –s
② Overwrite and save the contents of “app.js” created in 【1. Heroku development environment】.
③ Set defaultAccessToken and defaultSecret with Channel Secret and アクセストークン noted in [2. LINE Business account] ,Alternatively, set CHANNEL_ACCESS_TOKEN and CHANNEL_SECRET to Heroku’s Settings / Config Variables.
④ Deploy source to Heroku with Console
4.Operation confirm with LINE application
Let’s add a friend from the QR code to 【2. LINE Business account】 LINE application and send a message.
Reference material
・Line Messaging API
・わずか5分。新LINE Messaging APIでbotを作ってみた手順全公開
Enjoy it!
Recent Posts
- Salesforce DevTools Release Notes (version 3.10.0) – mass edit custom fields on lightning
- Salesforce DevTools Release Notes (version 3.9.0) – Object Fields, SOQL Query Editor
- Salesforce DevTools Release Notes (version 3.8.0)
- Salesforce DevTools JUST HIT 10,000 USERS! THANK YOU!
- Using Promise for Apex Server-Side request in Lightning Component
Top Posts
- Salesforce DevTools – Powerful Salesforce developer tools, loved by over 50K developers - 217.7K views
- Date format and DateTime format - 201.9K views
- Salesforce Mass Editor (Chrome Extension) – Mass create, mass update, mass clone, mass delete on any list view. Support for both Classic and Lightning! - 157.5K views
- Setup an awesome Salesforce developer environment with Sublime Text 3 - 121.8K views
- Writing a Schedulable Batch Apex in Salesforce - 116.9K views
Categories
- APEX
- Apps
- Custom Label
- Custom Metadata
- Custom Setting
- Design & UI
- Event
- Heroku
- iOS & Object-c
- Lightnint Component
- Linux & Mac OS
- Metadata API
- Node.js
- Open Source
- Other
- PHP Framework
- Release Notes
- REST API
- Salesforce
- Salesforce DevTools
- Salesforce DX
- SOQL
- Tooling API
- Unit Tests
- Validation Rule
- Visualforce
- WordPress
You must be logged in to post a comment.