You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make it work using heroku. The message is received correctly but when I try to send a message back:
I get forbidden request if I don't set any endpoint
I get HTTPInternalServerError if I set to fixie http endpoint, but I'm not sure if this is correct. Really appreciate any help. Maybe @hirohisa can give some lights?
require 'line/bot'
class CallbacksController < ApplicationController
def event_handler
signature = request.env['HTTP_X_LINE_CHANNELSIGNATURE']
unless client.validate_signature(request.body.read, signature)
error 400 do 'Bad Request' end
end
receive_request = Line::Bot::Receive::Request.new(request.env)
receive_request.data.each { |message|
puts message.to_json
case message.content
when Line::Bot::Message::Text
# All the code above works correctly this call is the problematic
res = client.send_text(
to_mid: message.from_mid,
text: "Hola",
)
puts "#{res}"
puts "#{client.endpoint}"
end
}
render :nothing => true, status: :ok
end
def client
client ||= Line::Bot::Client.new do |config|
config.channel_id = ENV.fetch('LINE_CHANNEL_ID')
config.channel_secret = ENV.fetch('LINE_CHANNEL_SECRET')
config.channel_mid = ENV.fetch('LINE_CHANNEL_MID')
# I get either 500 if set and forbidden if i remove this line
config.endpoint = ENV.fetch('LINE_OUTBOUND_PROXY')
end
end
end
The text was updated successfully, but these errors were encountered:
I'm trying to make it work using heroku. The message is received correctly but when I try to send a message back:
The text was updated successfully, but these errors were encountered: