Leonidas-from-XIV / slacko

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

Beginner friendly Readme tutorial :) #34

Open abhi18av opened 5 years ago

abhi18av commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Found solution for the tls problem atleast https://github.com/hammerlab/ketrew/issues/420

Leonidas-from-XIV commented 5 years ago

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

abhi18av commented 5 years ago

Hmm, I realized this however I keep running into errors while building a transitive dependency https://github.com/mirleft/ocaml-tls/issues/385

Leonidas-from-XIV commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

abhi18av commented 5 years ago

Thanks :)

I'm using something very close, Ubuntu. However I do think that perhaps the cpuid package isn't able to identify the cpu architecture I'm running on which is ARMv7 architecture from scaleway bare metal cloud.

You think it's possible to add this to the package?

On Sun, 7 Oct 2018, 21:18 Marek Kubica, notifications@github.com wrote:

I don't know which operating system your server uses, here's the instructions for Debian GNU/Linux https://www.debian.org/doc/manuals/debian-handbook/sect.creating-accounts.en.html .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Leonidas-from-XIV/slacko/issues/34#issuecomment-427663370, or mute the thread https://github.com/notifications/unsubscribe-auth/AMNNXpleA21SkfkUdq1ENyCxJNtqagpnks5uiiItgaJpZM4XL3Si .

Leonidas-from-XIV commented 5 years ago

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 commented 5 years ago

Yup there is - It's works fine on the scaleway ARMv7 bare metal instances! it's running utop, mirage etc perfectly fine. Still it really bothers me that the cpuid package is not buildable here. In the meantime, I'd use this on my linux workstation :)

Anyways, apart from that, I do think that the Readme should atleast have sample examples like "create message" etc or have you blogged about it ?

On Mon, Oct 8, 2018 at 11:50 AM Marek Kubica notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Leonidas-from-XIV/slacko/issues/34#issuecomment-427731196, or mute the thread https://github.com/notifications/unsubscribe-auth/AMNNXqSMGKCCHS50fZV4N3oP4eDNUu0nks5uiu60gaJpZM4XL3Si .

Leonidas-from-XIV commented 5 years ago

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: https://github.com/Leonidas-from-XIV/slacko/blob/5c2ac3773f13025120af6cfe55bc7bf4298032a5/src/cli/slack_notify.ml#L73

Leonidas-from-XIV commented 5 years ago

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

abhi18av commented 5 years ago

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

Leonidas-from-XIV commented 5 years ago

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

pm5 commented 1 year ago

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