Leonidas-from-XIV / slacko

A neat interface for Slack

Home Page:https://leonidas-from-xiv.github.io/slacko

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beginner friendly Readme tutorial :)

abhi18av opened this issue Β· comments

Hi @Leonidas-from-XIV

First off, thanks for this wonderful API client in OCaml ! I am new to OCaml and I was going through the GitHub repos to find something I could really learn from and here it is - a slack client πŸ‘

However, being a beginner I'm unable to really start using this in utop

This is my progress so far

#require "slacko"

utop # Slacko.auth_test ( Slacko.token_of_string "my-token-string" );;
Characters 19-41:Warning 3: deprecated: Slacko.token_of_stringPlease use 'start_session' instead.
Characters 19-41:
Warning 3: deprecated: Slacko.token_of_string
Please use 'start_session' instead.
Exception: (Failure "No SSL or TLS support compiled into Conduit").
Raised at file "src/core/lwt.ml", line 2987, characters 28-29
Called from file "src/unix/lwt_main.ml", line 26, characters 8-18
Called from file "toplevel/toploop.ml", line 180, characters 17-56

Could you please help me out a little bit here ?

Thanks for the kind words!

It is odd, because the error is that the HTTP library you're using does not have SSL/TLS support, which is necessary to talk to the Slack API. The OPAM file mentions this, so installing the package should install either the ssl or the tls package.

How did you install slacko?

Found solution for the tls problem atleast hammerlab/ketrew#420

Yes, but it should not be necessary because slacko already depends on tls or ssl so it should be installed automatically.

Hmm, I realized this however I keep running into errors while building a transitive dependency mirleft/ocaml-tls#385

It looks like you're running opam as root and your ~/.opam is corrupted. I would recommend you to run it as regular user and maybe start from a clean ~/.opam.

Mmm, actually I am trying out a server ( for the first time ! ) and I the only way I have access to it is ssh root@xyz and this is the reason I installed everything as root.

I don't quite know how to create user and run ocaml as a user, could you please point me in the right direction ?

I don't know which operating system your server uses, here's the instructions for Debian GNU/Linux.

Well it can all be done if you know what you're doing, but the problem is that you'll need to install OPAM 2 and I am not sure there are prebuilt packages for OPAM 2 for ARMv7. Therefore I would suggest you start with a simpler platform first.

I think posting a message is quite self-explanatory. If you look in the documentation you'll find chat_post_message, which among other optional arguments requires a token, a channel and a message type. In the module you can find channel_of_string, message_of_string and token_of_string to construct these types of of strings. Then it is just a matter of calling the function and resolving the Lwt promise. You can see this thing being done in the bundled slack-notify program:

let session = Slacko.start_session ?base_url token in

(It seems like the API docs are out of date for some reason, looks like I'll have to look into it)

Hi @Leonidas-from-XIV , have you managed to find time to update the docs yet ?

Yes, sorry, the docs should be up to date with the current release on OPAM.

Hello, I tried out Slacko and hit this error. It seems now one needs to install tls-lwt to get it to work (found here).