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: ? modules, 0 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

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