slacknotifier

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

Slack Notifier

A command line tool and a GitHub Action to post message notifications to Slack.

GitHub Action

See action.yml for details on inputs and outputs.

Example:

uses: ronny/slacknotifier@v1
with:
  slack-token: xoxb-whatever
  bot-name: deploybot
  bot-icon-emoji: ":mega:"
  channel-id: "C12345"
  message: "Deployed `todo-service`"
  message-context: "Env: `production` | By: $GITHUB_ACTOR | Commit: $GITHUB_SHA"

CLI tool

go install github.com/ronny/slacknotifier/cmd/slack-notify
$GOPATH/bin/slack-notify

Or, if you have the source locally:

make install
$GOPATH/bin/slack-notify

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

type Notifier struct {
	BotUsername  string
	BotIconEmoji string
	Client       SlackClient
}

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, input NotifyInput) (*NotifyOutput, error)

type NotifyInput

type NotifyInput struct {
	ChannelID                   string
	Message                     string
	MessageContext              string
	Markdown                    bool
	TimestampOfMessageToReplace string
}

type NotifyOutput

type NotifyOutput struct {
	ChannelID string
	Timestamp string
}

type SlackClient

type SlackClient interface {
	UpdateMessageContext(ctx context.Context, channelID string, timestamp string, options ...slack.MsgOption) (_chan string, _timestamp string, _text string, err error)
	PostMessageContext(ctx context.Context, channelID string, options ...slack.MsgOption) (_chan string, _timestamp string, err error)
}

Directories

Path Synopsis
cmd
slack-notify command

Jump to

Keyboard shortcuts

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