package main import ( "encoding/json" "fmt" "strconv" "time" "github.com/slack-go/slack" ) func main() { attachment := slack.Attachment{ Color: "good", Fallback: "You successfully posted by Incoming Webhook URL!", AuthorName: "slack-go/slack", AuthorSubname: "github.com", AuthorLink: "https://github.com/slack-go/slack", AuthorIcon: "https://avatars2.githubusercontent.com/u/652790", Text: " All text in Slack uses the same system of escaping: chat messages, direct messages, file comments, etc. :smile:\nSee ", Footer: "slack api", FooterIcon: "https://platform.slack-edge.com/img/default_application_icon.png", Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)), } msg := slack.WebhookMessage{ Attachments: []slack.Attachment{attachment}, } err := slack.PostWebhook("YOUR_WEBHOOK_URL_HERE", &msg) if err != nil { fmt.Println(err) } }