slack

package
v0.0.0-...-a605f52 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MaxMessageLimit = 4000

MaxMessage is the maximium size of a slack message according to slacks docs https://api.slack.com/changelog/2018-04-truncating-really-long-messages#:~:text=The%20text%20field%20of%20messages,but%20left%20the%20consequences%20ambiguous.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// PostMessage will sends a message as the token user to the specified channel
	PostMessage(channel string, message string) error

	// PostRawMessage will sends a raw message as the token user to the specified channel
	PostRawMessage(message MessageRequest) error
}

Client defines the interface to interact with the slack API

func New

func New(log logr.Logger, token string) (Client, error)

New creates a new slack client to interact with the slack API

type MessageRequest

type MessageRequest struct {
	Channel     string `json:"channel"`
	Text        string `json:"text,omitempty"`
	AsUser      bool   `json:"as_user,omitempty"`
	UnfurlLinks bool   `json:"unfurl_links"`
	UnfurlMedia bool   `json:"unfurl_media"`
}

MessageRequest defines a default slack request for a message

type Response

type Response struct {
	Ok      bool         `json:"ok"`
	Message *interface{} `json:"message"`
	Error   *string      `json:"error"`
}

Response defines a slack response

Jump to

Keyboard shortcuts

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