Client to send messages to channels in Slack.

Go Reference GitHub go.mod Go version GitHub release (latest by date) Go Report Card Actions Status

Slack Client

A simple client to send messages to channels in Slack.

Example

package main

import {
    "fmt"

    slack "github.com/tommzn/go-slack"
}

func main() {

    client := slack.New()
    header := "Greetings!"
    channel := "<ChannelId>"

    // Send a message with header to a channel
    if err := client.SendToChannel("Hello Slack", channel, &header); err != nil {
        fmt.Println(err)
    }
    
    // Set default channel
    client.WithChannel(channel)
    // Send a message to default channel, including a header.
    if err := client.Send("Hello Slack", &header); err != nil {
        fmt.Println(err)
    }

    // Send a message without a header
    if err := client.Send("Hello Slack", nil); err != nil {
        fmt.Println(err)
    }
}

Auth Token

Each request to Slack Web API needs an auth token. This client expects an auth token provided by env variable SLACK_TOKEN. As an alternative you pass a SecretsManager to NewFromConfig to obtain a token from different sources.

Config

A default channel can be provided by config. See https://github.com/tommzn/go-config.

Example Config File

Following config file defines "Channel05" as default channel.

slack:
  channel: Channel05
Similar Resources

Uploads local files to discord channels.

discordfile Uploads local files to discord channels. Modified version of (https://github.com/Not-Cyrus/discord-file-webhook-upload) to support argumen

Aug 16, 2022

A lightweight operating system that allows Discord channels to essentially function as terminal interfaces

KuriOS KuriOS is an lightweight operating system that allows Discord channels to essentially function as terminal interfaces. As such, all permissions

Dec 31, 2021

Discord-dl: a tool to archive discord channels

discord-dl discord-dl is a tool to archive discord channels. I think it's safe t

May 18, 2022

Pro-bot - A telegram bot to play around with the community telegram channels

pro-bot 🤖 Pro Bot A Telegram Bot to Play Around With The Community Telegram Cha

Jan 24, 2022

IRC, Slack, Telegram and RocketChat bot written in go

IRC, Slack, Telegram and RocketChat bot written in go

go-bot IRC, Slack & Telegram bot written in Go using go-ircevent for IRC connectivity, nlopes/slack for Slack and Syfaro/telegram-bot-api for Telegram

Dec 20, 2022

Golang Framework for writing Slack bots

hanu - Go for Slack Bots! The Go framework hanu is your best friend to create Slack bots! hanu uses allot for easy command and request parsing (e.g. w

Oct 24, 2022

Slack Bot Framework

slacker Built on top of the Slack API github.com/slack-go/slack with the idea to simplify the Real-Time Messaging feature to easily create Slack Bots,

Dec 25, 2022

Slack bot core/framework written in Go with support for reactions to message updates/deletes

Slack bot core/framework written in Go with support for reactions to message updates/deletes

Overview Requirements Features Demo The Name Concepts Create Your Own Slackscot Assembling the Parts and Bringing Your slackscot to Life Configuration

Oct 28, 2022

Slack remind generator

slack-reminder Slack remind generator slack-reminder.mov Why Slack's /reminder is very hard to use. Required Go 1.16 ~ Installation $ go install githu

Nov 17, 2022
Tg-channel-api - A JSON API for latest messages of public Telegram channels

Telegram Channel API A JSON API for latest messages of public Telegram channels.

Oct 27, 2022
REPLbot is a Slack bot that allows you to control a REPL from within Slack.
REPLbot is a Slack bot that allows you to control a REPL from within Slack.

?? REPLbot REPLbot is a Slack bot that allows you to control a REPL from within Slack. It comes with a few REPLs (Go ?? , Java, NodeJS, PHP, Python, R

Dec 31, 2022
This slack-bot collects all @gophers notifications into one slack channel

slack-bot Slack bot copying reference to a ping to notifications channel The bot is designed to listen on messages containing specific tag, copy refer

Apr 11, 2022
Golang bot that connects to slack using Socketclient to read and write messages.
Golang bot that connects to slack using Socketclient to read and write messages.

?? (not)simple go project ?? Golang bot that connects to slack using Socketclient to read and write messages. ?? Use ?? @SquidBot : Mentions your name

Aug 23, 2022
Notify messages from gcs bucket objects to slack

Notify to Slack Notify message to slack from gcs storage file. Deploy $ gcloud functions deploy notify_to_slack \ --entry-point NotifyToSlack \

Oct 5, 2021
Notify - Notification microservice for sending templated payloads as Slack messages

Notify Notify is a microservice that takes an event & payload from an applicatio

May 23, 2022
send current weather updates from openweathermap api to your slack profile status using github action
send current weather updates from openweathermap api to your slack profile status using github action

go-slack-weather Send current weather updates from OpenWeatherMap API to your Slack profile status using GitHub Action Contents Setup Change Update Pe

Oct 31, 2022
Send Slack reports of pull requests pending review
Send Slack reports of pull requests pending review

preport Born out of a desire to get pull requests reviewed faster without having to send manual reminders, preport generates reports of GitLab pull re

Nov 23, 2021
Send Linux mails to Slack with golang

LinuxMailToSlack Install go install github.com/TKMAX777/MailToSlack@latest sudo

Jul 30, 2022
Auto send check-in message to Slack channel at a specific time.
Auto send check-in message to Slack channel at a specific time.

Auto Slack Check-in auto-slack-checkin is a command line interface (CLI) that sends check-in or check-out message for you while you are sleeping ??.

Feb 15, 2022