Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- 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
- data SlackConfig = SlackConfig {}
- mkSlackConfig :: Text -> IO SlackConfig
- apiTest :: Manager -> TestReq -> IO (Response TestRsp)
- authTest :: SlackConfig -> IO (Response TestRsp)
- chatPostMessage :: SlackConfig -> PostMsgReq -> IO (Response PostMsgRsp)
- chatUpdate :: SlackConfig -> UpdateReq -> IO (Response UpdateRsp)
- conversationsList :: SlackConfig -> ListReq -> IO (Response ListRsp)
- conversationsListAll :: SlackConfig -> ListReq -> IO (LoadPage IO Conversation)
- conversationsHistory :: SlackConfig -> HistoryReq -> IO (Response HistoryRsp)
- conversationsHistoryAll :: SlackConfig -> HistoryReq -> IO (LoadPage IO Message)
- conversationsReplies :: SlackConfig -> RepliesReq -> IO (Response HistoryRsp)
- repliesFetchAll :: SlackConfig -> RepliesReq -> IO (LoadPage IO Message)
- getUserDesc :: (UserId -> Text) -> ListRsp -> UserId -> Text
- usersList :: SlackConfig -> IO (Response ListRsp)
- userLookupByEmail :: SlackConfig -> Email -> IO (Response UserRsp)
- usersConversations :: SlackConfig -> UsersConversationsRequest -> IO (Response UsersConversationsResponse)
- usersConversationsAll :: SlackConfig -> UsersConversationsRequest -> IO (LoadPage IO Conversation)
- authenticateReq :: Text -> Request -> Request
- type Response a = Either SlackClientError a
- type LoadPage m a = m (Response [a])
Documentation
data SlackConfig Source #
Instances
HasManager SlackConfig Source # | |
Defined in Web.Slack.Classy getManager :: SlackConfig -> Manager Source # | |
HasToken SlackConfig Source # | |
Defined in Web.Slack.Classy getToken :: SlackConfig -> Text Source # |
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
chatPostMessage :: SlackConfig -> PostMsgReq -> IO (Response PostMsgRsp) Source #
Send a message to a channel.
chatUpdate :: SlackConfig -> UpdateReq -> IO (Response UpdateRsp) Source #
Updates a message.
conversationsList :: SlackConfig -> ListReq -> IO (Response ListRsp) Source #
Retrieve conversations list.
:: SlackConfig | |
-> ListReq | The first request to send. _NOTE_: |
-> 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.
conversationsHistoryAll Source #
:: SlackConfig | |
-> HistoryReq | The first request to send. _NOTE_: |
-> 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.
:: SlackConfig | |
-> RepliesReq | The first request to send. _NOTE_: |
-> 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.
:: (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 |
-> UserId -> Text | A function from |
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.
userLookupByEmail :: SlackConfig -> Email -> IO (Response UserRsp) Source #
This method returns a list of all users in the team. This includes deleted/deactivated users.
usersConversations :: SlackConfig -> UsersConversationsRequest -> IO (Response UsersConversationsResponse) Source #
Client for Slack's users.conversations
endpoint.
https://api.slack.com/methods/users.conversations
usersConversationsAll :: SlackConfig -> UsersConversationsRequest -> IO (LoadPage IO Conversation) Source #
Fetch all user conversations.
Requests and responses
type Response a = Either SlackClientError a Source #