slackline/api/dialog

This module is generated by gleam run -m slackline_codegen/generate. Do not edit it by hand.

Legacy dialogs (dialog.*). Slack recommends modals instead.

Types

A legacy dialog definition.

pub type Dialog {
  Dialog(
    title: String,
    callback_id: String,
    elements: List(DialogElement),
    state: option.Option(String),
    submit_label: option.Option(String),
    notify_on_cancel: option.Option(Bool),
  )
}

Constructors

  • Dialog(
      title: String,
      callback_id: String,
      elements: List(DialogElement),
      state: option.Option(String),
      submit_label: option.Option(String),
      notify_on_cancel: option.Option(Bool),
    )

    Arguments

    title

    User-facing title. 24 characters maximum.

    callback_id

    Identifies submissions of this dialog. 255 characters maximum.

    elements

    The form elements, up to 10.

    state

    A string echoed back on submission and cancellation. Up to 3000 characters.

    submit_label

    Label of the submit button. A single word, 48 characters maximum. Defaults to Submit.

    notify_on_cancel

    When true, your request URL is notified when the user cancels.

Where a select element’s options come from.

pub type DialogDataSource {
  StaticDataSource
  UsersDataSource
  ChannelsDataSource
  ConversationsDataSource
  ExternalDataSource
}

Constructors

  • StaticDataSource

    static

  • UsersDataSource

    users

  • ChannelsDataSource

    channels

  • ConversationsDataSource

    conversations

  • ExternalDataSource

    external

A dialog form element.

pub type DialogElement {
  DialogTextElement(
    label: String,
    name: String,
    placeholder: option.Option(String),
    max_length: option.Option(Int),
    min_length: option.Option(Int),
    optional: option.Option(Bool),
    hint: option.Option(String),
    subtype: option.Option(DialogTextSubtype),
    value: option.Option(String),
  )
  DialogTextareaElement(
    label: String,
    name: String,
    placeholder: option.Option(String),
    max_length: option.Option(Int),
    min_length: option.Option(Int),
    optional: option.Option(Bool),
    hint: option.Option(String),
    subtype: option.Option(DialogTextSubtype),
    value: option.Option(String),
  )
  DialogSelectElement(
    label: String,
    name: String,
    data_source: option.Option(DialogDataSource),
    min_query_length: option.Option(Int),
    placeholder: option.Option(String),
    optional: option.Option(Bool),
    value: option.Option(String),
    selected_options: option.Option(
      List(interaction.DialogOption),
    ),
    options: option.Option(List(interaction.DialogOption)),
    option_groups: option.Option(
      List(interaction.DialogOptionGroup),
    ),
  )
  UnknownDialogElement(type_: String, raw: value.Value)
}

