Builders for LINE template messages.
Ref: https://developers.line.biz/en/reference/messaging-api/#template-messages
Summary
Functions
Buttons template.
Carousel template — up to 10 columns built with carousel_column/3.
A carousel column. text and actions are required.
Confirm template — two actions (yes/no).
Image carousel template — columns built with image_carousel_column/2.
An image carousel column: an image with a single action.
Functions
Buttons template.
Options: :alt_text (defaults to text), :thumbnail_image_url,
:image_aspect_ratio, :image_size, :image_background_color, :title,
:default_action.
Ref: https://developers.line.biz/en/reference/messaging-api/#buttons
iex> ExLine.Message.Template.buttons("Pick one", [ExLine.Message.Action.message("A", "a")])
%{
type: "template",
altText: "Pick one",
template: %{type: "buttons", text: "Pick one", actions: [%{type: "message", label: "A", text: "a"}]}
}
Carousel template — up to 10 columns built with carousel_column/3.
Options: :alt_text, :image_aspect_ratio, :image_size.
Ref: https://developers.line.biz/en/reference/messaging-api/#carousel
A carousel column. text and actions are required.
Options: :title, :thumbnail_image_url, :image_background_color, :default_action.
iex> ExLine.Message.Template.carousel_column("desc", [ExLine.Message.Action.message("A", "a")])
%{text: "desc", actions: [%{type: "message", label: "A", text: "a"}]}
Confirm template — two actions (yes/no).
Ref: https://developers.line.biz/en/reference/messaging-api/#confirm
iex> ExLine.Message.Template.confirm("OK?", [ExLine.Message.Action.message("Yes", "y"), ExLine.Message.Action.message("No", "n")])
%{
type: "template",
altText: "OK?",
template: %{type: "confirm", text: "OK?", actions: [
%{type: "message", label: "Yes", text: "y"},
%{type: "message", label: "No", text: "n"}
]}
}
Image carousel template — columns built with image_carousel_column/2.
Ref: https://developers.line.biz/en/reference/messaging-api/#image-carousel
An image carousel column: an image with a single action.
iex> ExLine.Message.Template.image_carousel_column("https://x/i.jpg", ExLine.Message.Action.uri("Open", "https://x"))
%{imageUrl: "https://x/i.jpg", action: %{type: "uri", label: "Open", uri: "https://x"}}