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 functional options.
Use options like WithHeaders or WithInsecureTLS to customize behavior.
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 or non-200 is returned.
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 Option ¶ added in v0.9.4
type Option func(*Client)
Option configures a MSTeams client.
func WithHeaders ¶ added in v0.9.4
WithHeaders sets additional HTTP headers for the MS Teams client.
func WithInsecureTLS ¶ added in v0.9.4
WithInsecureTLS sets whether to skip TLS certificate verification.
func WithTimeout ¶ added in v0.21.0
WithTimeout sets the per-request timeout.
type Sender ¶
type Sender interface {
// Send transmits the message to the given MS Teams webhook.
//
// Returns a confirmation or error on failure.
Send(ctx context.Context, message MSTeams, webhookURL string) (string, error)
}
Sender is implemented by types capable of sending Microsoft Teams messages.