Giter Club home page Giter Club logo

slack-web's Introduction

Haskell bindings for the Slack web API

Example

> import qualified Web.Slack as Slack
> import qualified Web.Slack.Api as Api
> :set -XOverloadedStrings
> slackConfig <- Slack.mkSlackConfig token
> Slack.apiTest (Slack.slackConfigManager slackConfig) Api.mkTestReq
Right ...
> Slack.apiTest (Slack.slackConfigManager slackConfig) Api.mkTestReq { Api.testReqFoo = Just "bar" }
Right ...

Contributing

This repository provides a flake.nix file which offers pre-commit hooks and haskell-language-server. We use fourmolu for formatting, which is verified in CI.

To use the flake, run nix develop, which will get you cabal and everything else you need to work on slack-web.

Pull requests are welcome!

License

Licensed under the MIT license. See LICENSE.md.

slack-web's People

Contributors

9999years avatar aljce avatar avieth avatar chessai avatar ctypeh avatar dustin avatar emmanueltouzery avatar igrep avatar jkeuhlen avatar jpvillaisaza avatar ktang-hg avatar lf- avatar maxhallinan avatar michaelpj avatar robbassi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slack-web's Issues

Support Conversations API and then deprecate some legacy APIs

Ref: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api

channels.*, groups.*, im.*, and mpim.* will be unavailable after February 24th, 2021.

  • The final date for existing apps is now February 24th, 2021.
  • We'll stop allowing newly created Slack apps to use these deprecated APIs beginning June 10th, 2020.
  • All channels., groups., im., & mpim. methods will return deprecation warnings beginning June 10th, 2020.

Add mpim methods

  • mpim.close
  • mpim.history
  • mpim.list
  • mpim.mark
  • mpim.open
  • mpim.replies

Add channels methods

  • channels.archive
  • channels.create
  • channels.history
  • channels.info
  • channels.invite
  • channels.join
  • channels.kick
  • channels.leave
  • channels.list
  • channels.mark
  • channels.rename
  • channels.replies
  • channels.setPurpose
  • channels.setTopic
  • channels.unarchive

Transfer maintainership

There are some comments about this in issues and pull requests, so I'm opening this issue to organize notes about transferring the library in one place. Here's a list of previous comments:

In summary, I'm looking for someone else to take over this library (different maintainer or owner). As mentioned by @lf-, @MercuryTechnologies can do this and has some plans about it (see #94 for more details).

I'm opening this issue to continue the conversation here and complete the process, and also in case anyone else has comments about it (in particular @igrep or @emmanueltouzery, current GitHub collaborators and Hackage maintainers).

Add files methods

  • files.delete
  • files.info
  • files.list
  • files.revokePublicURL
  • files.sharedPublicURL
  • files.upload

slack rate limits

https://api.slack.com/docs/rate-limits#events_api

I've been hit by slack rate limits (and not even doing that many calls.. they've become much more stringent with that recently). When that happens we get back http 429, which slack-web forwards to the caller, and there is a HTTP header: Retry-After: <number of seconds>.

I think that maybe slack-web should optionally handle that for the user. I can maybe try to make a PR, when I get some time, but we'd need to agree as to how to do implement that.

Do we add a new option to all existing calls RateLimitHandling = RateLimitFail | RateLimitWaitAndResend? Do we do it automatically out of the box, without any way to disable it (in which case there is no API change)? Or do we consider slack-web is the wrong layer in the stack to deal with that, and we change nothing compared to the current situation?

Add im methods

  • im.close
  • im.history
  • im.list
  • im.mark
  • im.open
  • im.replies

slack-web-0.2.0.7: MessageParser.hs: error: Variable not in scope: anyChar

In Stackage Nightly:

Building library for slack-web-0.2.0.7..
[ 1 of 12] Compiling Web.Slack.Types  ( src/Web/Slack/Types.hs, dist/build/Web/Slack/Types.o )

src/Web/Slack/Types.hs:28:1: warning: [-Wunused-imports]
    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()
   |
28 | import Data.Monoid
   | ^^^^^^^^^^^^^^^^^^
[ 2 of 12] Compiling Web.Slack.MessageParser ( src/Web/Slack/MessageParser.hs, dist/build/Web/Slack/MessageParser.o )

src/Web/Slack/MessageParser.hs:141:29: error:
    Variable not in scope:
      anyChar :: ParsecT MegaparsecError Text Identity Char
    |
141 |   (string "```" >> manyTill anyChar (string "```"))
    |                             ^^^^^^^

Add dnd methods

  • dnd.endDnd
  • dnd.endSnooze
  • dnd.info
  • dnd.setSnooze
  • dnd.teamInfo

Lookup user by email

It looks like slack has a way to lookup users by email to return the rest of the user object, but it isn't exposed in this library right now.

The current user object also appears to be missing a fair number of fields:
image

Would you be open to a PR to add support for that user method and extra user fields?

Add groups methods

  • groups.archive
  • groups.close
  • groups.create
  • groups.createChild
  • groups.history
  • groups.info
  • groups.invite
  • groups.kick
  • groups.leave
  • groups.list
  • groups.mark
  • groups.open
  • groups.rename
  • groups.replies
  • groups.setPurpose
  • groups.setTopic
  • groups.unarchive

Upload latest version on Hackage

The current version from Hackage does not include the latest fix that puts the token in the header. Therefore, all requests fail with "invalid_auth".

Thanks.

Add users methods

  • users.deletePhoto
  • users.getPresence
  • users.identity
  • users.info
  • users.list
  • users.setActive
  • users.setPhoto
  • users.setPresence

[RFC] Don't force "ReaderT Pattern"

Problem

Current API functions in slack-web are typed as following for example:

authTest :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => m (Response TestRsp) 

IMO this is confusing for people unfamiliar with the "ReaderT Pattern" (e.g. Newbies who just want to try Slack Web API in Haskell). Helping the users adopt the "ReaderT Pattern" is NOT slack-web's responsibility because it isn't directly related to the "ReaderT Pattern". In addition, the simplified versions (for example below) and the original versions are easily converted mutually:

authTest ::  SlackConfig -> IO (Response TestRsp)
-- Or
authTest :: Manager -> SlackConfigToken -> IO (Response TestRsp)
type SlackConfigToken = Text

Suggested Changes

  • Change the type of the API functions into SlackConfig -> IO (Response a)
  • Leave the current version as a separate module Web.Slack.ReaderT for convenience and compatibility.

Fix CI

CI is out of date. See #93 (comment) for a recommendation to use haskell-ci or switch to GitHub Actions.

Add team methods

  • team.accessLogs
  • team.billableInfo
  • team.info
  • team.integrationLogs

Add usergroups methods

  • usergroups.create
  • usergroups.disable
  • usergroups.enable
  • usergroups.list
  • usergroups.update

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.