Send a chat message with Thinwrap (Go)

Post a chat message via the Thinwrap Chat facade in Go — one call shape for Slack, Discord, Teams and every other provider.

1. Install

go get github.com/thinwrap/notifications-go

2. Send the call

import "github.com/thinwrap/notifications-go"

c := notifications.NewChat(notifications.SlackConfig{
    WebhookURL: os.Getenv("SLACK_WEBHOOK_URL"),
})

res, err := c.Send(ctx, notifications.ChatSendInput{
    Body: "Deploy finished for build 1042.",
})
if err != nil {
    var ce *notifications.ConnectorError
    if errors.As(err, &ce) {
        log.Printf("%s: %s", ce.ProviderCode, ce.ProviderMessage)
    }
    return
}

fmt.Println(res.Status, res.ProviderMessageID)

Same code works for all supported providers — just change the provider ID.