slack-web-1.5.0.0: Bindings for the Slack web API
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.Slack.Experimental.Blocks

Synopsis

General Slack Messages

unorderedList :: [SlackText] -> SlackText Source #

Render an unordered (bulleted) list

link :: Text -> Maybe Text -> SlackText Source #

Render a link with optional link text

monospaced :: Slack a => a -> SlackText Source #

Render a Slack renderable value with ticks around it. Alias for ticks . message

data SlackImage Source #

Constructors

SlackImage 

Fields

Instances

Instances details
Show SlackImage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Eq SlackImage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

data SlackMessage Source #

Instances

Instances details
FromJSON SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

ToJSON SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Monoid SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Semigroup SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Show SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Eq SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Image SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Markdown SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

class Markdown a where Source #

Methods

markdown :: SlackText -> a Source #

class Image a where Source #

Methods

image :: SlackImage -> a Source #

Instances

Instances details
Image SlackContext Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

Image SlackMessage Source # 
Instance details

Defined in Web.Slack.Experimental.Blocks.Types

slackMessage :: [SlackText] -> SlackMessage Source #

Concatenate a list of SlackText into a single block, and wrap it up as a full message

Blocks' rich text formatting (receive only!)

data RichStyle Source #

A rich text style. You can't actually send these, for some reason.

Constructors

RichStyle 

Fields

data RichLinkAttrs Source #

Constructors

RichLinkAttrs 

Fields

Rendered messages

data RenderedSlackMessage Source #

RenderedSlackMessage contains the original SlackMessage, the rendered version, and a boolean indicating whether truncation was done.

Usage:

     let
       msg =
       (mkPostMsgReq channel "")
         { postMsgReqBlocks = Just blocks
         , postMsgReqThreadTs = mThreadTs
         }
   chatPostMessage msg
  

Introduction to Slack Interactive Messages

Slack Interactive Messages

First, familiarize yourself with Slack's Interactivity documentation. Currently we only support Block Kit interactive components, i.e. components like buttons attached to messages.

To make an Slack message interactive, you need to include an "Actions" block that has one or more interactive components. These should generally only be created using the builder functions such as actions and button. Consumers of this module should avoid directly importing Web.Slack.Experimental.Blocks.Types.

Creating Slack Interactive Messages

actions :: ToSlackActionList as => as -> SlackMessage Source #

Generates interactive components such as buttons.

actionsWithBlockId :: ToSlackActionList as => SlackBlockId -> as -> SlackMessage Source #

Generates interactive components such as buttons with a SlackBlockId.

newtype SlackActionId Source #

Used to identify an action. The ID used should be unique among all actions in the block.

This is limited to 255 characters, per the Slack documentation at https://api.slack.com/reference/block-kit/block-elements#button

Constructors

SlackActionId 

type SlackBlockId = NonEmptyText 255 Source #

SlackBlockId should be unique for each message and each iteration of a message. If a message is updated, use a new block_id.

setting :: a -> OptionalSetting a Source #

Sets a setting.

emptySetting :: OptionalSetting a Source #

Sets the empty setting.

data SlackStyle Source #

Styles for Slack buttons. If no style is given, the default style (black) is used.

Constructors

SlackStylePrimary

Green button

SlackStyleDanger

Red button

plaintext :: Slack a => a -> SlackTextObject Source #

Create a plain text SlackTextObject where the API allows either markdown or plain text.

plaintextonly :: Slack a => a -> SlackPlainTextOnly Source #

Create a SlackPlainTextOnly. Some API points can can take either markdown or plain text, but some can take only plain text. This enforces the latter.

mrkdwn :: Slack a => a -> SlackTextObject Source #

Create a markdown SlackTextObject where the API allows either markdown or plain text.

buttonSettings :: ButtonSettings Source #

Default button settings.

confirm :: ConfirmSettings -> SlackConfirmObject Source #

Confirm dialog builder.

confirmAreYouSure :: ConfirmSettings Source #

Default settings for a "Are you sure?" confirmation dialog.

Responding to Slack Interactive Messages

data SlackInteractiveResponse Source #

Type of message to send in response to an interactive webhook. See Slack's Handling user interaction in your Slack apps for a description of these fieldds.

Constructors

SlackInteractiveResponse SlackMessage

Respond with a new message.

Ephemeral SlackMessage

Respond with a message that only the interacting user can usee.

ReplaceOriginal SlackMessage

Replace the original message.

DeleteOriginal

Delete the original message.