jcpetruzza / slack-api

Haskell bindings to the Slack RTM API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Travis Build Status

Bindings to the Slack RTM API.

These bindings were developed whilst I was interning at Borders.

More information can be found here

Example

module EchoBot where

import Web.Slack
import Web.Slack.Message
import System.Environment (lookupEnv)
import Data.Maybe (fromMaybe)
import Control.Applicative

myConfig :: String -> SlackConfig
myConfig apiToken = SlackConfig
         { _slackApiToken = apiToken -- Specify your API token here
         }

echoBot :: SlackBot ()
echoBot (Message cid _ msg _ _ _) = sendMessage cid msg
echoBot _ = return ()

main :: IO ()
main = do
  apiToken <- fromMaybe (error "SLACK_API_TOKEN not set")
               <$> lookupEnv "SLACK_API_TOKEN"
  runBot (myConfig apiToken) echoBot ()

About

Haskell bindings to the Slack RTM API

License:MIT License


Languages

Language:Haskell 97.7%Language:Nix 2.3%