class Line::Message::Builder::Text
The Text class provides a builder for creating simple text messages in the LINE Messaging API. Text messages are the most basic message type, consisting of plain text content with optional quick reply buttons and quote tokens for replying to specific messages.
Text messages support:
-
Plain text content (up to 5,000 characters)
-
Quick reply buttons for user interaction
-
Quote tokens to reply to specific messages in a conversation
Example: Basic text message
Line::Message::Builder.with do text "Hello, world!" end
Example: Text with quick reply
Line::Message::Builder.with do text "Choose an option:" do quick_reply do button action: :message, label: "Yes", text: "I agree" button action: :message, label: "No", text: "I disagree" end end end
Example: Text with quote token
Line::Message::Builder.with do text "This is a reply" do quote_token "sample_quote_token_value" end end
The Text builder inherits from Base and can be used within the Line::Message::Builder.with block using the text method.
Public Class Methods
Source
# File lib/line/message/builder/text.rb, line 77 def initialize(text, context: nil, **options, &block) @text = text super(context: context, **options, &block) end
Creates a new text message builder.
- text
-
The text content of the message (up to 5,000 characters)
- context
-
An optional context object for method delegation (default:
nil) - option
-
Additional options to configure the text message
- block
-
Optional block for configuring quick replies or quote token
Example
text = Text.new("Hello!", context: view_context) do quick_reply do button action: :message, label: "Hi", text: "Hi back!" end end
Line::Message::Builder::Base::new