SendMsgToTelegramAsync

Parent Previous Next

SendMsgToTelegramAsync

Description: the method sends a message to Telegram. To do this, you need to create a bot, add it to the chat and transfer the bot token (botToken), chat ID (chatId), message text (text) and, if necessary, specify the encoding (charset) to the function

Syntax: SendMsgToTelegramAsync(string botToken, string chatId, string text, string charset = "UTF-8", int timeHourFrom = 0, int timeHourBefore = 0)

Return value: no return value


Example:

Tester tester = new Tester(browserForm);

await tester.TestBeginAsync();

...

await tester.TestEndAsync();

if(tester.GetTestResult() == Tester.FAILED) 

       // The message will be sent only if the current sending time falls within the range from 9:00 to 21:00 

       // if you specify 0, 0, in this case the message will be sent without taking into account the current time

       await tester.SendMsgToTelegramAsync("0000000001:ABCDabcd123ABCDabcd123ABCDabcd123ZX", "-123456789", "Text message", "UTF-8", 9, 21);

}

Created with the Personal Edition of HelpNDoc: Free iPhone documentation generator