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 confirm template",
        "template"=> array(
            "type"=> "confirm",
            "text"=> "本当によろしいですか?",
            "actions"=> array(
                array(
                  "type"=> "message",
                  "label"=> "はい",
                  "text"=> "yes"
                ),
                array(
                  "type"=> "message",
                  "label"=> "いいえ",
                  "text"=> "no"
                )
            )
        )
      )
    )
  );

※labelが表示される