Quick Start

Installation

Joe is a software library that is packaged as Go module. You can get it via:

go get github.com/go-joe/joe

Your First Bot

The simplest chat bot listens for messages on a chat Adapter and then executes a Handler function if it sees a message directed to the bot that matches a given pattern.

For example a bot that responds to a message “ping” with the answer “PONG” looks like this:

package main

import "github.com/go-joe/joe"

func main() {
	b := joe.New("example-bot")
	b.Respond("ping", Pong)

	err := b.Run()
	if err != nil {
		b.Logger.Fatal(err.Error())
	}
}

func Pong(msg joe.Message) error {
	msg.Respond("PONG")
	return nil
}

Run it

To run the code above, save it as main.go and then execute it via go run main.go. By default Joe uses a CLI adapter which makes the bot read messages from stdin and respond on stdout.

Next Steps

Please refer to the Basic Usage section to learn how to write a full Joe Bot, using the adapter of your choice (e.g. Slack). If you want to dive right in and want to know what modules are currently provided by the community, then have a look at the Available Modules section. Last but not least, you can find more instructions and best practices in the Recipes section.

Happy hacking 🤖