package ozulip

  1. Overview
  2. Docs
OCaml bindings to Zulip API

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.tar.gz
md5=4173fefee440773dd0f8d7db5a2e01e5
sha512=cb53870eb8d41f53cf6de636d060fe1eee6c39f7c812eacb803b33f9998242bfb12798d4922e7633aa3035cf2ab98018987b380fb3f380f80d7270e56359c5d8

README.md.html

ozulip

OCaml bindings to Zulip API.

Messages

Send message

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let dest = Messages.stream_name "general" "welcom topic" in
        Messages.send_message conf dest "New message from `ozulip`" 

Upload a file

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let%lwt uri = Messages.upload_file conf "/path/to/your/file" in
        let dest = Messages.stream_name "general" "welcom topic" in
        let msg = Format.sprintf "Check out the [this file](%s)!" uri in 
        Messages.send_message conf dest msg

Edit message

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let dest = Messages.stream_name "general" "welcom topic" in
        let%lwt mess_id =  Messages.send_message conf dest "New message from `ozulip`" in
        Messages.edit_message ~content:"New content of my message" mess_id

Delete message

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let dest = Messages.stream_name "general" "welcom topic" in
        let%lwt mess_id =  Messages.send_message conf dest "New message from `ozulip`" in
        Messages.delete_message mess_id

High-level user interaction

    let _ =
        let open Ozulip in
        let conf = init ~domain ~email ~key in
        Events.interact ~trusted_emails:["you@example.com"] conf (fun msg ->
            if String.lowercase_ascii msg = "ping"
            then Lwt.return_some "pong"
            else Lwt.return_none)
OCaml

Innovation. Community. Security.