Giter Site home page Giter Site logo

slack-api's Introduction

Deprecating this project

Slack has announce they are ending support for the RTM API and are instead focusing on Web and Events API.

Travis Build Status

Bindings to the Slack RTM API.

These bindings were developed whilst I was interning at Borders.

More information can be found here

Example

module EchoBot where

import System.Environment (lookupEnv)
import Web.Slack

main :: IO ()
main = do
    Just token <- lookupEnv "SLACK_API_TOKEN"
    let config = SlackConfig { _slackApiToken = token }
    withSlackHandle config echoBot

echoBot :: SlackHandle -> IO ()
echoBot h = forever $ do
    event <- getNextEvent h
    case event of
        (Message cid _ msg _ _ _) -> sendMessage h cid msg
        _ -> return ()

slack-api's People

Contributors

angerman avatar asayers avatar fmap avatar gabriella439 avatar isomarcte avatar jaspervdj avatar jdreaver avatar jship avatar jsteiner avatar madjar avatar matthewfranglen avatar mbbx6spp avatar mitchellwrosen avatar mpickering avatar mwotton avatar ollef avatar peddie avatar rickeyski 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  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

Watchers

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

slack-api's Issues

Add upper bound to `errors` dependency

errors-2.0 will switch to use ExceptT instead of EitherT. If that will break your package then add an upper bound of errors < 2.0 to your dependencies.

new Exception parsing Preferences

*** Exception: user error (When parsing the record Preferences of type Web.Slack.Types.Preferences.Preferences the key collapsible was not present.)

Did the Slack API change in the last day or two?

It looks like the prefs I'm getting from the API has many of the same keys but some missing as well as some new ones.

"bot_id" optional for bot_message

I'll keep reporting back, what I find :)

{
   "username" : "bot",
   "channel" : "...",
   "text" : "Api Test",
   "type" : "message",
   "ts" : "1423323874.000037",
   "subtype" : "bot_message"
}

key "bot_id" not present
Please report this failure to the github issue tracker

Slacks stringly typed JSON

As noted in other tickets, the slack API seems to send malformed (or mixed typed?) JSON. I've another hack lying around that hooks into the eitherDecode function and does some type coercion on the JSON tree prior to actually parsing it.

