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

Web.Slack

Description

  • Since 0.4.0.0*: The API functions is now more intuitive for newbies than before. If you need compatiblity with the previous version, use Classy instead.
Synopsis

Documentation

data SlackConfig Source #

Instances

Instances details
HasManager SlackConfig Source # 
Instance details

Defined in Web.Slack.Classy

HasToken SlackConfig Source # 
Instance details

Defined in Web.Slack.Classy

mkSlackConfig :: Text -> IO SlackConfig Source #

Prepare a SlackConfig from a slack token. You can then call the other functions providing this in a reader context.

Endpoints

conversationsListAll Source #

Arguments

:: SlackConfig 
-> ListReq

The first request to send. _NOTE_: listReqCursor is silently ignored.

-> IO (LoadPage IO Conversation)

An action which returns a new page of messages every time called. If there are no pages anymore, it returns an empty list.

Returns an action to send a request to get the list of conversations in the workspace.

To fetch all replies in the conversation, run the returned LoadPage action repeatedly until it returns an empty list.

conversationsHistory :: SlackConfig -> HistoryReq -> IO (Response HistoryRsp) Source #

Retrieve ceonversation history. Consider using historyFetchAll in combination with this function.

https://api.slack.com/methods/conversations.history

conversationsHistoryAll Source #

Arguments

:: SlackConfig 
-> HistoryReq

The first request to send. _NOTE_: historyReqCursor is silently ignored.

-> IO (LoadPage IO Message)

An action which returns a new page of messages every time called. If there are no pages anymore, it returns an empty list.

Returns an action to send a request to get the history of a conversation.

To fetch all messages in the conversation, run the returned LoadPage action repeatedly until it returns an empty list.

conversationsReplies :: SlackConfig -> RepliesReq -> IO (Response HistoryRsp) Source #

Retrieve replies of a conversation. Consider using repliesFetchAll if you want to get entire replies of a conversation.

https://api.slack.com/methods/conversations.replies

repliesFetchAll Source #

Arguments

:: SlackConfig 
-> RepliesReq

The first request to send. _NOTE_: repliesReqCursor is silently ignored.

-> IO (LoadPage IO Message)

An action which returns a new page of messages every time called. If there are no pages anymore, it returns an empty list.

Returns an action to send a request to get the replies of a conversation.

To fetch all replies in the conversation, run the returned LoadPage action repeatedly until it returns an empty list.

  • NOTE*: The conversations.replies endpoint always returns the first message of the thread. So every page returned by the LoadPage action includes the first message of the thread. You should drop it if you want to collect messages in a thread without duplicates.

getUserDesc Source #

Arguments

:: (UserId -> Text)

A function to give a default username in case the username is unknown

-> ListRsp

List of users as known by the slack server. See usersList.

-> UserId -> Text

A function from UserId to username.

Returns a function to get a username from a UserId. Comes in handy to use messageToHtml

usersList :: SlackConfig -> IO (Response ListRsp) Source #

This method returns a list of all users in the team. This includes deleted/deactivated users.

https://api.slack.com/methods/users.list

userLookupByEmail :: SlackConfig -> Email -> IO (Response UserRsp) Source #

This method returns a list of all users in the team. This includes deleted/deactivated users.

https://api.slack.com/methods/users.lookupByEmail

Requests and responses

type LoadPage m a = m (Response [a]) Source #

Represents an action which returns a paginated response from Slack. Every time calling the action, it performs a request with a new cursor to get the next page. If there is no more response, the action returns an empty list.