輪播卡限制
- 最多只能包含 12 張卡片
- 整個輪播訊息的資料大小不能超過 50KB
- 每張卡片寬度都會是一樣的
- 每張高度會自動保持一致,系統會以最高的卡片為基準,將所有卡片的 body 都對齊到相同高度,該卡片沒有 body 的話則不受影響
官方卡片高度說明
code.gs
The body of each bubble will stretch to match the tallest bubble in the carousel. However, bubbles with no body will not change height.
code.gs
function getCarouselCard() {
return {
type: 'carousel',
contents: [
// 第 1 張卡片:對應 [Line] Flex Message - Hello World
{
type: 'bubble',
size: 'kilo',
header: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'STEP 01|2026/11/03',
color: '#DCFCE7',
size: 'xs',
weight: 'bold'
},
{
type: 'text',
text: 'Hello World 基礎卡片',
color: '#FFFFFF',
size: 'lg',
weight: 'bold',
wrap: true
}
]
},
body: {
type: 'box',
layout: 'vertical',
spacing: 'sm',
contents: [
{
type: 'text',
text: '文章重點:',
weight: 'bold',
size: 'sm',
color: '#1E293B'
},
{
type: 'text',
text: '• 透過 GAS 串接 Push API 主動推播\n• payload 指定 type: flex 與 altText\n• 認識 bubble 單卡與 body 基礎區塊\n• vertical 垂直容器與文字 wrap 設定',
size: 'xs',
color: '#475569',
wrap: true,
lineSpacing: '4px'
}
]
},
footer: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'button',
style: 'primary',
height: 'sm',
color: '#16A34A',
action: {
type: 'uri',
label: '閱讀文章',
uri: 'https://jengting.blogspot.com/2026/11/Hello-Flex-Message.html'
}
}
]
},
styles: {
header: {
backgroundColor: '#16A34A'
}
}
},
// 第 2 張卡片:對應 [Line] Flex Message - 排版容器應用
{
type: 'bubble',
size: 'kilo',
header: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'STEP 02|2026/11/07',
color: '#DBEAFE',
size: 'xs',
weight: 'bold'
},
{
type: 'text',
text: '排版容器應用(雙欄)',
color: '#FFFFFF',
size: 'lg',
weight: 'bold',
wrap: true
}
]
},
body: {
type: 'box',
layout: 'vertical',
spacing: 'sm',
contents: [
{
type: 'text',
text: '文章重點:',
weight: 'bold',
size: 'sm',
color: '#1E293B'
},
{
type: 'text',
text: '• 垂直與水平巢狀容器製作雙欄明細\n• flex 屬性控制左右欄位空間比例\n• header 標題列與 separator 分隔線\n• align 對齊技巧製作活動入場憑證',
size: 'xs',
color: '#475569',
wrap: true,
lineSpacing: '4px'
}
]
},
footer: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'button',
style: 'primary',
height: 'sm',
color: '#2563EB',
action: {
type: 'uri',
label: '閱讀文章',
uri: 'https://jengting.blogspot.com/2026/11/Flex-Message-Layout.html'
}
}
]
},
styles: {
header: {
backgroundColor: '#2563EB'
}
}
},
// 第 3 張卡片:對應 [Line] Flex Message - 圖文與按鈕
{
type: 'bubble',
size: 'kilo',
header: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'STEP 03|2026/11/14',
color: '#FEF3C7',
size: 'xs',
weight: 'bold'
},
{
type: 'text',
text: '圖文與按鈕互動',
color: '#FFFFFF',
size: 'lg',
weight: 'bold',
wrap: true
}
]
},
body: {
type: 'box',
layout: 'vertical',
spacing: 'sm',
contents: [
{
type: 'text',
text: '文章重點:',
weight: 'bold',
size: 'sm',
color: '#1E293B'
},
{
type: 'text',
text: '• hero 滿版主視覺與 aspectRatio 設定\n• baseline 基準線對齊星星評分圖示\n• footer 按鈕樣式(primary/secondary)\n• uri 開啟網頁與 message 關鍵字觸發',
size: 'xs',
color: '#475569',
wrap: true,
lineSpacing: '4px'
}
]
},
footer: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'button',
style: 'primary',
height: 'sm',
color: '#D97706',
action: {
type: 'uri',
label: '閱讀文章',
uri: 'https://jengting.blogspot.com/2026/11/Flex-Message-Image.html'
}
}
]
},
styles: {
header: {
backgroundColor: '#D97706'
}
}
}
]
};
}


沒有留言:
張貼留言