Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Add some docstring links to telegram documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgreg committed Feb 29, 2024
1 parent a9250f0 commit 141999b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/client/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type TelegramClient interface {
AlertClient
}

// TelegramConfig holds configuration details for creating a new Telegram client.
// Token: The Bot Token provided by BotFather upon creating a new bot (https://core.telegram.org/bots/api).
// ChatID: Unique identifier for the target chat (https://core.telegram.org/constructor/channel).
type TelegramConfig struct {
Token string
ChatID string
Expand Down Expand Up @@ -78,6 +81,7 @@ func (tc *telegramClient) PostEvent(ctx context.Context, data *AlertEventTrigger
return nil, err
}

// API endpoint "https://api.telegram.org/bot%s/sendMessage" is used to send messages (https://core.telegram.org/bots/api#sendmessage)
url := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", tc.token)
req, err := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(payloadBytes))
if err != nil {
Expand Down

0 comments on commit 141999b

Please sign in to comment.