Constructors

  • DialogTextElement(
      label: String,
      name: String,
      placeholder: option.Option(String),
      max_length: option.Option(Int),
      min_length: option.Option(Int),
      optional: option.Option(Bool),
      hint: option.Option(String),
      subtype: option.Option(DialogTextSubtype),
      value: option.Option(String),
    )

    A single-line plain text input.

    Arguments

    label

    Label displayed to the user. 48 characters maximum.

    name

    Name of the element, used as the key in the submission. 300 characters maximum.

    placeholder

    Guides users in completing the element. 150 characters maximum.

    max_length

    Maximum input length, up to 150. Defaults to 150.

    min_length

    Minimum input length, up to 150. Defaults to 0.

    optional

    true when the element is not required.

    hint

    Helpful text shown with the element. 150 characters maximum.

    subtype

    Optimizes the input for a kind of value. Does not validate.

    value

    A default value. 150 characters maximum.

  • DialogTextareaElement(
      label: String,
      name: String,
      placeholder: option.Option(String),
      max_length: option.Option(Int),
      min_length: option.Option(Int),
      optional: option.Option(Bool),
      hint: option.Option(String),
      subtype: option.Option(DialogTextSubtype),
      value: option.Option(String),
    )

    A multi-line plain text input.

    Arguments

    label

    Label displayed to the user. 48 characters maximum.

    name

    Name of the element, used as the key in the submission. 300 characters maximum.

    placeholder

    Guides users in completing the element. 150 characters maximum.

    max_length

    Maximum input length, up to 3000. Defaults to 3000.

    min_length

    Minimum input length, up to 3000. Defaults to 0.

    optional

    true when the element is not required.

    hint

    Helpful text shown with the element. 150 characters maximum.

    subtype

    Optimizes the input for a kind of value. Does not validate.

    value

    A default value. 3000 characters maximum.

  • DialogSelectElement(
      label: String,
      name: String,
      data_source: option.Option(DialogDataSource),
      min_query_length: option.Option(Int),
      placeholder: option.Option(String),
      optional: option.Option(Bool),
      value: option.Option(String),
      selected_options: option.Option(List(interaction.DialogOption)),
      options: option.Option(List(interaction.DialogOption)),
      option_groups: option.Option(
        List(interaction.DialogOptionGroup),
      ),
    )

    A select menu with static or dynamic options.

    Arguments

    label

    Label displayed to the user. 48 characters maximum.

    name

    Name of the element, used as the key in the submission. 300 characters maximum.

    data_source

    Where the options come from. Defaults to static.

    min_query_length

    Characters a user must type before options are requested from an external data source.

    placeholder

    Guides users in completing the element. 150 characters maximum.

    optional

    true when the element is not required.

    value

    The default selected value, for every data source except external.

    selected_options

    The default selection for an external data source: a single option.

    options

    Up to 100 options. options or option_groups is required for static and external menus.

    option_groups

    Up to 100 option groups.

  • UnknownDialogElement(type_: String, raw: value.Value)

    A type that this version of slackline does not know. raw holds the full json.

A keyboard hint for text inputs.

pub type DialogTextSubtype {
  Email
  Number
  Tel
  Url
}

Constructors

  • Email

    email

  • Number

    number

  • Tel

    tel

  • Url

    url

Identifies dialog.open in the slackline.Call that open returns.

pub type Open

Values

pub fn dialog_data_source_decoder() -> decode.Decoder(
  DialogDataSource,
)

Decodes DialogDataSource from a json string.

pub fn dialog_data_source_from_string(
  string: String,
) -> Result(DialogDataSource, Nil)

Parses DialogDataSource from its json string.

pub fn dialog_data_source_to_json(
  it: DialogDataSource,
) -> json.Json

Encodes DialogDataSource as a json string.

pub fn dialog_data_source_to_string(
  it: DialogDataSource,
) -> String

The json string of DialogDataSource.

pub fn dialog_decoder() -> decode.Decoder(Dialog)

Decodes Dialog from json.

pub fn dialog_element_decoder() -> decode.Decoder(DialogElement)

Decodes DialogElement from json. The type field selects the variant.

pub fn dialog_element_to_json(it: DialogElement) -> json.Json

Encodes DialogElement as json.

pub fn dialog_text_subtype_decoder() -> decode.Decoder(
  DialogTextSubtype,
)

Decodes DialogTextSubtype from a json string.

pub fn dialog_text_subtype_from_string(
  string: String,
) -> Result(DialogTextSubtype, Nil)

Parses DialogTextSubtype from its json string.

pub fn dialog_text_subtype_to_json(
  it: DialogTextSubtype,
) -> json.Json

Encodes DialogTextSubtype as a json string.

pub fn dialog_text_subtype_to_string(
  it: DialogTextSubtype,
) -> String

The json string of DialogTextSubtype.

pub fn dialog_to_json(it: Dialog) -> json.Json

Encodes Dialog as json.

pub fn open(
  dialog dialog: Dialog,
  trigger_id trigger_id: String,
) -> slackline.Call(Open, Nil)

dialog.open: Open a dialog with a user

dialog.Open identifies this method in slackline.Call.

Rate limit tier: t4.

Documented errors: app_missing_action_url, cannot_create_dialog, failed_sending_dialog, invalid_trigger, missing_dialog, missing_trigger, trigger_exchanged, trigger_expired, validation_errors.

✨ Search Document