slackline/command

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

Slash commands: the payload Slack sends to a command’s Request URL.

Slack sends it as application/x-www-form-urlencoded. Parse the body with uri.parse_query and pass the pairs to parse.

Respond with an empty 200, plain text, or a slackline/interaction.ResponseMessage. See https://docs.slack.dev/interactivity/implementing-slash-commands.

Types

pub type SlashCommand {
  SlashCommand(
    token: option.Option(String),
    command: String,
    text: option.Option(String),
    response_url: String,
    trigger_id: String,
    user_id: String,
    user_name: option.Option(String),
    team_id: option.Option(String),
    team_domain: option.Option(String),
    enterprise_id: option.Option(String),
    enterprise_name: option.Option(String),
    channel_id: String,
    channel_name: option.Option(String),
    api_app_id: option.Option(String),
    is_enterprise_install: option.Option(String),
    ssl_check: option.Option(String),
  )
}

Constructors

  • SlashCommand(
      token: option.Option(String),
      command: String,
      text: option.Option(String),
      response_url: String,
      trigger_id: String,
      user_id: String,
      user_name: option.Option(String),
      team_id: option.Option(String),
      team_domain: option.Option(String),
      enterprise_id: option.Option(String),
      enterprise_name: option.Option(String),
      channel_id: String,
      channel_name: option.Option(String),
      api_app_id: option.Option(String),
      is_enterprise_install: option.Option(String),
      ssl_check: option.Option(String),
    )

    Arguments

    token

    (Deprecated) A verification token. Verify requests with the signing secret instead.

    command

    The command that was entered, for example /weather.

    text

    The part of the slash command after the command itself. Empty when nothing was typed.

    response_url

    A temporary webhook URL for message responses.

    trigger_id

    A short-lived ID that allows the app to open a modal.

    user_id

    The ID of the user who triggered the command.

    user_name

    (Deprecated) The plain text name of the user. Use user_id instead.

    team_id

    The workspace the command was invoked in.

    team_domain

    The slack.com subdomain of the workspace.

    enterprise_id

    Present when the workspace is part of an Enterprise organization.

    enterprise_name

    Present when the workspace is part of an Enterprise organization.

    channel_id

    The conversation the command was invoked in.

    channel_name

    The name of that conversation.

    api_app_id

    Your app’s unique identifier.

    is_enterprise_install

    "true" or "false": whether the app is installed at the org level.

    ssl_check

    "1" on SSL certificate check requests. Acknowledge and ignore those requests.

Values

pub fn parse(
  fields: List(#(String, String)),
) -> Result(SlashCommand, List(decode.DecodeError))

Decodes a slash command from form fields that are already parsed, for example the result of uri.parse_query on the request body.

pub fn slash_command_decoder() -> decode.Decoder(SlashCommand)

Decodes SlashCommand from json.

pub fn slash_command_to_json(it: SlashCommand) -> json.Json

Encodes SlashCommand as json.

✨ Search Document