julienxx / clj-slack Goto Github PK
View Code? Open in Web Editor NEWUse Slack REST API from Clojure
License: Eclipse Public License 1.0
Use Slack REST API from Clojure
License: Eclipse Public License 1.0
I couldn't find anything related to timeouts and I think this is a huge opportunity for improvement.
It should be possible (and really encouraged) to specify reasonable timeouts for every slack operation.
Otherwise, the app can freeze indefinitely.
clj-http provides a couple of options for configuring timeouts: https://github.com/dakrone/clj-http#post
:conn-timeout
:socket-timeout
There's also :conn-request-timeout
but I guess that's not that important since it's a timeout for requesting a connection from connection manager.
There could a default (e.g. 60 seconds) for both timeouts too.
Since everything is sent through URL params, trying to send String's containing spaces raises an not-so-related StringReader NullPointerException. This means to send strings, users need to UrlEncode them before sending.
I believe this should be handled by the library or mentioned in the doc(string)s.
I want to create a slack bot that listens to specific words in a channel and answers to those. From my understanding, I need to use the real-time-messaging API from slack. My problem is, other than creating a session I don't understand how to use it from the docs or the code.
While using [org.julienxx/clj-slack "0.5.2.1"]
getting following compilation error:
(require 'clj-slack.users)
CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: meta, compiling:(clj_http/headers.clj:105:1)
The example of file upload using a clojure.java.io/input-stream from the readme is broken
Execution error at clojure.data.json/write-generic (json.clj:599).
Don't know how to write JSON of class java.io.BufferedInputStream
seems like it was caused by this commit: 739847b
(chat/post-message connection "#logs" "" {
:attachments [{"text" text
"color" color}]})
Posted as a user who created the app?!
(chat/post-message connection "#logs" "" {:username "Overseer"
:attachments [{"text" text
"color" color}]})
The same.
(chat/post-message connection "#logs" "" {
:as_username false/true
:attachments [{"text" text
"color" color}]})
CompilerException java.lang.IllegalArgumentException: Body may not be null, compiling:(.../src/.../slack.clj:27:1)
(chat/post-message connection "#logs" "" {:as_username "Overseer"
:attachments [{"text" text
"color" color}]})
No errors but posted as a user who created the app.
The goal: i want to post messages as a bot / another user. Whatever but not me :)
Seems like stringily-keys
is missing:
clj-slack/src/clj_slack/users.clj
Line 18 in 8934403
PS: I found this issue because the cljdoc documentation build for clj-slack failed (see build).
Hi,
According to https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api some API endpoints are retired since 24.02.2021.
How about removing the corresponding namespaces groups
, im
, mpim
and channels
?
On the oauth.access method, the docs say:
We strongly recommend supplying the Client ID and Client Secret using the HTTP Basic authentication scheme, as discussed in RFC 6749.
It could be good to do this instead of providing them in the URL parameters, I think?
clj-slack/src/clj_slack/oauth.clj
Lines 10 to 11 in 446bba8
Whatever i am trying to do i get an error:
(channels/list connection)
{:ok false, :error "missing_scope", :needed "channels:read", :provided "identify,incoming-webhook"}
Attachments are deprecated, replaced by blocks.
Multipart stuff.
It seems like that's what is next in your plate... let me know if you plan to start doing it anytime soon or if I should take a stab at it.
CI and testing against our own slack team would be great. What do you think? I already have one team setup for this project and it's the one I'm using to manually test the library.
So the new uploads endpoint works fine when posting snippets of text, but it won't upload binary files like images. I'm gonna PR an improved version soon.
It seems that the auth style used by the library, namely passing token in query params no longer works:
{:error "invalid_auth", :response {:ok false, :error "invalid_auth"}}
You need to pass the token in the Authorization
header.
Afaik, the easiest way to do this is to use the :oauth-token
param accepted by clj-http.
Here's what I ended up using: curiousprogrammer-net/slack-pom@f998e92#diff-1a6ed93c553296dc723c8009dc2fd60183c5a3c00d4b50b6ca511fbdead178ccR20
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.