• Stars
    star
    148
  • Rank 241,196 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Golang Framework for writing Slack bots

hanu - Go for Slack Bots!

Current Release MIT License Read Tutorial Code Example

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

Credits

More Repositories

1

timesheet.js

JavaScript library for HTML5 & CSS3 time sheets
JavaScript
6,946
star
2

noduino

JavaScript and Node.js Framework for controlling Arduino with HTML and WebSockets
CSS
1,229
star
3

serverless-analytics

Track website visitors with Serverless Analytics using Kinesis, Lambda, and TypeScript.
CSS
241
star
4

sqs-worker-serverless

Example for SQS Worker in AWS Lambda using Serverless
JavaScript
178
star
5

cra-serverless

Serverless pre-rendering (SSR) for React SPA using AWS Lambda, S3, and CloudFront.
TypeScript
158
star
6

serverless-dynamodb-autoscaling

Serverless Plugin for Amazon DynamoDB Auto Scaling configuration.
TypeScript
148
star
7

serverless-stack-output

Serverless plugin to process AWS CloudFormation Stack Output
TypeScript
92
star
8

node-blog

Markdown Blog written in Node.js with twitter bootstrap UI and ace editor for composing…
JavaScript
83
star
9

68Keys.io

Build your own 68% Custom Mechanical Keyboard.
Sass
61
star
10

appsync-resolvers-example

Example project for AppSync, GraphQL, and AWS Lambda resolvers using Go.
Go
61
star
11

allot

Parse placeholder and wildcard text commands
Go
56
star
12

go-lambda-example

Example AWS Lambda function in Go and SAM
Go
49
star
13

serverless-geoip

Use MaxMind GeoLite2 database with AWS Lambda
JavaScript
43
star
14

appsync-resolvers

AWS AppSync Resolvers for GraphQL using AWS Lambda functions in Go.
Go
41
star
15

cra-pipeline

Use AWS CDK with CodePipeline to deploy a TypeScript Create-React-App.
TypeScript
40
star
16

serverless-sqs-alarms-plugin

Serverless wrapper to setup CloudWatch Alarms for SQS
JavaScript
36
star
17

lawos

SQS Worker for AWS Lambda.
JavaScript
29
star
18

go-appsync-graphql-cloudformation

AWS AppSync GraphQL API Proxy with Lambda, CloudFormation, and SAM
Makefile
29
star
19

serverless-s3bucket-sync

Serverless Plugin to sync local folders with an S3 bucket
TypeScript
25
star
20

mongoclikker

MongoDB viewer and editor written in Node
JavaScript
22
star
21

latenz

JavaScript HTTP latency analyzer
JavaScript
20
star
22

cdk-lambda-fleet

Deploy AWS Lambda functions using docker images to ECR with AWS CDK
TypeScript
19
star
23

github-releases-slack

Notify Slack about GitHub Releases.
Go
17
star
24

kirbycms-oauth-consumer

Kirby CMS Plugin for using Twitter and GitHub OAuth login
PHP
14
star
25

typescript-npm-boilerplate

Publish to NPM with TypeScript, CircleCI and GitHub Releases.
TypeScript
13
star
26

node-arduino-socket

Simple node.js application for piping a serial connection over websockets to your browser
JavaScript
12
star
27

DropFile.php

HTML, JavaScript and PHP file uploader
JavaScript
11
star
28

liveblog.js

Node.js App for Liveblogs and Event Tickers with Socket.IO and Express.js
JavaScript
10
star
29

aws-lambda-docker-node

Continuous Integration and Continuous Deployment setup for AWS Lambda functions with Docker images using GitHub Actions.
Makefile
10
star
30

node-kickstart

Simple Node.js example app with support for jade, less, ssl certificates…
JavaScript
8
star
31

requirejs-express

Example app using Express and RequireJS in Node.js
JavaScript
8
star
32

lawos-serverless

Serverless example for an SQS Worker in AWS Lambda using Lawos
JavaScript
7
star
33

appsync-example-dynamodb

GraphQL API using AWS AppSync, SAM, and DynamoDB
Makefile
7
star
34

serverless-alexa-skill

Serverless example for a custom Amazon Alexa Skill
JavaScript
7
star
35

faas.club

Curated list for serverless resources and everything for Functions as a Service at https://faas.club
JavaScript
7
star
36