Similarly to the other issue (#62) I just opened, I'd polish that a little and send a PR, if there's interest. This also allows to fix issues like #6, in the absence of administrator privileges (e.g. when the fix @tonyd256 provided, is not possible).

Unrecognised type: pin_removed (pin_added)

{"type":"pin_removed","user":"<elided>","channel_id":"<elided>","item":{"type":"message","channel":"<elided>","message":{"type":"message","user":"<elided>","text":"can we make Cheyne sing opera all the time?","ts":"1439001973.000817","permalink":"<elided>","reactions":[{"name":"+1","users":[<elided strings>],"count":6},{"name":"retrocoin","users":[<elided strings>],"count":5}]}},"has_pins":false,"event_ts":"1439241580.749454"}
Unrecognised type: pin_removed
Please report this failure to the github issue tracker

From the API docs for this mystery event:

The pin_removed event is sent to all members of a channel when an item is pinned in that channel.

The format of this event type is still unstable and we expect to make changes to it in the future. Until the pinning APIs are released clients should ignore this event.

The same goes for pin_added.

I can think of two approaches: either include these events anyway and try to keep the format up to date or ignore them in parsing so that they're not exposed to users but they don't cause error messages to get printed.

key "url_download" not present

The JSON object for a file download is huge and contains tons of internal information, so I'll skip pasting it out of laziness.

url_download and url_private_download are treated as mandatory in File.hs. This matches what the API docs say. I seem to be getting FileShared and FilePublic events that don't contain either of these fields (and have never received a File-anything event that has either).

"image_default" key not present

When trying to connect using the Echobot example I get the following message:

user error (key "image_default" not present)

I'm not sure if this is something I've done wrong, or a change in the API, or something specific to my Slack team.

latest published version (0.9) doesn't work. Is it possible to make a new release ?

with 0.9 as published on hackage,

I get a show_member_presence key missing error in Web.Slack.Types.Preferences.Preferences

user error (Error in $.self.prefs: failed to parse field self: failed to parse field prefs: When parsing the record Preferences of type Web.Slack.Types.Preferences.Preferences the key show_member_presence was not present.)?

`dnd_updated_user`: Failed to parse to a known event

Object (fromList [("dnd_status",Object (fromList [("next_dnd_end_ts",Number 1.0),("dnd_enabled",Bool False),("next_dnd_start_ts",Number 1.0)])),("user",String "UREDACTED"),("event_ts",String "1526333245.000516"),("type",String "dnd_updated_user")])
Failed to parse to a known event
Please report this failure to the github issue tracker

Slack hands out bad json: "user error (when expecting a Int, encountered String instead)"

I tried to track down a strange issue when starting a bot, and found that the team prefs look like the following:

{
  "default_channels": [
    "..."
  ],
  "disable_builtin_loading": true,
  "emoji_only_admins": true,
  "loading_only_admins": true,
  "retention_type": "1",
  "retention_duration": 0,
  "group_retention_type": "1",
  "group_retention_duration": 0,
  "dm_retention_type": "1",
  "dm_retention_duration": 0,
  "msg_edit_window_mins": -1,
  "allow_message_deletion": true,
  "hide_referers": true,
  "display_real_names": false,
  "who_can_at_everyone": "regular",
  "who_can_at_channel": "ra",
  "warn_before_at_channel": "always",
  "who_can_create_channels": "regular",
  "who_can_archive_channels": "regular",
  "who_can_create_groups": "ra",
  "who_can_post_general": "ra",
  "who_can_kick_channels": "admin",
  "who_can_kick_groups": "regular",
  "require_at_for_mention": 0,
  "compliance_export_start": 0
}

See the "1" fields. Which obviously clash with the Int :(

key "message" not present

I have a bot that's just sitting idle in a channel and printing all Events to stdout for me to look at. Saw this one time.

{"type":"reaction_added","user":"U02JZ29PL","item":{"type":"message","channel":"C02JBL1SN","ts":"1445714383.000132"},"reaction":"skull","event_ts":"1445715911.712116"}
key "message" not present
Please report this failure to the github issue tracker

fuzzy_matching was not present

slack-api was working great a week ago now I'm receiving this

*** Exception: user error (When parsing the record Preferences of type 
Web.Slack.Types.Preferences.Preferences the key fuzzy_matching was not present.)

I tried making _prefFuzzyMatching a Maybe

Now I receive

*** Exception: user error (when expecting a Int, encountered Boolean instead)

Have no idea which field is giving this.

Any thoughts on making the lib more resilient to upstream changes from slack?

key "ok" not present

At some point, withSlackHandle started throwing the following error for some workspaces:

    "{}"
    Error in $: key "ok" not present
    Please report this failure to the github issue tracker

Eventually, I found this issue and in particular jigale's comment:

We ran into this issue as well where the trailing query parameter (?dp=1) was being stripped by websocketizeURLPort(). The PR fixed things for us.

Sure enough, checking the URI received for the problematic workspace, I saw ?dp=1 there.

Error when bot is kicked from a channel

I was testing this library using the echo bot. It all worked fine. When I kicked the bot from the channel this appeared in the logs:

{"type":"channel_left","channel":"C09EKGGEA"}
Error in $.channel: failed to parse field channel: expected Channel, encountered String
Please report this failure to the github issue tracker
MessagePayload {messageId = 3, messageType = "message", messageChannel = Id {_getId = "D135ZCWDC"}, messageText = "You have been removed from #general by <@U09EK8480|matthew>"}

Is there a way to create a ChannelId from String?

Is there a way to create any Id type with a String or other string-like type? I have a bunch of channel id strings stored in a database and I would like to use them to create ChannelId types so I can call sendMessage with them.

And another string :( When expecting a time.

Just invited a bot into a channel.

{"type":"channel_created","channel":{"id":"...","is_channel":true,"name":"...","created":"1423208534","creator":"..."},"event_ts":"1423208533.825935"}

when expecting a Time, encountered String instead
Please report this failure to the github issue tracker

looks like slackapi is a little buggy?

Unrecognised type: status change

{"type":"status_change","user":"<elided>","status":"minor in-law preparations","event_ts":"1438982480.172418"}
Unrecognised type: status_change
Please report this failure to the github issue tracker

I'm not sure I can add any additional useful background -- just a new constructor for Event, I suppose.

Failed to parse to a known event - Direct Message

MessagePayload {  
  messageId = 0,
  messageType = "message",
  messageChannel = Id  {  
    _getId = "DXXX"
  },
  messageText = "someText"
}

Object (
fromList [ ("is_shared",Bool False)
               , ("channel", String "DXXX")
               , ("launchUri", String "slack://channel?id=DXXX&message=msgId&team=teamId")
               , ("imageUri", Null)
               , ("msg", String "timeStamp")
               , ("content", String "one two")
               , ("subtitle", String "userName")
               , ("event_ts", String "timeStamp")
               , ("title", String "TestGroup")
               , ("type", String "desktop_notification")
               , ("ssbFilename", String "knock_brush.mp3")
               , ("avatarImage", String "imageUrl")
              ])

Failed to parse to a known event
Please report this failure to the github issue tracker

So apparently it cannot handle Direct Message events?
Atleast it keeps reporting this in the output, has no problem sending messages to Direct Message channels.

Drop OpenSSL?

I have locally replaced the OpenSSL dependency with tls + wuss. If that would be of interest, I'd polish up a pull request.

Link formatting

Slack supports embedded links in the format: <URL|link name>

When appending such a link to the response of echoBot it is rendered as plain text.

Build error with stack on Ubuntu

While trying to build the slack-lambdabot package that depends on slack-api, I encountered an issue when trying to build with the latest version (0.12). The slack-lambdabot package depends on the 0.6 version, but that version unfortunately causes a hard runtime error because of a missing JSON field. Looking up this error on Google, I read about how Slack apparently changes its API in breaking ways, requiring a newer version of the slack-api package, which is why I tried it with 0.12 in the first place.

Here is the specific error I get:

--  While building package slack-api-0.12 using:
      /home/mhenrion/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.22.4.0_ghc-7.10.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.4.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/mhenrion/slack-lambdabot/.stack-work/logs/slack-api-0.12.log

    Configuring slack-api-0.12...
    Building slack-api-0.12...
    Preprocessing library slack-api-0.12...
    [ 1 of 29] Compiling Web.Slack.Utils  ( src/Web/Slack/Utils.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Utils.o )
    [ 2 of 29] Compiling Web.Slack.Types.Topic ( src/Web/Slack/Types/Topic.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Topic.o )
    [ 3 of 29] Compiling Web.Slack.Types.Time ( src/Web/Slack/Types/Time.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Time.o )
    [ 4 of 29] Compiling Web.Slack.Types.Presence ( src/Web/Slack/Types/Presence.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Presence.o )
    [ 5 of 29] Compiling Web.Slack.Types.Preferences ( src/Web/Slack/Types/Preferences.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Preferences.o )
    [ 6 of 29] Compiling Web.Slack.Types.Id ( src/Web/Slack/Types/Id.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Id.o )
    [ 7 of 29] Compiling Web.Slack.Types.Self ( src/Web/Slack/Types/Self.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Self.o )
    [ 8 of 29] Compiling Web.Slack.Types.TeamPreferences ( src/Web/Slack/Types/TeamPreferences.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/TeamPreferences.o )
    [ 9 of 29] Compiling Web.Slack.Types.Error ( src/Web/Slack/Types/Error.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Error.o )
    [10 of 29] Compiling Web.Slack.Types.Comment ( src/Web/Slack/Types/Comment.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Comment.o )
    [11 of 29] Compiling Web.Slack.Types.ChannelOpt[boot] ( src/Web/Slack/Types/ChannelOpt.hs-boot, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/ChannelOpt.o-boot )
    [12 of 29] Compiling Web.Slack.Types.IM ( src/Web/Slack/Types/IM.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/IM.o )
    [13 of 29] Compiling Web.Slack.Types.Channel ( src/Web/Slack/Types/Channel.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Channel.o )
    [14 of 29] Compiling Web.Slack.Types.Base ( src/Web/Slack/Types/Base.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Base.o )
    [15 of 29] Compiling Web.Slack.Types.Bot ( src/Web/Slack/Types/Bot.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Bot.o )
    [16 of 29] Compiling Web.Slack.Types.File ( src/Web/Slack/Types/File.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/File.o )
    [17 of 29] Compiling Web.Slack.Types.Item ( src/Web/Slack/Types/Item.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Item.o )
    [18 of 29] Compiling Web.Slack.Types.Event.Subtype ( src/Web/Slack/Types/Event/Subtype.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Event/Subtype.o )
    [19 of 29] Compiling Web.Slack.Types.Message ( src/Web/Slack/Types/Message.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Web/Slack/Types/Message.o )

    /tmp/stack98644/slack-api-0.12/src/Web/Slack/Types/Message.hs:110:5:
        ‘toEncoding’ is not a (visible) method of class ‘ToJSON’

    /tmp/stack98644/slack-api-0.12/src/Web/Slack/Types/Message.hs:110:20:
        Not in scope: ‘toEncoding’
        Perhaps you meant ‘sumEncoding’ (imported from Data.Aeson.TH)

Needless to say, any help would be greatly appreciated!

download_url apparently optional.

Please report this failure to the github issue tracker

{
   "type" : "file_public",
   "event_ts" : "1423247183.279957",
   "file" : {
      "thumb_360_w" : 360,
      "thumb_160" : "...",
      "editable" : false,
      "size" : 268753,
      "thumb_720_w" : 720,
      "thumb_1024" : "...",
      "mimetype" : "image/png",
      "url" : "...",
      "public_url_shared" : false,
      "channels" : [
         "..."
      ],
      "permalink" : "...",
      "is_external" : true,
      "pretty_type" : "PNG",
      "thumb_360" : "...",
      "comments_count" : 0,
      "mode" : "external",
      "thumb_720" : "...",
      "external_type" : "dropbox",
      "thumb_720_h" : 679,
      "thumb_360_h" : 340,
      "timestamp" : 1423247178,
      "thumb_1024_w" : 1024,
      "user" : "...",
      "thumb_64" : "...",
      "thumb_80" : "...",
      "ims" : [],
      "thumb_1024_h" : 966,
      "created" : 1423247178,
      "filetype" : "png",
      "name" : "...",
      "groups" : [],
      "title" : "...",
      "id" : "...",
      "url_private" : "...",
      "is_public" : true,
      "image_exif_rotation" : 1
   }
}

key "url_download" not present

Hackage version not up to date

On hackage there is still the requirement errors (>=1.4 && <2.0), which is clearly not what is in the cabal file in the repo. Any idea how to fix that ?
I'm pretty new to the haskell ecosystem so I'm not sure this is the right place to report the issue.

FileShared and FilePublic contain reference to shared file

When the bot sees a file that has been uploaded he produces errors related to two messages. The messages are file_shared and file_public, and they now only reference the file by id.

MessagePayload {messageId = 3, messageType = "message", messageChannel = Id {_getId = "C1E4KJ8M9"}, messageText = "<@U09EK8480|matthew> uploaded a file: <https://maul-t
ech.slack.com/files/matthew/F1E6AS0V8/dogs.jpeg|dogs.jpeg>"}
{"type":"file_shared","file_id":"F1E6AS0V8","user_id":"U09EK8480","file":{"id":"F1E6AS0V8"},"event_ts":"1465045015.197577"}
Error in $.file: failed to parse field file: key "timestamp" not present
Please report this failure to the github issue tracker
{"type":"file_public","file_id":"F1E6AS0V8","user_id":"U09EK8480","file":{"id":"F1E6AS0V8"},"event_ts":"1465045015.197578"}
Error in $.file: failed to parse field file: key "timestamp" not present
Please report this failure to the github issue tracker

key speak_growls was not present

Not sure if this is a configuration issue on my end, but I just tried installing this today and can't seem to get past this issue.

*** Exception: user error (When parsing the record Preferences of type Web.Slack.Types.Preferences.Preferences the key speak_growls was not present.)

I am just trying to run the echoBot demo, but once I plug in my api-token, I get this issue as soon as it tries to parse a packet.

Parse error

Hi, great library! It's been working for me fine locally, but now when I deploy I am seeing a parse error:

user error (Error in $.users[0].status: failed to parse field users: failed to parse field status: expected Text, encountered Null)

I may be able to dig in to the JSON messages if that would be helpful.

New event type

Object (fromList [("type",String "team_migration_started")])
Failed to parse to a known event

This one actually is documented; I guess they added it recently.

TeamPreferences not parsing correctly.

slack-api is having trouble parsing the json return from the rtm.start api command. This is the error I'm getting: user error (when expecting a Int, encountered String instead) and it is being thrown here: https://github.com/mpickering/slack-api/blob/master/src/Web/Slack.hs#L84

I've dug through the models and the JSON to try and find what is causing that. I found _teamRetentionType in TeamPreferences to expect an Int but the JSON has "0".

I've submitted a help desk ticket to Slack to see if they can fix this on their end. Will report back here with my findings. I imagine this is a new bug since I didn't see an issue about it already.

Failed to parse a known event. reconnect_url.

I compiled the EchoBot from the example directory, and I got this message:

Object (fromList [("url",String "wss://ms631.slack-msgs.com/websocket/blablabla"),("type",String "reconnect_url")])
Failed to parse to a known event\n
Please report this failure to the github issue tracker

(websocket URL obviously shortened)
This is slack-api-0.6 from hackage.

Groups and channels should perhaps not be separate

Any private channel is actually a group, and there doesn't seem to be a way to send a message to a group.

If you use this

dirtyConvert :: GroupId -> ChannelId
dirtyConvert (Id x) = Id x

and pretend it's a channel it works, but it's a bit awful.

Unrecognised subtype: pinned_item

{"type":"message","subtype":"pinned_item","user":"<elided>","item_type":"C","attachments":[{"color":"D0D0D0","fallback":"[August 10th, 2015 1:41 PM] lambdabot: odd","author_subname":"lambdabot","ts":1439178066,"text":"odd","author_name":"Lambda Robots 100% Loyal","author_link":"<elided>","author_icon":"<elided>","mrkdwn_in":["text"]}],"text":"<elided> pinned a message to this channel.","channel":"<elided>","ts":"1439254477.000064"}
Unrecognised subtype: pinned_item
Please report this failure to the github issue tracker

The good times continue.

Release is not following master branch

Hello, I tried to use this library and follow examples provided in the master branch. The problem is that release is not following master branch, thus when I tried to build my project build failed, because it has no new abstractions that used in examples.

key `tab_ui_return_selects` missing

Seeing this error:

user error (When parsing the record Preferences of type Web.Slack.Types.Preferences.Preferences the key tab_ui_return_selects was not present.)

I suppose API upstream has changed, then?

Unrecognised type: reaction_added

{"type":"reaction_added","user":"<elided>","item":{"type":"message","channel":"<elided>","ts":"1438985103.000029"},"reaction":"no_good","event_ts":"1438985641.230240"}
Unrecognised type: reaction_added
Please report this failure to the github issue tracker

Another new constructor for Event?

`file_comment_edited`: key "timestamp" not present

"{\"type\":\"file_comment_edited\",\"comment\":{\"id\":\"FREDACTEDR\",\"created\":1526332839,\"timestamp\":1526332839,\"user\":\"UREDACTED\",\"is_intro\":true,\"comment\":\"REDACTED\"},\"file_id\":\"FREDACTED\",\"user_id\":\"UREDACTED\",\"file\":{\"id\":\"FREDACTED\"},\"event_ts\":\"1526332875.000518\"}"
Error in $.file: key "timestamp" not present
Please report this failure to the github issue tracker

Pretty printed JSON:

{
  "comment": {
    "comment": "REDACTED",
    "created": 1526332839,
    "id": "FREDACTEDR",
    "is_intro": true,
    "timestamp": 1526332839,
    "user": "UREDACTED"
  },
  "event_ts": "1526332875.000518",
  "file": {
    "id": "FREDACTED"
  },
  "file_id": "FREDACTED",
  "type": "file_comment_edited",
  "user_id": "UREDACTED"
}

key "is_general" not present

{"type":"channel_created","channel":{"id":"<elided>","is_channel":true,"name":"parents","created":1439250835,"creator":"<elided>"},"event_ts":"1439250835.968977"}
key "is_general" not present
Please report this failure to the github issue tracker

@mpickering, if it's alright with you, I'm going to keep opening issues for these even when the fix is straightforward, just to keep track of all these API mysteries explicitly.

`file_change`: key "timestamp" not present

Example 1:

"{\"type\":\"file_change\",\"file_id\":\"FREDACTED\",\"user_id\":\"UREDACTED\",\"file\":{\"id\":\"FREDACTED\"},\"event_ts\":\"1526333100.000242\"}"
Error in $.file: key "timestamp" not present
Please report this failure to the github issue tracker

Pretty printed JSON:

{
  "event_ts": "1526333100.000242",
  "file": {
    "id": "FREDACTED"
  },
  "file_id": "FREDACTED",
  "type": "file_change",
  "user_id": "UREDACTED"
}

Example 2:

"{\"type\":\"file_change\",\"file_id\":\"FREDACTED\",\"user_id\":\"UREDACTED\",\"file\":{\"id\":\"FREDACTED\"},\"event_ts\":\"1526333110.000564\",\"ts\":\"1526333110.000564\"}"
Error in $.file: key "timestamp" not present
Please report this failure to the github issue tracker

Pretty printed JSON:

{
  "event_ts": "1526333110.000564",
  "file": {
    "id": "FREDACTED"
  },
  "file_id": "FREDACTED",
  "ts": "1526333110.000564",
  "type": "file_change",
  "user_id": "UREDACTED"
}

key "collapsible" was not present

So this might be similar to the [key "message" was not present] issue from a while back, but my slackbot suddenly stopped working and gave the following error
"user error (When parsing the record Preferences of type Web.Slack.Types.Preferences.Preferences the key collapsible was not present.)"

This is through Yesod, so the error message may look different than a standalone slackbot, but it seems that the collapsible argument has been made optional on Slack's side?

Maintain API token as part of state

I'm trying to write some code that interacts with the REST API, which needs to pass the API token into every request URL. Could the code be modified to keep the API token as part of the state, instead of losing it in runBot?

Bot is not updating session

Currently it is possible to get information about teams/users/channels using session. But the problem is that it is not updating when something happens.

For example, consider a bot which logic is based on group members. In this case there could be some problems, when someone joined a channel or left it.

Possible solution is to implement some basic bot, that can update own session when something relative happens. And add some way of extension of that bot to let users write custom event handlers.

Unrecognised subtype: message_replied

"{\"type\":\"message\",\"message\":{\"type\":\"message\",\"user\":\"UREDACTED\",\"text\":\"<@UREDACTED>: REDACTED\",\"thread_ts\":\"1526333638.000192\",\"reply_count\":3,\"replies\":[{\"user\":\"UREDACTED\",\"ts\":\"1526333810.000040\"},{\"user\":\"UREDACTED\",\"ts\":\"1526333869.000455\"},{\"user\":\"UREDACTED\",\"ts\":\"1526333898.000283\"}],\"unread_count\":3,\"ts\":\"1526333638.000192\"},\"subtype\":\"message_replied\",\"hidden\":true,\"channel\":\"CREDACTED\",\"event_ts\":\"1526333898.000318\",\"ts\":\"1526333898.000318\"}"
Error in $: Unrecognised subtype: message_replied
Please report this failure to the github issue tracker

Pretty printed JSON:

{
  "channel": "CREDACTED",
  "event_ts": "1526333898.000318",
  "hidden": true,
  "message": {
    "replies": [
      {
        "ts": "1526333810.000040",
        "user": "UREDACTED"
      },
      {
        "ts": "1526333869.000455",
        "user": "UREDACTED"
      },
      {
        "ts": "1526333898.000283",
        "user": "UREDACTED"
      }
    ],
    "reply_count": 3,
    "text": "<@UREDACTED>: REDACTED",
    "thread_ts": "1526333638.000192",
    "ts": "1526333638.000192",
    "type": "message",
    "unread_count": 3,
    "user": "UREDACTED"
  },
  "subtype": "message_replied",
  "ts": "1526333898.000318",
  "type": "message"
}

key "is_archived" not present

{"type":"channel_created","channel":{"id":"<elided>","is_channel":true,"name":"appliedmaths","created":1438929092,"creator":"<elided>"},"event_ts":"1438929092.870613"}
key "is_archived" not present
Please report this failure to the github issue tracker

Reporting as requested. A follow-up channel list request using curl returns an is_archived field in the JSON map for this channel. I guess Slack don't add the is_archived field before they announce that the channel has been created.

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.