diff --git a/internal/alert/telegram.go b/internal/alert/telegram.go index d2ea2f5..bc6d563 100644 --- a/internal/alert/telegram.go +++ b/internal/alert/telegram.go @@ -11,7 +11,8 @@ import ( //SendTelegramMessage Sends a notification message to a Telegram Webhook. func SendTelegramMessage(item string, nvidiaURL string, config config.TelegramConfig, client *http.Client) error { - body := map[string]string{"Text": item + " Ready for Purchase: " + nvidiaURL, "ChatID": config.ChatID} + text := item + " Ready for Purchase: " + nvidiaURL + body := map[string]interface{}{"chat_id": config.ChatID, "text": text, "disable_web_page_preview": true} payload, err := json.Marshal(body) if err != nil { @@ -19,12 +20,12 @@ func SendTelegramMessage(item string, nvidiaURL string, config config.TelegramCo } // We're required to disable web page previews to ensure that the cart links don't get invalidated - req, err := http.NewRequest("POST", fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage&disable_web_page_preview=true", config.APIKey), bytes.NewBuffer(payload)) + req, err := http.NewRequest("POST", fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", config.APIKey), bytes.NewBuffer(payload)) if err != nil { return err } - req.Header.Add("Content-Type", "application/json") + req.Header.Set("content-type", "application/json") r, err := client.Do(req) if err != nil {