slackstatus

package module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 8 Imported by: 8 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

slackstatus GoDoc

Simple CLI tool and Go library to post formatted status messages to a Slack channel 🎉

Slackstatus in Action

Usage as CLI tool

Slackstatus is available as pre-built binaries for macOS, Linux, FreeBSD and Windows on the release page.

slackstatus "message body" --webhook=https://hooks.slack.com/services/XXXX --color=good --chanel=status --user=slackstatus --footer="V1.0.0" --iconemoji=":monkey_face:"

You can also pipe your message text from another output:

echo "message text" | slackstatus --color=good

All flag values can also be pre-set in a config file .slackstatus.yml in the current directory or in your $HOME like so:

webhook: https://hooks.slack.com/services/XXXX
user: slackstatus
channel: status
footer: V1.0.0
iconemoji: :monkey_face:

It is also possible to provide a specific path to your config file as --config=/path/to/config.

Get help on all available flags:

slackstatus --help

Usage as Go library

package main

import "github.com/pteich/slackstatus"

var slackmsg = slackstatus.Message{
	WebhookURL: "https://hooks.slack.com/services/XXXX",
	Username: "slackstatus",
	Channel: "#status",
	IconEmoji: ":monkey_face:",
	Footer: "Version 1.0.0",
}

func main() {

	slackmsg.Send("Hello Slackstatus! Everything works fine.", slackstatus.ColorGood)
	slackmsg.Send("Oh crap, something went wrong!", slackstatus.ColorWarning)
	slackmsg.Send("Damn, we are in serious trouble!", slackstatus.ColorDanger)
	slackmsg.Send("Ok.", "#439FE0")
  
}

Documentation

Index

Constants

View Source
const ColorDanger string = "danger"

ColorDanger is a predefined color for a dangerous condition (red)

View Source
const ColorGood string = "good"

ColorGood is a predefined color for a normal information (green)

View Source
const ColorWarning string = "warning"

ColorWarning is a predefined color for a warning (yellow)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	WebhookURL       string `mapstructure:"webhook_url"`
	Channel          string `mapstructure:"channel"`
	Username         string `mapstructure:"username"`
	IconEmoji        string `mapstructure:"icon_emoji"`
	Footer           string `mapstructure:"footer"`
	RetryRatelimited bool   `mapstructure:"retry_ratelimited"`
	RetryBackground  bool   `mapstructure:"retry_background"`
	// contains filtered or unexported fields
}

Message defines the message that should be send to Slack

func (*Message) Send

func (msg *Message) Send(message string, color string) error

Send sends the given message to Slack

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址