Skip to content

Instantly share code, notes, and snippets.

@vivahiraj
Created April 21, 2016 22:39
Show Gist options
  • Save vivahiraj/2bcf27b526616c5d06a830542cc6507f to your computer and use it in GitHub Desktop.
Save vivahiraj/2bcf27b526616c5d06a830542cc6507f to your computer and use it in GitHub Desktop.
LINE BOT APIのプロファイル取得のためのAPIを試すものです
# coding: utf-8
require 'rest-client'
require 'json'
ID = "Channel ID"
SECRET = "Channel Secret"
MID = "MID"
response = RestClient::Request.execute(
:method => :get,
:url => "https://trialbot-api.line.me/v1/profiles?mids=#{MID}",
:headers => {"X-Line-ChannelID" => ID,
"X-Line-ChannelSecret" => SECRET,
"X-Line-Trusted-User-With-ACL" => MID}
)
json = JSON.parser.new(response.to_str)
hash = json.parse()
p hash
puts hash["contacts"][0]["displayName"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment