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 Details

    • text

      ContentBlockBuilder text(Consumer<TextContentBuilder> blockBuilderConsumer)
      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 via TextContentBuilder; must not be null
      Returns:
      this builder
    • bold

      ContentBlockBuilder bold(Consumer<TextContentBuilder> blockBuilderConsumer)
      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 via TextContentBuilder; must not be null
      Returns:
      this builder
    • italic

      ContentBlockBuilder italic(Consumer<TextContentBuilder> blockBuilderConsumer)
      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 via TextContentBuilder; must not be null
      Returns:
      this builder
    • link

      ContentBlockBuilder link(URI url, Consumer<TextContentBuilder> blockBuilderConsumer)
      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 be null
      blockBuilderConsumer - consumer that configures the link label via TextContentBuilder; must not be null
      Returns:
      this builder
    • 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