| 1 |
// Package mattermost provides a notification service for sending messages to Mattermost channels or users via webhooks. |
| 2 |
// |
| 3 |
// This package is part of the shoutrrr notification library and implements the Service interface |
| 4 |
// for delivering notifications to Mattermost, an open-source team collaboration platform. |
| 5 |
// |
| 6 |
// # Service Configuration |
| 7 |
// |
| 8 |
// The Service struct provides the main functionality for sending notifications to Mattermost. |
| 9 |
// It embeds standard.Standard for common service features and includes configuration and HTTP client management. |
| 10 |
// |
| 11 |
// # Configuration Fields |
| 12 |
// |
| 13 |
// The Config struct supports the following settings: |
| 14 |
// |
| 15 |
// - Host: The Mattermost server hostname (required) |
| 16 |
// - Token: The webhook token for authentication (required) |
| 17 |
// - Channel: Override the default webhook channel (optional) |
| 18 |
// - UserName: Override the webhook username (optional) |
| 19 |
// - Icon: Use an emoji or URL as the message icon (optional) |
| 20 |
// - Title: Notification title (optional, not used in webhook mode) |
| 21 |
// - DisableTLS: Use plain HTTP instead of HTTPS (optional, default: false) |
| 22 |
// |
| 23 |
// # Usage Example |
| 24 |
// |
| 25 |
// service := &mattermost.Service{} |
| 26 |
// err := service.Initialize(serviceURL, logger) |
| 27 |
// if err != nil { |
| 28 |
// // handle error |
| 29 |
// } |
| 30 |
// err = service.Send("Your message here", nil) |
| 31 |
// |
| 32 |
// # JSON Payload Creation |
| 33 |
// |
| 34 |
// The package provides CreateJSONPayload for building properly formatted Mattermost webhook |
| 35 |
// payloads with support for text, channel overrides, username customization, and icon settings. |
| 36 |
// |
| 37 |
// # URL Format |
| 38 |
// |
| 39 |
// The configuration URL format is: |
| 40 |
// |
| 41 |
// mattermost://[username@]host/token[/channel]?icon=value&disabletls=No |
| 42 |
// |
| 43 |
// For more information about Mattermost webhooks, visit: https://docs.mattermost.com/developer/webhooks-incoming.html |
| 44 |
package mattermost |