Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data SlackText
- (<+>) :: SlackText -> SlackText -> SlackText
- parens :: SlackText -> SlackText
- brackets :: SlackText -> SlackText
- angleBrackets :: SlackText -> SlackText
- ticks :: SlackText -> SlackText
- codeBlock :: SlackText -> SlackText
- bold :: SlackText -> SlackText
- italic :: SlackText -> SlackText
- newline :: SlackText -> SlackText
- unorderedList :: [SlackText] -> SlackText
- link :: Text -> Maybe Text -> SlackText
- monospaced :: Slack a => a -> SlackText
- mentionUser :: UserId -> SlackText
- isSubStringOf :: Text -> SlackText -> Bool
- data SlackImage = SlackImage {
- slackImageTitle :: !(Maybe Text)
- slackImageAltText :: !Text
- slackImageUrl :: !Text
- data SlackMessage
- class Markdown a where
- class Image a where
- image :: SlackImage -> a
- context :: SlackContext -> SlackMessage
- textToMessage :: Text -> SlackMessage
- prefixFirstSlackMessage :: Text -> [SlackMessage] -> [SlackMessage]
- mentionUserGroupById :: SlackText -> SlackText
- textToContext :: Text -> SlackMessage
- slackMessage :: [SlackText] -> SlackMessage
- data SlackBlock
- data RichItem
- data RichStyle = RichStyle {}
- data RichLinkAttrs = RichLinkAttrs {}
- data RichTextSectionItem
- data RichText = RichText {}
- data RenderedSlackMessage = RenderedSlackMessage {}
- render :: SlackMessage -> RenderedSlackMessage
- actions :: ToSlackActionList as => as -> SlackMessage
- actionsWithBlockId :: ToSlackActionList as => SlackBlockId -> as -> SlackMessage
- newtype SlackActionId = SlackActionId {
- unSlackActionId :: NonEmptyText 255
- type SlackBlockId = NonEmptyText 255
- setting :: a -> OptionalSetting a
- emptySetting :: OptionalSetting a
- data SlackStyle
- plaintext :: Slack a => a -> SlackTextObject
- plaintextonly :: Slack a => a -> SlackPlainTextOnly
- mrkdwn :: Slack a => a -> SlackTextObject
- button :: SlackActionId -> SlackButtonText -> ButtonSettings -> SlackAction
- buttonSettings :: ButtonSettings
- data ButtonSettings
- confirm :: ConfirmSettings -> SlackConfirmObject
- confirmAreYouSure :: ConfirmSettings
- data ConfirmSettings
- data SlackInteractiveResponse
General Slack Messages
angleBrackets :: SlackText -> SlackText Source #
unorderedList :: [SlackText] -> SlackText Source #
Render an unordered (bulleted) list
monospaced :: Slack a => a -> SlackText Source #
Render a Slack
renderable value with ticks around it. Alias for ticks . message
mentionUser :: UserId -> SlackText Source #
data SlackImage Source #
SlackImage | |
|
Instances
Show SlackImage Source # | |
Defined in Web.Slack.Experimental.Blocks.Types showsPrec :: Int -> SlackImage -> ShowS # show :: SlackImage -> String # showList :: [SlackImage] -> ShowS # | |
Eq SlackImage Source # | |
Defined in Web.Slack.Experimental.Blocks.Types (==) :: SlackImage -> SlackImage -> Bool # (/=) :: SlackImage -> SlackImage -> Bool # |
data SlackMessage Source #
Instances
class Markdown a where Source #
Instances
Markdown SlackContext Source # | |
Defined in Web.Slack.Experimental.Blocks.Types markdown :: SlackText -> SlackContext Source # | |
Markdown SlackMessage Source # | |
Defined in Web.Slack.Experimental.Blocks.Types markdown :: SlackText -> SlackMessage Source # |
image :: SlackImage -> a Source #
Instances
Image SlackContext Source # | |
Defined in Web.Slack.Experimental.Blocks.Types image :: SlackImage -> SlackContext Source # | |
Image SlackMessage Source # | |
Defined in Web.Slack.Experimental.Blocks.Types image :: SlackImage -> SlackMessage Source # |
context :: SlackContext -> SlackMessage Source #
textToMessage :: Text -> SlackMessage Source #
prefixFirstSlackMessage :: Text -> [SlackMessage] -> [SlackMessage] Source #
textToContext :: Text -> SlackMessage Source #
slackMessage :: [SlackText] -> SlackMessage Source #
Concatenate a list of SlackText
into a single block, and wrap it up as a full message
data SlackBlock Source #
Instances
FromJSON SlackBlock Source # | |
Defined in Web.Slack.Experimental.Blocks.Types parseJSON :: Value -> Parser SlackBlock # parseJSONList :: Value -> Parser [SlackBlock] # | |
ToJSON SlackBlock Source # | |
Defined in Web.Slack.Experimental.Blocks.Types toJSON :: SlackBlock -> Value # toEncoding :: SlackBlock -> Encoding # toJSONList :: [SlackBlock] -> Value # toEncodingList :: [SlackBlock] -> Encoding # | |
Show SlackBlock Source # | |
Defined in Web.Slack.Experimental.Blocks.Types showsPrec :: Int -> SlackBlock -> ShowS # show :: SlackBlock -> String # showList :: [SlackBlock] -> ShowS # | |
Eq SlackBlock Source # | |
Defined in Web.Slack.Experimental.Blocks.Types (==) :: SlackBlock -> SlackBlock -> Bool # (/=) :: SlackBlock -> SlackBlock -> Bool # |
Blocks' rich text formatting (receive only!)
Seemingly only documented at https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less
They warn of undocumented element types. Joy.
RichItemText Text RichStyle | |
RichItemChannel ConversationId | |
RichItemUser UserId RichStyle | |
RichItemLink RichLinkAttrs | |
RichItemEmoji Text | |
RichItemOther Text Value |
A rich text style. You can't actually send these, for some reason.
data RichLinkAttrs Source #
Instances
Show RichLinkAttrs Source # | |
Defined in Web.Slack.Experimental.Blocks.Types showsPrec :: Int -> RichLinkAttrs -> ShowS # show :: RichLinkAttrs -> String # showList :: [RichLinkAttrs] -> ShowS # | |
Eq RichLinkAttrs Source # | |
Defined in Web.Slack.Experimental.Blocks.Types (==) :: RichLinkAttrs -> RichLinkAttrs -> Bool # (/=) :: RichLinkAttrs -> RichLinkAttrs -> Bool # |
data RichTextSectionItem Source #
Instances
FromJSON RichTextSectionItem Source # | |
Defined in Web.Slack.Experimental.Blocks.Types parseJSON :: Value -> Parser RichTextSectionItem # parseJSONList :: Value -> Parser [RichTextSectionItem] # | |
Show RichTextSectionItem Source # | |
Defined in Web.Slack.Experimental.Blocks.Types showsPrec :: Int -> RichTextSectionItem -> ShowS # show :: RichTextSectionItem -> String # showList :: [RichTextSectionItem] -> ShowS # | |
Eq RichTextSectionItem Source # | |
Defined in Web.Slack.Experimental.Blocks.Types (==) :: RichTextSectionItem -> RichTextSectionItem -> Bool # (/=) :: RichTextSectionItem -> RichTextSectionItem -> Bool # |
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
Instances
FromJSON SlackActionId Source # | |
Defined in Web.Slack.Experimental.Blocks.Types parseJSON :: Value -> Parser SlackActionId # parseJSONList :: Value -> Parser [SlackActionId] # | |
ToJSON SlackActionId Source # | |
Defined in Web.Slack.Experimental.Blocks.Types toJSON :: SlackActionId -> Value # toEncoding :: SlackActionId -> Encoding # toJSONList :: [SlackActionId] -> Value # toEncodingList :: [SlackActionId] -> Encoding # | |
Show SlackActionId Source # | |
Defined in Web.Slack.Experimental.Blocks.Types showsPrec :: Int -> SlackActionId -> ShowS # show :: SlackActionId -> String # showList :: [SlackActionId] -> ShowS # | |
Eq SlackActionId Source # | |
Defined in Web.Slack.Experimental.Blocks.Types (==) :: SlackActionId -> SlackActionId -> Bool # (/=) :: SlackActionId -> SlackActionId -> Bool # |
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.
SlackStylePrimary | Green button |
SlackStyleDanger | Red button |
Instances
FromJSON SlackStyle Source # | |
Defined in Web.Slack.Experimental.Blocks.Types parseJSON :: Value -> Parser SlackStyle # parseJSONList :: Value -> Parser [SlackStyle] # | |
ToJSON SlackStyle Source # | |
Defined in Web.Slack.Experimental.Blocks.Types toJSON :: SlackStyle -> Value # toEncoding :: SlackStyle -> Encoding # toJSONList :: [SlackStyle] -> Value # toEncodingList :: [SlackStyle] -> Encoding # | |
Show SlackStyle Source # | |
Defined in Web.Slack.Experimental.Blocks.Types showsPrec :: Int -> SlackStyle -> ShowS # show :: SlackStyle -> String # showList :: [SlackStyle] -> ShowS # | |
Eq SlackStyle Source # | |
Defined in Web.Slack.Experimental.Blocks.Types (==) :: SlackStyle -> SlackStyle -> Bool # (/=) :: SlackStyle -> SlackStyle -> Bool # |
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.
button :: SlackActionId -> SlackButtonText -> ButtonSettings -> SlackAction Source #
Button builder.
buttonSettings :: ButtonSettings Source #
Default button settings.
data ButtonSettings Source #
Settings for button elements.
confirm :: ConfirmSettings -> SlackConfirmObject Source #
Confirm dialog builder.
confirmAreYouSure :: ConfirmSettings Source #
Default settings for a "Are you sure?" confirmation dialog.
data ConfirmSettings Source #
Settings for confirmation dialog objects.
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.
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. |
Instances
ToJSON SlackInteractiveResponse Source # | |
Defined in Web.Slack.Experimental.Blocks.Types | |
Show SlackInteractiveResponse Source # | |
Defined in Web.Slack.Experimental.Blocks.Types showsPrec :: Int -> SlackInteractiveResponse -> ShowS # show :: SlackInteractiveResponse -> String # showList :: [SlackInteractiveResponse] -> ShowS # |