前提

Push Message API
HTTPリクエスト
リクエストヘッダー
- Content-Type application/json
- Authorization Bearer {channel access token}
説明
プロパティ | タイプ | 必須 | 説明 |
---|---|---|---|
defaultAction | アクションオブジェクト | 任意 | 画像、タイトル、テキストの領域全体に対して設定できる、タップされたときのアクション |
サンプル
curl
curl -X POST -H 'Content-Type:application/json' -H 'Authorization: Bearer {トークン}' -d '{
"messages": [
{
"altText": "かご落ち商品",
"template": {
"columns": [
{
"actions": [
{
"label": "詳細はこちら▶︎",
"type": "uri",
"uri": "https://google.com"
}
],
"defaultAction": {
"type": "uri",
"label": "defaultAction",
"uri": "http://yahoo.co.jp"
},
"text": "¥1000",
"thumbnailImageUrl": "http://sample.com",
"title": "サンプルタイトル"
}
],
"type": "carousel"
},
"type": "template"
}
],
"to": "{LINEUserID}"
}' \https://api.line.me/v2/bot/message/push
イメージ画像

defaultAction をクリックした場合に、Yahoo!のページに遷移

通常のActionをクリックした場合に、googleのページに遷移

マルチアクションについて
説明
- 複数のアクションを指定することができる (最大3個まで)
- カルーセルで複数配信した場合に、異なるアクション数では配信することは出来ない
プロパティ | タイプ | 必須 | 説明 |
---|---|---|---|
actions | アクションオブジェクトの配列 | 任意 | タップされたときのアクション 最大件数:3 |
sample
curl -X POST -H 'Content-Type:application/json' -H 'Authorization: Bearer {トークン}' -d '{
"messages": [
{
"type":"text",
"text":"★カートに商品が残っています★\nお買い忘れはございませんか?"
},
{
"altText": "かご落ち商品",
"template": {
"columns": [
{
"actions": [
{
"type": "uri",
"label": "商品詳細はこちら▶︎",
"uri": "https://www.sample.com"
},
{
"type":"uri",
"label":"TOPはこちら▶︎",
"uri":"https://www.sample.com"
}
],
"text": "¥886",
"thumbnailImageUrl": "https://www.sample.com",
"title": "マルチビタミン"
},
{
"actions": [
{
"type": "uri",
"label": "詳細はこちら2▶︎",
"uri": "https://www.sample.com"
},
{
"type":"uri",
"label":"Buy2",
"uri":"https://www.sample.com"
}
],
"text": "ビタミンサンプル",
"thumbnailImageUrl": "https://www.sample.com",
"title": "マルチビタミン"
}
],
"type": "carousel"
},
"type": "template"
}
],
"to": "{LINEUserID}"
}' \https://api.line.me/v2/bot/message/push
イメージ画像
