From 3330161d17930d32b24cd7c8cb8734aabf203cce Mon Sep 17 00:00:00 2001 From: hunterlong Date: Fri, 26 Jun 2020 18:12:12 -0700 Subject: [PATCH] telegram additional description and fix --- CHANGELOG.md | 1 + notifiers/telegram.go | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 004ed371..d0e82971 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Added core.Example() function for testing - Added Custom oAuth Authentication method - Fixed setup form not creating user from values inputted in form +- Fixed issues with Telegram Notifier # 0.90.55 (06-18-2020) - Added 404 page diff --git a/notifiers/telegram.go b/notifiers/telegram.go index e7ce4c0d..8af363b5 100644 --- a/notifiers/telegram.go +++ b/notifiers/telegram.go @@ -45,9 +45,9 @@ var Telegram = &telegram{¬ifications.Notification{ Required: true, }, { Type: "text", - Title: "Channel or User", + Title: "Channel", Placeholder: "@statping_channel", - SmallText: "Insert your Telegram Channel or User here.", + SmallText: "Insert your Telegram Channel including the @ symbol. The bot will need to be an administrator of this channel.", DbField: "var1", Required: true, }}}, @@ -60,9 +60,8 @@ func (t *telegram) sendMessage(message string) (string, error) { v := url.Values{} v.Set("chat_id", t.Var1) v.Set("text", message) - rb := *strings.NewReader(v.Encode()) - contents, _, err := utils.HttpRequest(apiEndpoint, "GET", "application/x-www-form-urlencoded", nil, &rb, time.Duration(10*time.Second), true, nil) + contents, _, err := utils.HttpRequest(apiEndpoint, "POST", "application/x-www-form-urlencoded", nil, strings.NewReader(v.Encode()), time.Duration(10*time.Second), true, nil) success, _ := telegramSuccess(contents) if !success { @@ -89,14 +88,14 @@ func (t *telegram) OnSuccess(s services.Service) (string, error) { // OnTest will test the Twilio SMS messaging func (t *telegram) OnTest() (string, error) { - msg := fmt.Sprintf("Testing the Twilio SMS Notifier on your Statping server") - content, err := t.sendMessage(msg) - return content, err + msg := fmt.Sprintf("Testing the Telegram Notifier on your Statping server") + return t.sendMessage(msg) } // OnSave will trigger when this notifier is saved func (t *telegram) OnSave() (string, error) { - return "", nil + msg := fmt.Sprintf("The Telegram Notifier on your Statping server was just saved") + return t.sendMessage(msg) } func telegramSuccess(res []byte) (bool, telegramResponse) {