Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beginner friendly Readme tutorial :) #34

Open
abhi18av opened this issue Oct 7, 2018 · 15 comments
Open

Beginner friendly Readme tutorial :) #34

abhi18av opened this issue Oct 7, 2018 · 15 comments

Comments

@abhi18av
Copy link

abhi18av commented Oct 7, 2018

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 ?

@Leonidas-from-XIV
Copy link
Owner

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?

@abhi18av
Copy link
Author

abhi18av commented Oct 7, 2018

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

@Leonidas-from-XIV
Copy link
Owner

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

@abhi18av
Copy link
Author

abhi18av commented Oct 7, 2018

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

@Leonidas-from-XIV
Copy link
Owner

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.

@abhi18av
Copy link
Author

abhi18av commented Oct 7, 2018

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 ?

@Leonidas-from-XIV
Copy link
Owner

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

@abhi18av
Copy link
Author

abhi18av commented Oct 8, 2018 via email

@Leonidas-from-XIV
Copy link
Owner

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.

@abhi18av
Copy link
Author

abhi18av commented Oct 8, 2018 via email

@Leonidas-from-XIV
Copy link
Owner

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

@Leonidas-from-XIV
Copy link
Owner

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

@abhi18av
Copy link
Author

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

@Leonidas-from-XIV
Copy link
Owner

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

@pm5
Copy link
Contributor

pm5 commented May 22, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants