shoutrrr: github.com/containrrr/shoutrrr/pkg/services/slack Index | Files

package slack

import "github.com/containrrr/shoutrrr/pkg/services/slack"

Index

Package Files

slack.go slack_config.go slack_errors.go slack_json.go slack_token.go

Constants

const (
    // DefaultUser for sending notifications to slack
    DefaultUser = "Shoutrrr"
    // Scheme is the identifying part of this service's configuration URL
    Scheme = "slack"
)

func CreateJSONPayload Uses

func CreateJSONPayload(config *Config, message string) ([]byte, error)

CreateJSONPayload compatible with the slack webhook api

type Config Uses

type Config struct {
    standard.QuerylessConfig
    standard.EnumlessConfig
    BotName string
    Token   Token
}

Config for the slack service

func CreateConfigFromURL Uses

func CreateConfigFromURL(serviceURL *url.URL) (*Config, error)

CreateConfigFromURL to use within the slack service

func (*Config) GetURL Uses

func (config *Config) GetURL() *url.URL

GetURL returns a URL representation of it's current field values

func (*Config) SetURL Uses

func (config *Config) SetURL(serviceURL *url.URL) error

SetURL updates a ServiceConfig from a URL representation of it's field values

type ErrorMessage Uses

type ErrorMessage string

ErrorMessage for error events within the slack service

const (
    // TokenAMissing from the service URL
    TokenAMissing ErrorMessage = "first part of the API token is missing"
    // TokenBMissing from the service URL
    TokenBMissing ErrorMessage = "second part of the API token is missing"
    // TokenCMissing from the service URL
    TokenCMissing ErrorMessage = "third part of the API token is missing."
    // TokenAMalformed inthe service URL
    TokenAMalformed ErrorMessage = "first part of the API token is malformed"
    // TokenBMalformed inthe service URL
    TokenBMalformed ErrorMessage = "second part of the API token is malformed"
    // TokenCMalformed inthe service URL
    TokenCMalformed ErrorMessage = "third part of the API token is malformed"
    // NotEnoughArguments provided in the service URL
    NotEnoughArguments ErrorMessage = "the apiURL does not include enough arguments"
)

type JSON Uses

type JSON struct {
    Text    string `json:"text"`
    BotName string `json:"username"`
}

JSON used within the Slack service

type Service Uses

type Service struct {
    standard.Standard
    // contains filtered or unexported fields
}

Service sends notifications to a pre-configured channel or user

func (*Service) Initialize Uses

func (service *Service) Initialize(configURL *url.URL, logger *log.Logger) error

Initialize loads ServiceConfig from configURL and sets logger for this Service

func (*Service) Send Uses

func (service *Service) Send(message string, params *types.Params) error

Send a notification message to Slack

type Token Uses

type Token struct {
    A   string
    B   string
    C   string
}

Token is a three part string split into A, B and C

func ParseToken Uses

func ParseToken(s string) Token

ParseToken creates a Token from a sting representation

func (Token) String Uses

func (t Token) String() string

Package slack imports 11 packages (graph) and is imported by 1 packages. Updated 2020-07-31. Refresh now. Tools for package owners.