Class library written in dotnet standard for sending messages to telegram chats using a bot
Package Manager: Install-Package DotNetStandard-Telegram
.Net CLI: dotnet add package DotNetStandard-Telegram
Initliase a new instance of the service as follows, provided a bot api key and a group id - Telegram bot docs
DotNetStandard_Telegram.Telegram telegram = new Telegram("BotAPIKey", "ChatId");
The method to send a message is called 'sendMessage'. There are three possible ways of using this...
-
Sending just a message:
telegram.sendMessage("message to send");
-
Sending a message with a source string, useful for when messages are being sent from multiple applications:
telegram.sendMessage("message to send", "message source");
-
Sending a message with a source string and a severity, useful for alerting of errors:
telegram.sendMessage("message to send", "message source", DotNetStandard_Telegram.Telegram.Severity.Information);
There are three possible states for severity:
- DotNetStandard_Telegram.Telegram.Severity.Information
- DotNetStandard_Telegram.Telegram.Severity.Trace
- DotNetStandard_Telegram.Telegram.Severity.Error