| 1 | // Package rocketchat provides a notification service for sending messages to Rocket.Chat channels or users. |
| 2 | // |
| 3 | // This package is part of the shoutrrr notification library and implements the Service interface |
| 4 | // for delivering notifications to Rocket.Chat, an open-source team collaboration platform. |
| 5 | // |
| 6 | // # Service Configuration |
| 7 | // |
| 8 | // The Service struct provides the main functionality for sending notifications to Rocket.Chat. |
| 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 Rocket.Chat server hostname (required) |
| 16 | // - Port: The Rocket.Chat server port (optional) |
| 17 | // - TokenA: The first part of the webhook token (required) |
| 18 | // - TokenB: The second part of the webhook token (required) |
| 19 | // - Channel: The target channel or user (optional, can include # for channels or @ for users) |
| 20 | // - UserName: Override the webhook username (optional) |
| 21 | // |
| 22 | // # Usage Example |
| 23 | // |
| 24 | // service := &rocketchat.Service{} |
| 25 | // err := service.Initialize(serviceURL, logger) |
| 26 | // if err != nil { |
| 27 | // // handle error |
| 28 | // } |
| 29 | // err = service.Send("Your message here", nil) |
| 30 | // |
| 31 | // # JSON Payload Creation |
| 32 | // |
| 33 | // The package provides CreateJSONPayload for building properly formatted Rocket.Chat webhook |
| 34 | // payloads with support for text, channel targeting, and username customization. |
| 35 | // |
| 36 | // # URL Format |
| 37 | // |
| 38 | // The configuration URL format is: |
| 39 | // |
| 40 | // rocketchat://[username@]host/tokenA/tokenB[/channel] |
| 41 | // |
| 42 | // For more information about Rocket.Chat webhooks, visit: https://docs.rocket.chat/guides/administration/administration/integrations |
| 43 | package rocketchat |