Interface ContentBlockBuilder
public interface ContentBlockBuilder
Builder for composing the content body of a notification as an ordered list of blocks.
Each method appends a block to the content list. Blocks are rendered in sequence across all channels (email, UI, Slack, Teams).
Guardrails
- A maximum of 20 content blocks are sent; blocks beyond the limit are silently dropped.
- All literal text values inside blocks are trimmed to 250 characters.
- Translation key params are trimmed to 250 characters each, limited to 10 per block.
Groovy example
.content { c -> c
.text { t -> t.textKey("workflow.review.intro", userName) }
.newLine()
.bold { t -> t.text(assetName) }
.italic { t -> t.textKey("workflow.review.deadline") }
.newLine()
.link(assetUri) { t -> t.textKey("workflow.review.open") } }
-
Method Summary
Modifier and TypeMethodDescriptionbold(Consumer<TextContentBuilder> blockBuilderConsumer) Appends a bold text block to the notification content.italic(Consumer<TextContentBuilder> blockBuilderConsumer) Appends an italic text block to the notification content.link(URI url, Consumer<TextContentBuilder> blockBuilderConsumer) Appends a hyperlinked text block to the notification content.newLine()Appends a line break to the notification content.text(Consumer<TextContentBuilder> blockBuilderConsumer) Appends a plain text block to the notification content.
-
Method Details
-
text
Appends a plain text block to the notification content.Each call appends a new block — calling this method more than once does not replace previously added blocks.
- Parameters:
blockBuilderConsumer- consumer that configures the text viaTextContentBuilder; must not benull- Returns:
- this builder
-
bold
Appends a bold text block to the notification content.Each call appends a new block — calling this method more than once does not replace previously added blocks.
- Parameters:
blockBuilderConsumer- consumer that configures the bold text viaTextContentBuilder; must not benull- Returns:
- this builder
-
italic
Appends an italic text block to the notification content.Each call appends a new block — calling this method more than once does not replace previously added blocks.
- Parameters:
blockBuilderConsumer- consumer that configures the italic text viaTextContentBuilder; must not benull- Returns:
- this builder
-
link
Appends a hyperlinked text block to the notification content.Each call appends a new block — calling this method more than once does not replace previously added blocks.
- Parameters:
url- the URL the link points to; must not benullblockBuilderConsumer- consumer that configures the link label viaTextContentBuilder; must not benull- Returns:
- this builder
-
newLine
ContentBlockBuilder newLine()Appends a line break to the notification content.Each call appends a new line break — calling this method more than once inserts multiple line breaks.
- Returns:
- this builder
-