Description
The Go framework hanu is your best friend to create Slack bots! hanu uses platzhalter for easy command parsing (e.g. whisper ) and runs fine as a Heroku worker. All you need is a Slack API token and you can create your first bot within seconds! Just have a look at the hanu-example bot …
hanu alternatives and similar packages
Based on the "Third-party APIs" category.
Alternatively, view hanu alternatives based on common mentions on social networks and blogs.
-
githubql
Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql). -
openaigo
OpenAI GPT3/3.5 and GPT4 ChatGPT API Client Library for Go, simple, less dependencies, and well-tested -
gostorm
GoStorm is a Go library that implements the communications protocol required to write Storm spouts and Bolts in Go that communicate with the Storm shells. -
ynab
Go client for the YNAB API. Unofficial. It covers 100% of the resources made available by the YNAB API.
CodeRabbit: AI Code Reviews for Developers
Do you think we are missing an alternative of hanu or a related project?
Popular Comparisons
README
hanu - Go for Slack Bots!
The Go
framework hanu is your best friend to create Slack bots! hanu uses allot for easy command and request parsing (e.g. whisper <word>
) and runs fine as a Heroku worker. All you need is a Slack API token and you can create your first bot within seconds! Just have a look at the hanu-example bot or read my tutorial …
Features
- Respond to mentions
- Respond to direct messages
- Auto-Generated command list for
help
- Works fine as a worker on Heroku
Usage
Use the following example code or the hanu-example bot to get started.
package main
import (
"log"
"strings"
"github.com/sbstjn/hanu"
)
func main() {
slack, err := hanu.New("SLACK_BOT_API_TOKEN")
if err != nil {
log.Fatal(err)
}
Version := "0.0.1"
slack.Command("shout <word>", func(conv hanu.ConversationInterface) {
str, _ := conv.String("word")
conv.Reply(strings.ToUpper(str))
})
slack.Command("whisper <word>", func(conv hanu.ConversationInterface) {
str, _ := conv.String("word")
conv.Reply(strings.ToLower(str))
})
slack.Command("version", func(conv hanu.ConversationInterface) {
conv.Reply("Thanks for asking! I'm running `%s`", Version)
})
slack.Listen()
}
The example code above connects to Slack using SLACK_BOT_API_TOKEN
as the bot's token and can respond to direct messages and mentions for the commands shout <word>
, whisper <word>
and version
.
You don't have to care about help
requests, hanu has it built in and will respond with a list of all defined commands on direct messages like this:
/msg @hanu help
Of course this works fine with mentioning you bot's username as well:
@hanu help
Slack
Use direct messages for communication:
/msg @hanu version
Or use the bot in a public channel:
@hanu version
Dependencies
- github.com/sbstjn/allot for parsing
cmd <param1:string> <param2:integer>
strings - golang.org/x/net/websocket for websocket communication with Slack
Credits
*Note that all licence references and agreements mentioned in the hanu README section above
are relevant to that project's source code only.