Slackblocks.WebhookMessage (slackblocks v2.8.0)

View Source

A payload for incoming webhooks.

Slack reference: https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks

Fields

  • 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. Optional; nil omits the field.
  • response_type — Sets who can see the response. Optional; nil omits the field.
  • replace_original — Sets whether the response replaces the message that triggered it. Optional; nil omits the field.
  • delete_original — Sets whether the response deletes the message that triggered it. 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.WebhookMessage{
  attachments: [Slackblocks.Attachment.t()] | nil,
  blocks: [Slackblocks.Types.block()] | nil,
  delete_original: boolean() | nil,
  metadata: %{optional(binary()) => Slackblocks.Types.json()} | nil,
  replace_original: boolean() | nil,
  response_type: Slackblocks.Types.response_type() | 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.