A haskell wrapper for the Zulip API.


Keywords
library, web, Propose Tags, , Last Documentation, hzulip-1.1.1.3.tar.gz, browse, Package description, Package maintainers, yamadapc, edit package information
License
GPL-2.0-only
Install
cabal install hzulip-1.1.1.3

Documentation

hzulip

Build Status Hackage Dependencies Status Gitter chat


A haskell wrapper for the zulip API.

Installing

Simply installing through cabal with cabal install hzulip should do it.

Usage

Getting started

import Web.HZulip

main :: IO ()
main = withZulipCreds "zulip-api-user" "zulip-api-key" $ do
    -- Since we are inside the ZulipM ReaderT monad transformer, we
    -- don't need to pass options around. The above function already
    -- created an HTTP manager, for connection pooling and wrapped the
    -- default configuration options with the Monad:
    print =<< getSubscriptions
    -- >> ["haskell"]

    -- Sending messages is as easy as:
    void $ sendStreamMessage "haskell"              -- message stream
                             "hzulip"               -- message topic
                             "Message from Haskell" -- message content

    -- Before receiving messages, our client needs to be subscribed to streams
    addAllSubscriptions

    -- Listening for events works with a callback based API:
    onNewMessage $ \msg -> do
        lift $ putStrLn "Got a new message!"
        let usr = messageSender msg
            fn = userFullName usr
            e = userEmail usr

       sendPrivateMessage [e] $ "Thanks for the message " ++ fn ++ "!!"

Documentation

The best resource on this is naturally its haddock documentation, available at yamadapc.github.io/hzulip. You might also be interested in the zulip API documentation as well.

Examples

There are a couple of example bots and applications on the examples directory. If you're getting started with Haskell, I'd suggest looking at the ZulipLogger and ZulipEchoBot which show of basic API usage with minimal noise from anything else.

A higher-level API

A Conduit API is provided as well and an "echo" example is available for it in the examples directory; here. You can compare the evented implementation and see which you like best. Right now using streams to handle output is a bit unhandy, but it provides a nice composable high-level interface for the events.


Other than the echo and logger examples; there's also a pretty logger at ZulipCli.

A remote evaluation bot

Though slightly outdated, there's a remote evaluation Zulip bot using this library at zulip-eval-bot, which might be worth taking a look at as well.

License

This code is licensed under the GPLv2 license for Pedro Tacla Yamada. Plese refer to LICENSE for more information.

Donations

Would you like to buy me a beer? Send bitcoin to 3JjxJydvoJjTrhLL86LGMc8cNB16pTAF3y