Messages, Attachments and Views
Generated from compiled Elixir documentation and native typespecs. Values are immutable; constructors and changes use keyword options.
Slackblocks.Attachment
A legacy message attachment containing blocks and an optional color bar.
Slack reference: https://docs.slack.dev/messaging/formatting-message-text#when-to-use-attachments
Fields
blocks— Adds the attachment's blocks in display order. Required.color— Sets the attachment's left border color: a six-digit hex color or good, warning, or danger. Optional;nilomits the field.fallback— Sets plain-text summary shown in clients that cannot display attachments. Optional;nilomits the field.
Types
@type t() :: %Slackblocks.Attachment{
blocks: [Slackblocks.Types.block()],
color: binary() | nil,
fallback: binary() | nil
}
change/2
Atomically replaces supplied fields; omitted fields retain their values.
change(value, options)
@spec change(
t(),
keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
change!/2
Replaces fields or raises Slackblocks.ValidationError.
change!(value, options)
@spec change!(
t(),
keyword()
) :: t()
new/1
Constructs and validates a value. Text conveniences apply to keyword input.
new(options)
@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
new!/1
Constructs a value or raises Slackblocks.ValidationError.
new!(options)
@spec new!(keyword()) :: t()
Slackblocks.Message
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;nilomits the field.attachments— Adds legacy attachments in display order. Optional;nilomits the field.text— Sets the fallback text used in notifications and by clients that cannot display blocks. Default:"". Optional;nilomits the field.mrkdwn— Sets whether Slack formats the top-level text as mrkdwn. Default:true. Optional;nilomits the field.unfurl_links— Sets whether Slack unfurls text-based links. Optional;nilomits the field.unfurl_media— Sets whether Slack unfurls media links. Optional;nilomits the field.metadata— Sets message metadata as a JSON-compatible map, such as event_type and event_payload. Optional;nilomits the field.
Types
@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
}
change/2
Atomically replaces supplied fields; omitted fields retain their values.
change(value, options)
@spec change(
t(),
keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
change!/2
Replaces fields or raises Slackblocks.ValidationError.
change!(value, options)
@spec change!(
t(),
keyword()
) :: t()
new/1
Constructs and validates a value. Text conveniences apply to keyword input.
new(options)
@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
new!/1
Constructs a value or raises Slackblocks.ValidationError.
new!(options)
@spec new!(keyword()) :: t()
Slackblocks.MessageResponse
A response body for slash commands and interaction response URLs.
Slack reference: https://docs.slack.dev/interactivity/handling-user-interaction#message_responses
Fields
blocks— Adds the response blocks in display order. Optional;nilomits the field.attachments— Adds legacy attachments in display order. Optional;nilomits the field.text— Sets the fallback text used in notifications and by clients that cannot display blocks. Default:"". Optional;nilomits the field.mrkdwn— Sets whether Slack formats the top-level text as mrkdwn. Default:true. Optional;nilomits the field.replace_original— Sets whether the response replaces the message that triggered it. Default:false. Optional;nilomits the field.response_type— Sets who can see the response. Default::in_channel. Optional;nilomits the field.
Types
@type t() :: %Slackblocks.MessageResponse{
attachments: [Slackblocks.Attachment.t()] | nil,
blocks: [Slackblocks.Types.block()] | nil,
mrkdwn: boolean() | nil,
replace_original: boolean() | nil,
response_type: Slackblocks.Types.response_type() | nil,
text: binary() | nil
}
change/2
Atomically replaces supplied fields; omitted fields retain their values.
change(value, options)
@spec change(
t(),
keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
change!/2
Replaces fields or raises Slackblocks.ValidationError.
change!(value, options)
@spec change!(
t(),
keyword()
) :: t()
new/1
Constructs and validates a value. Text conveniences apply to keyword input.
new(options \\ [])
@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
new!/1
Constructs a value or raises Slackblocks.ValidationError.
new!(options \\ [])
@spec new!(keyword()) :: t()
Slackblocks.Views.Home
The payload for publishing an App Home tab with views.publish.
Slack reference: https://docs.slack.dev/surfaces/app-home
Fields
blocks— Adds the blocks shown on the App Home tab, in display order. Required.private_metadata— Sets application-defined data returned in view payloads. Optional;nilomits the field.callback_id— Sets an identifier returned in view payloads so your app can recognize the view. Optional;nilomits the field.external_id— Sets a workspace-unique identifier you can use to update the view later. Optional;nilomits the field.
Types
@type t() :: %Slackblocks.Views.Home{
blocks: [Slackblocks.Types.block()],
callback_id: binary() | nil,
external_id: binary() | nil,
private_metadata: binary() | nil
}
change/2
Atomically replaces supplied fields; omitted fields retain their values.
change(value, options)
@spec change(
t(),
keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
change!/2
Replaces fields or raises Slackblocks.ValidationError.
change!(value, options)
@spec change!(
t(),
keyword()
) :: t()
new/1
Constructs and validates a value. Text conveniences apply to keyword input.
new(options)
@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
new!/1
Constructs a value or raises Slackblocks.ValidationError.
new!(options)
@spec new!(keyword()) :: t()
Slackblocks.Views.Modal
The view payload for views.open, views.push, and views.update.
Slack reference: https://docs.slack.dev/surfaces/modals
Fields
title— Sets the title in the modal's top bar. Required.blocks— Adds the blocks shown in the modal, in display order. Required.close— Sets the label of the button that closes the modal. Optional;nilomits the field.submit— Sets the label of the button that submits the modal. Optional;nilomits the field.private_metadata— Sets application-defined data returned in view payloads. Optional;nilomits the field.callback_id— Sets an identifier returned in view payloads so your app can recognize the view. Optional;nilomits the field.clear_on_close— Sets whether closing this modal closes every view in its stack. Optional;nilomits the field.notify_on_close— Sets whether Slack sends a view_closed event when the user closes the modal. Optional;nilomits the field.external_id— Sets a workspace-unique identifier you can use to update the view later. Optional;nilomits the field.submit_disabled— Sets whether the submit button starts disabled. Only valid in workflow configuration modals. Optional;nilomits the field.
Types
@type t() :: %Slackblocks.Views.Modal{
blocks: [Slackblocks.Types.block()],
callback_id: binary() | nil,
clear_on_close: boolean() | nil,
close: Slackblocks.Objects.PlainText.t() | nil,
external_id: binary() | nil,
notify_on_close: boolean() | nil,
private_metadata: binary() | nil,
submit: Slackblocks.Objects.PlainText.t() | nil,
submit_disabled: boolean() | nil,
title: Slackblocks.Objects.PlainText.t()
}
change/2
Atomically replaces supplied fields; omitted fields retain their values.
change(value, options)
@spec change(
t(),
keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
change!/2
Replaces fields or raises Slackblocks.ValidationError.
change!(value, options)
@spec change!(
t(),
keyword()
) :: t()
new/1
Constructs and validates a value. Text conveniences apply to keyword input.
new(options)
@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
new!/1
Constructs a value or raises Slackblocks.ValidationError.
new!(options)
@spec new!(keyword()) :: t()
Slackblocks.WebhookMessage
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;nilomits the field.attachments— Adds legacy attachments in display order. Optional;nilomits the field.text— Sets the fallback text used in notifications and by clients that cannot display blocks. Optional;nilomits the field.response_type— Sets who can see the response. Optional;nilomits the field.replace_original— Sets whether the response replaces the message that triggered it. Optional;nilomits the field.delete_original— Sets whether the response deletes the message that triggered it. Optional;nilomits the field.unfurl_links— Sets whether Slack unfurls text-based links. Optional;nilomits the field.unfurl_media— Sets whether Slack unfurls media links. Optional;nilomits the field.metadata— Sets message metadata as a JSON-compatible map, such as event_type and event_payload. Optional;nilomits the field.
Types
@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
}
change/2
Atomically replaces supplied fields; omitted fields retain their values.
change(value, options)
@spec change(
t(),
keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
change!/2
Replaces fields or raises Slackblocks.ValidationError.
change!(value, options)
@spec change!(
t(),
keyword()
) :: t()
new/1
Constructs and validates a value. Text conveniences apply to keyword input.
new(options \\ [])
@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}
new!/1
Constructs a value or raises Slackblocks.ValidationError.
new!(options \\ [])
@spec new!(keyword()) :: t()