taco.js

Rating awesomeness with Express.js
CSS
5
star
37

node-markdownblog

Engine for managing markdown files…
JavaScript
4
star
38

cdk-template

My GitHub Template for AWS CDK projects and GitHub actions.
TypeScript
4
star
39

node-kickstart-example

Example application for node-kickstart
JavaScript
4
star
40

node-simple-cdn

Simple CDN host ballancing for node
JavaScript
4
star
41

faas-sam-lambda-go

AWS Serverless Application Model w/ Go
Go
4
star
42

XMLBuilder.js

Create XML data with JavaScript
JavaScript
4
star
43

alexa-example-skill

Example code of a custom Skill for Amazon Echo & Alexa.
JavaScript
4
star
44

archive

Amazon S3 Replication with KMS, CDK, and CloudFormation StackSets.
TypeScript
4
star
45

SimplePHP

A bunch of static PHP classes making everyday code easier and comfortable.
PHP
4
star
46

hanu-example

Example usage of the hanu Go framework
Go
3
star
47

rdm

Scaffold common GitHub project files like README, CoC, or LICENSE.md
Go
3
star
48

faas-sam-lambda-typescript

AWS Serverless Application Model w/ TypeScript
TypeScript
3
star
49

php-jade

PHP example app using jade template engine
PHP
3
star
50

SocialStream.php

PHP Framework to fetch your recent Social Media events
PHP
3
star
51

super-arduino-bro

Basic pixel Jump'n'Run for 8x8 RGB LED matrix and Arduino — v. 0.1
C++
3
star
52

gatsby-disable-404

Disable 404 pages for Gatsby websites
TypeScript
2
star
53

lambda-error

Node.js error object for streamlined errors using AWS Lambda and API Gateway
JavaScript
2
star
54

jade.php

HAML-like template engine for PHP 5.3 & Symfony2 - Using #{var} syntax instead of {{$var}}
PHP
1
star
55

Snug.php

Static Page Generator using PHP, HAML and LESS
PHP
1
star
56

actions

GitHub Actions
Dockerfile
1
star
57

reng

Release Name Generator in PHP 5.3 - aka. handy-hyena
PHP
1
star
58

sqs-object

Convert JavaScript objects to SQS Meta Attributes
JavaScript
1
star
59

cdk-encrypted-bucket

Example for polyglot CDK construct for NPM, PyPi, and NuGet
TypeScript
1
star
60

gauges-referrer

Tiny Node.JS Helper for the Gaug.es API
JavaScript
1
star
61

aws-codepipeline-example

Go
1
star
62

pinged.php

Lightweight PHP logging service with HTTP interface
PHP
1
star
63

SimpleObjects

A bunch of PHP objects making everyday code easier and comfortable
PHP
1
star
64

node-proclog

Basic event logger with Node and MongoDB and Websocket Live Monitoring
1
star
65

Boilerplate.swift

Swift3 code with UnitTests that run on macOS, tvOS, iOS, watchOS and Linux.
Swift
1
star
66

discogs-collection

Export your Discogs.com collection value to CloudWatch Metrics
TypeScript
1
star
67

circleci-orbs

CircleCI Orbs for common tasks.
1
star
68

stopper

Minimal stopwatch object to count and measure time in JavaScript.
JavaScript
1
star
69

docker-go

Docker image for CircleCI projects using Golang.
Dockerfile
1
star
70

falke

Alexa skill to check when a Tatort is broadcasted
JavaScript
1
star
71

feedback

Command line feedback for Go
Go
1
star
72

node-cloudstream

Query latest items stored at http://getCloudApp.com
JavaScript
1
star
73

docker-node

Toolbox for Node.
Dockerfile
1
star
74

SliPHP

Atomic view and layout engine for PHP 5.4 and above.
PHP
1
star
75

aws-edukit-example

Example baseline for prototyping with the Core2 AWS IoT EduKit.
C
1
star
76

layers

Manage, build, and deploy AWS Lambda Layers
Makefile
1
star
77

faas-sam-lambda-python

AWS Serverless Application Model w/ Python
Python
1
star
78

function-path

Deeplink into nested JavaScript module functions
TypeScript
1
star
79

faas-makefile

Reusable Makefile to bootstrap AWS::Serverless CloudFormation projects
Makefile
1
star