Design LINE Card Message (Template)
line_design_cardBuild and validate LINE template messages (card messages) for buttons, confirm, carousel, and image_carousel subtypes. Returns JSON ready to send via line_send_message.
Instructions
Build a validated Template message (LINE OA Manager calls this a "Card Message") and return it as JSON, ready to hand to line_send_message. DESIGN ONLY — this never calls the LINE API; it just builds + validates the message object. Supports all four LINE template subtypes.
Subtypes (set via kind) and their LINE limits:
buttons → { title?, text, thumbnail_image_url?, actions } — 1..4 buttons. text ≤60 chars with title/thumb, else ≤160.
confirm → { text, actions } — exactly 2 buttons (e.g. ตกลง / ยกเลิก).
carousel → { columns } — ≤10 columns, each ≤3 buttons. EVERY column must have the SAME number of buttons (LINE rule). Each column: { title?, text, thumbnail_image_url?, default_action?, actions }.
image_carousel → { columns } — ≤10 columns, each { image_url (HTTPS), action }.
Action shape (used in actions / default_action / image_carousel action): { type:"uri", label, uri } | { type:"message", label, text } | { type:"postback", label, data, displayText? } label ≤20 chars. uri accepts http/https/tel/line.
Args:
kind: one of buttons | confirm | carousel | image_carousel (required).
alt_text: fallback text (1..400 chars, required).
title?, text?, thumbnail_image_url?, actions? — used by buttons/confirm.
columns? — used by carousel/image_carousel.
Returns: { message: , usage_hint: string }
Composability:
Build here → grab
message→ send via line_send_message (raw message passthrough).
Examples:
"การ์ดยืนยันการจอง ตกลง/ยกเลิก" → { kind: "confirm", alt_text: "ยืนยันการจอง", text: "ยืนยันการจองคิวเวลา 14:00 ไหม?", actions: [ { type: "postback", label: "ตกลง", data: "confirm=1" }, { type: "message", label: "ยกเลิก", text: "ยกเลิก" } ] }
"การ์ดเมนู 3 ปุ่ม มีรูป" → { kind: "buttons", alt_text: "เมนูร้าน", title: "ร้านกาแฟ", text: "เลือกเมนูที่สนใจ", thumbnail_image_url: "https://cdn.example.com/cover.jpg", actions: [ { type: "uri", label: "ดูเมนู", uri: "https://shop.example.com/menu" }, { type: "message", label: "โปรวันนี้", text: "โปรวันนี้" } ] }
Errors:
"buttons: ต้องมี actions อย่างน้อย 1 ปุ่ม" → supply actions for kind=buttons
"confirm: ต้องมี 2 ปุ่มเป๊ะ" → confirm needs exactly two
"carousel: ทุก column ต้องมีจำนวน action เท่ากัน" → equalize button counts across columns
"action.label ยาวเกิน 20 ตัวอักษร" → shorten the label
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Card subtype. Determines which other fields are required. | |
| alt_text | Yes | Fallback text shown in push notification + chat list (1..400 chars). | |
| title | No | [buttons] Optional card title. | |
| text | No | [buttons] body (≤60 with title/thumb, else ≤160). [confirm] question (required). | |
| thumbnail_image_url | No | [buttons] Optional HTTPS thumbnail. | |
| actions | No | [buttons] 1..4 buttons. [confirm] exactly 2 buttons. | |
| columns | No | [carousel] ≤10 columns (same action-count each). [image_carousel] ≤10 columns. |