Skip to content

feat(message): Add mrkdwn parameter for Slack formatting in message step #1024

@bob-bot

Description

@bob-bot

Problem

The message step currently sends plain text to Slack using plain_text block type, which means Slack mrkdwn formatting syntax (bold, italic, links, code) is rendered literally instead of being formatted.

Example of current behavior:

step "message" "alert" {
    notifier = notifier.slack_ops
    text     = "*Alert*: Check <https://console.aws.amazon.com|AWS Console>"
}

What Slack shows: *Alert*: Check <https://console.aws.amazon.com|AWS Console> (literal characters)

What users expect: Alert: Check AWS Console (formatted)

Use Case

Users who rely on notifiers (e.g., having read-only Slack access but using a shared notifier with write permissions) cannot send formatted messages. This is particularly important for:

  • Security alerts that need visual emphasis
  • Notifications with clickable links
  • Status updates with structured formatting

Proposed Solution

Add an optional mrkdwn boolean parameter to the message step:

step "message" "alert" {
    notifier = notifier.slack_ops
    text     = "*Alert*: Check <https://console.aws.amazon.com|AWS Console>"
    mrkdwn   = true  # NEW - enables Slack mrkdwn formatting
}

When mrkdwn = true, the message step uses mrkdwn type instead of plain_text in the Block Kit payload.

Technical Details

The root cause is in internal/primitive/message.go:

// CURRENT
promptBlock := slack.NewTextBlockObject(slack.PlainTextType, icm.Text, false, false)

// PROPOSED
textType := slack.PlainTextType
if icm.Mrkdwn {
    textType = slack.MarkdownType
}
promptBlock := slack.NewTextBlockObject(textType, icm.Text, false, false)

Backward Compatibility

  • Default: mrkdwn defaults to false (unset)
  • Existing pipelines work exactly as before
  • New pipelines can opt-in to formatting

Platform Note

Testing revealed that Slack's mobile app partially renders formatting in plain_text blocks (bold, italic, code) but not links. Desktop shows everything as literal characters. Using mrkdwn=true ensures consistent rendering across all Slack clients.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions