Leonidas-from-XIV / slacko

A neat interface for Slack
https://leonidas-from-xiv.github.io/slacko
Other
81 stars 11 forks source link

Update chat post/update to latest Slack API #32

Closed edwintorok closed 5 years ago

edwintorok commented 5 years ago

I've been hacking on a small chat bot, the version of slacko in OPAM failed to parse channel history, but luckily the git branch of slacko did (due to message_obj having strict=false). The message object has got quite a few optional fields that can show up (e.g. if you are writing a bot and posting messages as a bot).

Message attachments are also very neat, and I missed them from the chat update API, so I've updated both 'chat post' and 'chat update' according to latest Slack APIs.

One caveat: had to use channel IDs, lookup by channel name was way too slow with thousands of channels, and also at some point Slack decided to paginate the replies meaning that slacko was suddenly unable to lookup the channel name anymore. The channel ID can be found by double clicking on the channel in the slack webapp and looking in the titlebar, wish they had a more efficient lookup API than listing everything :(