Skip to content

Golang Client for Slack Incomming Webhooks with Richly-Formatted Messages

License

Notifications You must be signed in to change notification settings

CuriosityChina/slackhookgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SlackHookGo

Golang Client for Slack Incomming Webhooks with Richly-Formatted Messages

Usage

package main

import (
	"log"

	"github.com/lowstz/slackhookgo"
)

func main() {
	var attachment slackhookgo.MessageAttachment
	attachment.Color = "danger"
	attachment.Pretext = "test pretext"
	attachment.Text = "test text"
	attachment.Title = "test title"
	attachment.TitleLink = "https://www.google.com/"
	msg := slackhookgo.NewSlackMessage("slack-bot", "test")
	msg.IconEmoji = ":ghost:"
	msg.AddAttachment(attachment)
	url := "https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYYYYYYYYYYYYY"
	err := slackhookgo.Send(url, msg)
	if err != nil {
		log.Println(err)
	}
}

About

Golang Client for Slack Incomming Webhooks with Richly-Formatted Messages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages