Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/invisiblethreat/slackhook
Slack Incoming Webhook for Golang
https://github.com/invisiblethreat/slackhook
go golang slack webhook
Last synced: about 6 hours ago
JSON representation
Slack Incoming Webhook for Golang
- Host: GitHub
- URL: https://github.com/invisiblethreat/slackhook
- Owner: invisiblethreat
- License: apache-2.0
- Created: 2018-02-03T15:28:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-03T18:03:42.000Z (almost 7 years ago)
- Last Synced: 2024-11-12T07:04:01.715Z (2 months ago)
- Topics: go, golang, slack, webhook
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![GoDoc](https://godoc.org/github.com/invisiblethreat/slackhook?status.png)](https://godoc.org/github.com/invisiblethreat/slackhook)
[![Build Status](https://travis-ci.org/invisiblethreat/slackhook.svg?branch=master)](https://travis-ci.org/invisiblethreat/slackhook)# slackhook
Derived from https://github.com/lytics/slackhook.
[Incoming WebHooks](https://api.slack.com/incoming-webhooks) API client.
## Usage
```golang
hook := slackhook.NewHook(os.Getenv("SLACK_HOOK"))// most fields are optional and will default to the configured values on the
// integration page
msg := slackhook.Message{
Channel: "#hook-testing",
Text: "testing text",
UserName: "slackhook tester",
IconURL: "https://slack.global.ssl.fastly.net/66f9/img/avatars/ava_0002-48.png",
}// most fields are optional
att := slackhook.Attachment{
Color: "good",
Text: "text",
Fallback: "fallback",
AuthorName: "author",
AuthorLink: "https://github.com/invisiblethreat/slackhook",
AuthorIcon: "https://avatars1.githubusercontent.com/u/2525006?s=40&v=4",
Title: "attachment title",
TitleLink: "https://github.com/invisiblethreat/slackhook",
ImageURL: "http://i.imgur.com/50NA7vr.gif",
Footer: "footer text",
FooterIcon: "http://simpleicon.com/wp-content/uploads/foot.png",
}att.TSSet(time.Now())
field := slackhook.Field{
Title: "field title",
Value: "field value",
Short: false,
}att.AddField(field)
msg.Attach(&att)
hook.Send(&msg)```