LINE BOTでボタン選択肢を出したい
LINE APIのTemplate Messageを使う
今まで使っていたのはReply Message。
Template Messageもデータの流れは同じ。
LINE APIに渡す情報が異なる。
LINE API Referenceの Template Messageの仕様
サンプルをそのまま表示させてみる
ボタンを書き換える
画像を変える
$post_data = array( "replyToken" => $reply_token, "messages" => array( array( "type"=> "template", "altText"=> "this is a buttons template", "template"=> array( "type"=> "buttons", "thumbnailImageUrl"=> "xxxxxxxここに画像のURLxxxxxxx", "title"=> $title, "text"=> "雑談するかしりとりするか選んでください", "actions"=> array( array( "type"=> "postback", "label"=> "雑談する", "data"=> "action=dialog" ), array( "type"=> "postback", "label"=> "しりとりする", "data"=> "action=srtr" ) ) ) ) ) );