I tried to develop LINE Bot for the first time. First of all, it is a LINE Bot that returns from simple things. If you have any suggestions such as "misunderstanding", I would appreciate it if you could let me know.
I made a LineBot that returns parrots to Reply with Heroku + Ruby + Sinatra
The outline was done according to this article. Although I went to the end, I got into a situation where ** "I did not get a reply" **, so I will make a note of the solution.
https://github.com/line/line-bot-sdk-ruby
There is such a ↓ code in the SDK of LINE Bot, but I have entered the TOKEN etc. that I wrote down directly. This was a mistake and I set it as an environment variable in Heroku's [Config Vars], so this was fine.
app.rb
# app.rb
require 'sinatra'
require 'line/bot'
def client
@client ||= Line::Bot::Client.new { |config|
#The following three IDs,SECRET,I was typing TOKEN.This is OK as it is!
config.channel_id = ENV["LINE_CHANNEL_ID"]
config.channel_secret = ENV["LINE_CHANNEL_SECRET"]
config.channel_token = ENV["LINE_CHANNEL_TOKEN"]
}
end
↓ ↓ Heroku setting screen ↓ ↓ Set ID, SECRET, TOKEN here
I modified the code locally to fix cause 1. The change wasn't reflected in Heroku because it was only changed locally. If you look closely, Herokun also had such a description. Execute the following command to push to Heroku
Deploy your changes Make some changes to the code you just cloned and deploy them to Heroku using Git.
$ git add . $ git commit -am "make it better" $ git push heroku master
After trying these two, it came back safely.
Through trial and error, I found the following article. I looked at the article and tried to insert Fixie, but it works even if I delete it, so I will investigate it a little more.
Run LINE BOT on Heroku for free
I was addicted to the LINE BOT API
Recommended Posts