Skip to content

Instantly share code, notes, and snippets.

@shunirr
Created April 8, 2016 03:30
Show Gist options
  • Save shunirr/2a2c9a3403893ebabbe23114db4fd345 to your computer and use it in GitHub Desktop.
Save shunirr/2a2c9a3403893ebabbe23114db4fd345 to your computer and use it in GitHub Desktop.
LINE Bot API Proxy
require 'sinatra'
require 'httpclient'
CALLBACK_URI = URI.parse('http://example.com/callback')
configure do
set :httpclient, HTTPClient.new
end
post '/callback' do
settings.httpclient.post_async(
CALLBACK_URI,
request.body.read,
{
'Content-Type' => 'application/json; charset=UTF-8',
'X-LINE-ChannelSignature' => request.env['X-LINE-ChannelSignature']
})
200
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment