slack

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 2 Imported by: 0

README

slack — Slack message sender

import "github.com/downsized-devs/sdk-go/slack"

Stability: Stable — see STABILITY.md

Tiny wrapper around slack-go/slack for sending messages with attachments.

Features

  • SendMessage(channel, text, attachments...)

Installation

go get github.com/downsized-devs/sdk-go/slack

Quick Start

s := slack.Init(slack.Config{
    Token: "xoxb-...",
})
_ = s.SendMessage("#alerts", "Build failed", slack.Attachment{
    Title:  "CI",
    Text:   "main is red",
    Fields: []slack.AttachmentField{{Title: "Branch", Value: "main", Short: true}},
})

API Reference

Symbol Signature
Init func Init(cfg Config) Interface
Interface.SendMessage (channel, text string, attachments ...Attachment) error
Attachment { Title, Text, Color string; Fields []AttachmentField }
AttachmentField { Title, Value string; Short bool }

Configuration

Field Description
Token Slack bot token (xoxb-…). Store in a secrets manager.

Dependencies

  • External: github.com/slack-go/slack

Testing

go test ./slack/...

Contributing

See CONTRIBUTING.md.

  • tracker — for webhook-based alerting alternatives.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment slackgo.Attachment

type AttachmentField

type AttachmentField slackgo.AttachmentField

type Config

type Config struct {
	Enabled bool
	Token   string
}

type Interface

type Interface interface {
	SendMessage(ctx context.Context, channelID string, attachment Attachment, fields []AttachmentField) error
}

func Init

func Init(conf Config) Interface

Jump to

Keyboard shortcuts

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