Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
HttpClient utils.HTTPDoer // HttpClient executes the underlying HTTP request.
}
Client sends messages to Microsoft Teams via webhook.
func New ¶
New creates a new MS Teams client with optional headers and TLS control.
Parameters:
- headers: Optional HTTP headers (e.g. Authorization, Content-Type).
- skipTLS: If true, disables TLS certificate validation.
Returns:
- *Client: A ready-to-use Teams sender.
func (*Client) Send ¶
Send delivers the provided message to the specified Teams webhook URL.
Parameters:
- ctx: Request-scoped context.
- message: Message payload with title and text.
- webhookURL: Fully qualified MS Teams webhook endpoint.
Returns:
- string: Success text if response is HTTP 200.
- error: If marshalling, sending, or decoding fails.
type MSTeams ¶
type MSTeams struct {
Title string `json:"title"` // Title is the main heading of the message card.
Text string `json:"text"` // Text is the body content of the message card.
}
MSTeams defines the payload structure for a Microsoft Teams message.
type Sender ¶
type Sender interface {
// Send transmits the message to the given MS Teams webhook.
//
// Parameters:
// - ctx: Context for timeout or cancellation.
// - message: Structured payload with title and text.
// - webhookURL: Microsoft Teams webhook destination.
//
// Returns:
// - string: Success confirmation message.
// - error: If sending or response fails.
Send(ctx context.Context, message MSTeams, webhookURL string) (string, error)
}
Sender is implemented by types capable of sending Microsoft Teams messages.
Click to show internal directories.
Click to hide internal directories.