LoginSignup
8
8

More than 5 years have passed since last update.

LINE BOTの送信機能をcurlで試す

Last updated at Posted at 2016-04-09

一度callbackに含まれているfromさえわかればcurlで試せる。
いちいちherokuにpushしてコールバックを起こして試すとかが面倒だったのでcurlで代用する。

curl -X POST -H "Content-Type: application/json; charset=UTF-8" -H "X-Line-ChannelID: %ChannelID%" -H "X-Line-ChannelSecret: %SECRET%" -H "X-Line-Trusted-User-With-ACL: %WID%" -d "{\"to\": [\"%TO%\"], \"toChannel\": 1383378250, \"eventType\": \"138311608800106203\", \"content\":{\"contentType\": 1, \"toType\": 1, \"text\": \"Hello, Jose!\" }}" https://trialbot-api.line.me/v1/events

windowsで試したのでJSON中の "\ でエスケープしている。
%ChannelID%%SECRET%%WID% はLINE Developersの Basic informationで調べる。
%TO% はコールバックのリクエストの中にあるからそれを使う。LINE IDが使えるのかなって思ったけども、使えなかった。

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8