Build LINE Bot web application with Node.js and Heroku
- 10月
- 02
- Posted by Lin
- Posted in Heroku, Node.js, Salesforce
Overview
To confirm the operation of LINE Bot web application with Node.js + Heroku using the LINE Messaging API, it is necessary to put it on the server.
This time, we make a LineBot web application using free [Heroku].
Basic flow
1.Heroku account
For Web online development, we recommend Heroku + Cloud 9.
Please refer to the following article ↓ ↓ for the procedure from Heroku’s account registration to “Hello World!”.
Awesome Node.js development environment with Heroku and Cloud9
※Make a note of the above produced domain「https://myapp.herokuapp.com」
2.LINE Business account
reference:わずか5分。新LINE Messaging APIでbotを作ってみた手順全公開
Notice:
① Be sure to set the LINE Business account リクエスト設定
・Webhook送信 「利用する」
・自動応答メッセージ 「利用しない」
② LINE Developers setting page
・Edit “Webhook URL” setting with: domain in [1. Heroku account] + ‘/ webhook’
⇒Input「https://myapp.herokuapp.com/webhook」 and save.
※webhook : Process of callBack created in step 3.
・Make a note of the Channel Secret and アクセストークン in the page.
3.LINE Bot program creation
- Install necessary package in Console
>npm install @line/bot-sdk –s
>npm install express –s
- Overwrite and save the contents of “app.js” created in [1. Heroku account].
Notice:
① In the DefaultAccessToken and defaultSecret,
Overwrite it with the noted Channel Secret and access token in [2.LINE Business account]
Or add the variable by Heroku >Config Variables
CHANNEL_ACCESS_TOKEN ⇒ 「アクセストークン」noted in STEP 2
CHANNEL_SECRET ⇒ 「Channel Secret」noted in STEP 2
- Deploy edited source to Heroku in Console
- Confirm with LINE application
Let’s add a friend from QR code to LINE application and send a message.
Enjoy it!
reference
わずか5分。新LINE Messaging APIでbotを作ってみた手順全公開
近期文章
- 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的开发者用户突破10,000名!THANK YOU!
- Lightning Component中使用Promise处理Apex服务端请求
Top Posts
- Salesforce DevTools – Saleforce开发者必备Chrome扩展 - 219.6K views
- Date format 与 DateTime format - 204K views
- Salesforce批量编辑 (Chrome扩展) – 在任何标准视图上进行批量插入, 拷贝, 更新, 删除, 支持Classic与Lightning! - 158.4K views
- 用Sublime Text 3架设Salesforce的快速开发环境 - 122.3K views
- 编写一个可被计划执行的Batch Apex - 118.8K views
分类目录
- APEX
- 应用
- Custom Label
- Custom Metadata
- Custom Setting
- Design & UI
- 交流会
- 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
您必须登录才能发表评论。