透過 Zoom 分享聲音時發現,平常播的音樂透過 Zoom 分享後,整個音質下降很多且聽起來就是有種糊糊的感覺還伴隨著隨機破音,後來發現 Lenovo ThinkPad 筆電內 Windows 11 有 [音訊增強] 設定,把它關閉後過 Zoom 分享聲音就正常了
~楓花雪岳~
星期三, 11月 18, 2026
星期六, 11月 14, 2026
[Line] Flex Message - 圖文與按鈕
該筆記重點
官方文件 示意圖,直接看圖理解囉
Button
style
- hero 區塊:放置滿版主視覺圖片
- layout-baseline:專門用來把小圖示 (icon) 與文字 (text) 沿著文字底部基準線對齊,該範例內容是應用在星級評分
- footer 區塊 + button 控件
- action.type-uri:點擊後直接開啟外部網頁
function getCafeCard() {
return {
"type": "bubble",
"size": "mega",
"hero": {
"type": "image",
"url": "https://images.unsplash.com/photo-1501339847302-ac426a4a7cbb?auto=format&fit=crop&w=1000&q=80",
"size": "full",
"aspectRatio": "20:13",
"aspectMode": "cover"
},
"body": {
"type": "box",
"layout": "vertical",
"spacing": "sm",
"contents": [
{
"type": "text",
"text": " 圖文與按鈕",
"weight": "bold",
"color": "#D97706",
"size": "xs"
},
{
"type": "text",
"text": "楓花雪岳 Kaffe",
"weight": "bold",
"size": "xl",
"color": "#1E293B",
"wrap": true
},
{
"type": "box",
"layout": "baseline",
"margin": "md",
"contents": [
{
"type": "icon",
"size": "sm",
"url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
},
{
"type": "icon",
"size": "sm",
"url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
},
{
"type": "icon",
"size": "sm",
"url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
},
{
"type": "icon",
"size": "sm",
"url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
},
{
"type": "icon",
"size": "sm",
"url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
},
{
"type": "text",
"text": "4.9 (128 則評論)",
"size": "sm",
"color": "#64748B",
"margin": "md",
"flex": 0
}
]
},
{
"type": "box",
"layout": "vertical",
"margin": "lg",
"spacing": "sm",
"contents": [
{
"type": "box",
"layout": "horizontal",
"spacing": "sm",
"contents": [
{
"type": "text",
"text": "招牌推薦",
"color": "#94A3B8",
"size": "sm",
"flex": 2
},
{
"type": "text",
"text": "衣索比亞 紫風鈴 ($200)",
"wrap": true,
"color": "#334155",
"size": "sm",
"flex": 5
}
]
},
{
"type": "box",
"layout": "horizontal",
"spacing": "sm",
"contents": [
{
"type": "text",
"text": "營業時間",
"color": "#94A3B8",
"size": "sm",
"flex": 2
},
{
"type": "text",
"text": "每日10:00 營業(週一公休)",
"wrap": true,
"color": "#334155",
"size": "sm",
"flex": 5
}
]
}
]
}
]
},
"footer": {
"type": "box",
"layout": "vertical",
"spacing": "sm",
"flex": 0,
"contents": [
{
"type": "button",
"style": "primary",
"height": "sm",
"color": "#D97706",
"action": {
"type": "uri",
"label": "楓花雪岳官網",
"uri": "https://jengting.blogspot.com/"
}
}
]
}
};
}
Image- Size:有三種設定方式,分別為尺寸關鍵字、像素、百分比,預設值為尺寸 md
- aspectRatio:設定圖片顯示區域的寬高比,寬與高的數值範圍為 1-100,000,且高不能超過寬的 3 倍,未設定預設為 1:1
- aspectMode:設定圖片如何填入顯示區域,當原始圖片比例與 aspectRatio 不一致時,就由這個屬性決定顯示方式
- cover:照片放大到填滿寬度,上下部分會被裁掉
- fit:整張照片完整顯示,左右會留下空間
官方文件 示意圖,直接看圖理解囉
Button
style
- primary:適合深色底的主要按鈕
- secondary:適合淺色底的次要按鈕
- link:文字連結樣式,也是預設值
action 屬性
- uri:開啟指定網址
- message:點擊後讓使用者在聊天室送出指定文字,可以應用在觸發關鍵字回覆 (可觸發 Webhook 回應)
星期六, 11月 07, 2026
[Line] Flex Message - 排版容器應用
該筆記練習使用垂直、水平排版容器,來製作雙欄明細資訊
Flex Message json 和發出效果
巢狀容器
在垂直排版容器 (下圖綠色框) 內放入多個水平排版容器 (下圖黃色框),水平排版容器內放置文字標籤,藉此來顯示雙欄位文字資訊
屬性 flex
flex 則是決定水平排版容器內的文字標籤佔整個水平空間比例,以該例子來說,左側文字標籤設定 flex: 1 、右側文字標籤設定 flex: 2,所以水平空間總比例為 3 ,左側文字標籤代表佔 1/3、右側文字標籤代表佔 2/3
Flex Message json 和發出效果
function getMultiColumnJson() {
return {
"type": "bubble",
"size": "mega",
"header": {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "text",
"text": "雙欄明細資訊",
"color": "#BFDBFE",
"size": "xs",
"weight": "bold"
},
{
"type": "text",
"text": "實戰工作坊入場憑證",
"color": "#FFFFFF",
"size": "lg",
"weight": "bold",
"margin": "xs"
}
]
},
"body": {
"type": "box",
"layout": "vertical",
"spacing": "md",
"contents": [
{
"type": "text",
"text": "LineBot × GAS 自動化實戰班",
"weight": "bold",
"size": "md",
"color": "#0F172A",
"wrap": true
},
{
"type": "separator",
"margin": "md",
"color": "#E2E8F0"
},
{
"type": "box",
"layout": "vertical",
"margin": "md",
"spacing": "sm",
"contents": [
{
"type": "box",
"layout": "horizontal",
"contents": [
{
"type": "text",
"text": "活動日期",
"size": "sm",
"color": "#64748B",
"flex": 1
},
{
"type": "text",
"text": "2026/11/15 (日) 14:00",
"size": "sm",
"color": "#1E293B",
"weight": "bold",
"flex": 2,
"align": "end"
}
]
},
{
"type": "box",
"layout": "horizontal",
"contents": [
{
"type": "text",
"text": "上課地點",
"size": "sm",
"color": "#64748B",
"flex": 1
},
{
"type": "text",
"text": "台北市 OO 區 XX 路 ZZ 號",
"size": "sm",
"color": "#1E293B",
"flex": 2,
"align": "end",
"wrap": true
}
]
},
{
"type": "box",
"layout": "horizontal",
"contents": [
{
"type": "text",
"text": "報到序號",
"size": "sm",
"color": "#64748B",
"flex": 1
},
{
"type": "text",
"text": "#GAS-888",
"size": "sm",
"color": "#2563EB",
"weight": "bold",
"flex": 2,
"align": "end"
}
]
}
]
},
{
"type": "separator",
"margin": "md",
"color": "#E2E8F0"
},
{
"type": "text",
"text": "排版技巧:利用垂直排版容器搭配水平排版容器,即可做出對齊資訊欄位",
"size": "xs",
"color": "#94A3B8",
"wrap": true,
"margin": "md"
}
]
},
"styles": {
"header": {
"backgroundColor": "#7C3AED"
}
}
}
}
巢狀容器
在垂直排版容器 (下圖綠色框) 內放入多個水平排版容器 (下圖黃色框),水平排版容器內放置文字標籤,藉此來顯示雙欄位文字資訊
屬性 flex
flex 則是決定水平排版容器內的文字標籤佔整個水平空間比例,以該例子來說,左側文字標籤設定 flex: 1 、右側文字標籤設定 flex: 2,所以水平空間總比例為 3 ,左側文字標籤代表佔 1/3、右側文字標籤代表佔 2/3
星期二, 11月 03, 2026
[Line] Flex Message - Hello World
在 [Line] Flex Message - 模擬器 取得 Flex Message json 內容搭配 [GAS] LineBot 傳送訊息,使用 push API 主動發出 Flex Message 發給使用者
function testSendFlexMessageFromGAS() {
const userId = getUserID();
const card = SendFlexMessageFromGAS();
pushFlexMessage(userId, 'altText:Hello Flex Message From GAS', card);
}
function SendFlexMessageFromGAS() {
return {
"type": "bubble",
"body": {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "text",
"text": "Flex Message Sample",
"weight": "bold",
"color": "#1DB446",
"size": "xs"
},
{
"type": "text",
"text": "Hello Flex Message",
"weight": "bold",
"size": "xl",
"color": "#1E293B"
},
{
"type": "text",
"text": "從 Google Apps Script 發出的第一張 Flex Message,這張卡片只用了最基礎的 body 區塊與 vertical 垂直排列容器",
"size": "sm",
"color": "#64748B",
"wrap": true,
"lineSpacing": "4px"
}
]
}
}
}
function pushFlexMessage(to, altText, flexContents) {
const channelAccessToken = getchannelAccessToken();
const payload = {
to,
messages: [
{
type: 'flex',
altText,
contents: flexContents
}
]
};
const options = {
method: 'post',
contentType: 'application/json',
headers: {
Authorization: `Bearer ${channelAccessToken}`
},
payload: JSON.stringify(payload),
muteHttpExceptions: true
};
const lineUrl = "https://api.line.me/v2/bot/message/push";
const response = UrlFetchApp.fetch(lineUrl, options);
const statusCode = response.getResponseCode();
const responseText = response.getContentText();
if (statusCode === 200) {
Logger.log(`Flex Message 推播成功!"${altText}"`);
return JSON.parse(responseText || '{}');
}
throw new Error(`LINE Push API 發送失敗 (HTTP ${statusCode}):${responseText}`);
}
function getchannelAccessToken() {
const scriptProperties = PropertiesService.getScriptProperties();
const rawToken = scriptProperties.getProperty('CHANNEL_ACCESS_TOKEN') || '';
// 自動去除前後空白、換行或誤加的雙引號/單引號
const channelAccessToken = rawToken.trim().replace(/^["']+|["']+$/g, '');
if (!channelAccessToken) {
throw new Error(
'尚未設定指令碼屬性 (Script Properties) 內的 CHANNEL_ACCESS_TOKEN'
);
}
return channelAccessToken;
}
function getUserID() {
const scriptProperties = PropertiesService.getScriptProperties();
const rawUserId = scriptProperties.getProperty('USER_ID') || '';
// 自動去除前後空白、換行或誤加的雙引號/單引號
const userId = rawUserId.trim().replace(/^["']+|["']+$/g, '');
if (!userId) {
throw new Error(
'尚未設定指令碼屬性 (Script Properties) 內的 USER_ID'
);
}
return userId;
}
payload 內的 Message 有兩個重點- type 要指定為 flex
- altText 即為通知訊息,故意在文字前面打個 altText 來辨識
星期一, 11月 02, 2026
[Line] Flex Message - 模擬器
Line 訊息只能傳送單一類型內容,例如文字、圖片或影片,但 Flex Message 基於 CSS Flexible Box (CSS Flexbox) 能提供更豐富且具互動性的版面配置,官方有提供模擬器,可以製作 Flex Message 並發送測試,該筆記會透過模擬器來發送 Flex Message
Flex Message Simulator 介紹
模擬器 Layout 分為三大區域,由左至右分別為預覽畫面、訊息控件樹狀圖、控件屬性,右上角四個按鈕功能分別為
Flex Message 控件一覽圖
這張 bubble 官方解析圖 簡單明瞭
製作並發送 Flex Message
Flex Message 限制
同一則 Flex 訊息可能會因接收裝置的環境不同,而呈現不同的顯示效果。裝置的作業系統、LINE 版本、螢幕解析度、語言設定及字型,都可能影響訊息的顯示效果
Flex Message Simulator 介紹
使用 Line 帳號登錄模擬器後,該畫面是進入預設版面
模擬器 Layout 分為三大區域,由左至右分別為預覽畫面、訊息控件樹狀圖、控件屬性,右上角四個按鈕功能分別為
- New:建立新的空 Flex Message,只有 bubble 和 carousel 兩個選項
- Showcase:使用內建 Flex Message 範本
- Send:將設計好的 Flex Message 傳送至 Line 進行測試,需要先把 Flex Message Simulator 加入好友才能進行發送
- View as JSON:查看設計 Flex Message json,當 Flex Message 設計到一半時可以先透過該功能把 Flex Message json 複製出來,要繼續編輯時再複製回去並按右下角 Apply 按鈕就可以回復
這張 bubble 官方解析圖 簡單明瞭
- 容器層 (Container):只有 2 種,單張卡片 (bubble) 或 多張 bubble 左右輪播(carousel)
- 區塊層 (Block):每張 bubble 最多有 4 個區塊(由上而下,皆為選填)
- header:頂部標題列
- hero :主視覺滿版圖片、影片
- body :主要內容區(最常使用)
- footer:底部按鈕區
- 排版盒 (Box):Block 內必須放 box,透過 layout 決定排列方向
- vertical :垂直由上往下堆疊
- horizontal:水平由左往右並排(常搭配 flex 權重做雙欄表格)
- baseline :依文字基準線水平對齊(常搭配 icon 做星級評分)
- 元件層 (Component):放在 box 的控件,例如:text、image、button、separator、icon
製作並發送 Flex Message
使用 Receipt 範例來建立該 Flex Message,只用上 body 區塊與 vertical 垂直排列
Flex Message json 檔案
{
"type": "bubble",
"body": {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "text",
"text": "Flex Message Simulator",
"weight": "bold",
"color": "#1DB446",
"size": "xs"
},
{
"type": "text",
"text": "Hello Flex Message",
"weight": "bold",
"size": "xl",
"color": "#1E293B"
},
{
"type": "text",
"text": "從模擬器發出的第一張 Flex Message,這張卡片只用了最基礎的 body 區塊與 vertical 垂直排列容器",
"size": "sm",
"color": "#64748B",
"wrap": true,
"lineSpacing": "4px"
}
]
}
}
Flex Message 限制
同一則 Flex 訊息可能會因接收裝置的環境不同,而呈現不同的顯示效果。裝置的作業系統、LINE 版本、螢幕解析度、語言設定及字型,都可能影響訊息的顯示效果
訂閱:
文章 (Atom)











