Slackblocks.Message (slackblocks v2.8.0)

View Source

A complete payload for chat.postMessage and related Web API methods.

Slack reference: https://docs.slack.dev/reference/methods/chat.postMessage

Fields

  • channel — Sets the ID of the channel, private group, or conversation that receives the message. Required.
  • blocks — Adds the message blocks in display order. Optional; nil omits the field.
  • attachments — Adds legacy attachments in display order. Optional; nil omits the field.
  • text — Sets the fallback text used in notifications and by clients that cannot display blocks. Default: "". Optional; nil omits the field.
  • mrkdwn — Sets whether Slack formats the top-level text as mrkdwn. Default: true. Optional; nil omits the field.
  • unfurl_links — Sets whether Slack unfurls text-based links. Optional; nil omits the field.
  • unfurl_media — Sets whether Slack unfurls media links. Optional; nil omits the field.
  • metadata — Sets message metadata as a JSON-compatible map, such as event_type and event_payload. Optional; nil omits the field.

Summary

Functions

Atomically replaces supplied fields; omitted fields retain their values.

Constructs and validates a value. Text conveniences apply to keyword input.

Constructs a value or raises Slackblocks.ValidationError.

Types

t()

@type t() :: %Slackblocks.Message{
  attachments: [Slackblocks.Attachment.t()] | nil,
  blocks: [Slackblocks.Types.block()] | nil,
  channel: binary(),
  metadata: %{optional(binary()) => Slackblocks.Types.json()} | nil,
  mrkdwn: boolean() | nil,
  text: binary() | nil,
  unfurl_links: boolean() | nil,
  unfurl_media: boolean() | nil
}

Functions

change(value, options)

@spec change(
  t(),
  keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}

Atomically replaces supplied fields; omitted fields retain their values.

change!(value, options)

@spec change!(
  t(),
  keyword()
) :: t()

Replaces fields or raises Slackblocks.ValidationError.

new(options)

@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}

Constructs and validates a value. Text conveniences apply to keyword input.

new!(options)

@spec new!(keyword()) :: t()

Constructs a value or raises Slackblocks.ValidationError.