Closed2

LambdaからLineBotにテンプレートメッセージ/クイックリプライを送る

yorosuyorosu

2択のメッセージを送信する

こんなのが送れるようになる

python(Lambda)

from linebot.models import TemplateSendMessage

confirm_template_json = {
    "type": "confirm",
    "text": "Are you sure?",
    "actions": [
        {
            "type": "message",
            "label": "Yes",
            "text": "yes"
        },
        {
            "type": "message",
            "label": "No",
            "text": "no"
        }
    ]
}

line_bot_api.push_message(line_bot_user_id, 
    TemplateSendMessage(
        alt_text="this is a confirm template",
        template=confirm_template_json
    )
)

Refs

https://github.com/line/line-bot-sdk-python/blob/master/linebot/models/template.py

https://developers.line.biz/ja/reference/messaging-api/#confirm

このスクラップは2024/04/29にクローズされました