I don’t. That’s just something I pulled out of the oven, Julia Child-style. The real point of this article is just how to use the stack command. The bot is really simple. Here’s the entire source (slightly modified):
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Monoid ((<>))
import System.Environment (getEnvironment)
import Web.Spock.Safe
main :: IO ()
main = do
env <- getEnvironment
let port = maybe 8080 read $ lookup "PORT" env
runSpock port $ spockT id $
post "spock" $ do
comment <- param "text"
text $ case comment of
Just t -> "\"" <> t <> "\"" <> "highly illogical, captain"
Nothing -> "I didn't understand that."
That just gets the environment variable, PORT, to run the server on and then runs the app. The app responds to a POST at http://some.url.here/spock with a param of text and then builds a response based on that. That’s enough to handle a slash command in Slack. Like I said, really simple.
Haskellers in Madison? I lived there for a year. The lakes are beautiful.
I’m in Chicago and I’m also very excited about Haskell. We should get coffee or a beer if you’re ever in town (and I’ll reach out if I’m ever in your neck of the woods).
I didn’t see it as linkbait, but I was also surprised by the article not documenting any of the development. I think a title change would solve the issue.
Where in the article do they go over writing a Slack bot?
I don’t. That’s just something I pulled out of the oven, Julia Child-style. The real point of this article is just how to use the
stackcommand. The bot is really simple. Here’s the entire source (slightly modified):That just gets the environment variable, PORT, to run the server on and then runs the app. The app responds to a POST at
http://some.url.here/spockwith a param oftextand then builds a response based on that. That’s enough to handle a slash command in Slack. Like I said, really simple.Sorry for coming off as linkbait. :(
Eh, haters gonna hate. You got 12 positive votes.
Are you the OP? It’s great to see more people using Haskell.
twopoint718 is the author, I’m the OP. We work together at Bendyworks.
Haskellers in Madison? I lived there for a year. The lakes are beautiful.
I’m in Chicago and I’m also very excited about Haskell. We should get coffee or a beer if you’re ever in town (and I’ll reach out if I’m ever in your neck of the woods).
I didn’t see it as linkbait, but I was also surprised by the article not documenting any of the development. I think a title change would solve the issue.