14
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

LINE Messaging API新機能のクイックリプライを使ってみた

Last updated at Posted at 2018-09-22

クイックリプライとは

・クイックリプライボタンを設定したメッセージをbotから受信すると,画面下部にボタンが出現する
・ボタンを押すとボタンが消える(次のメッセージが送信されるとボタンが消える)
・一つのメッセージにつき最大13個までのボタンを設定できる
・設定できるアクションは,「カメラアクション」,「カメラロールアクション」,「位置情報アクション」,「ポストバックアクション」,「メッセージアクション」,「日時選択アクション」のみで,urlアクション等は設定できない
※「カメラアクション」,「カメラロールアクション」,「位置情報アクション」はクイックリプライ機能専用のアクション

とりあえずJSON

{
    "type": "text",
    "text": "選択してください",
    "quickReply": {
        "items": [
            {
                "type": "action",
                "action": {
                    "type": "camera",
                    "label": "カメラ"
                }
            },
            {
                "type": "action",
                "action": {
                    "type": "cameraRoll",
                    "label": "カメラロール"
                }
            },
            {
                "type": "action",
                "action": {
                    "type": "location",
                    "label": "位置情報"
                }
            },
            {
                "type": "action",
                "action": {
                    "type": "postback",
                    "label": "ポストバック",
                    "data": "test"
                }
            },
            {
                "type": "action",
                "action": {
                    "type": "message",
                    "label": "メッセージ",
                    "text": "test"
                }
            },
            {
                "type": "action",
                "action": {
                    "type": "datetimepicker",
                    "label": "日時選択",
                    "data": "datetime",
                    "mode": "datetime"
                }
            }
        ]
    }
}

※必要に応じてボタンにアイコンをつけることが出来る
例:

{
    "type": "action",
    "imageUrl": "https://example.com/sushi.png",
    "action": {
        "type": "message",
        "label": "メッセージ",
        "text": "test"
    }
}

あとは皆さんの言語に応じてよしなに

ソースコードいろいろ

Google Apps Script

AWS lambda

bot紹介

時間割bot

クイックリプライを沢山使ってる
友だち追加


Twitter

14
6
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
14
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?