NetTelegramBotApi 7.0.0
dotnet add package NetTelegramBotApi --version 7.0.0
NuGet\Install-Package NetTelegramBotApi -Version 7.0.0
<PackageReference Include="NetTelegramBotApi" Version="7.0.0" />
<PackageVersion Include="NetTelegramBotApi" Version="7.0.0" />
<PackageReference Include="NetTelegramBotApi" />
paket add NetTelegramBotApi --version 7.0.0
#r "nuget: NetTelegramBotApi, 7.0.0"
#:package NetTelegramBotApi@7.0.0
#addin nuget:?package=NetTelegramBotApi&version=7.0.0
#tool nuget:?package=NetTelegramBotApi&version=7.0.0
NetTelegramBotApi
C# client library for building Telegram bots (https://core.telegram.org/bots/api).
Contains strongly-typed request and response classes, and transport class for sending requests and receiving results. Uses System.Text.Json only.
Usage
var bot = new TelegramBot(accessToken, new HttpClient());
var me = await bot.GetMe();
if (me != null)
{
Console.WriteLine("Me: {0} (@{1})", me.FirstName, me.Username);
}
See TelegramBotDemo project for more samples.
Use with AddHttpClient<TelegramBot>(...) in web projects, use Polly (or any other you like) to handle transient faults and improve the resilience.
Extensibility
Just describe new request (or data) class:
public class PinChatMessage() : RequestBase<bool>("pinChatMessage")
{
public string? BusinessConnectionId { get; set; }
public required IntegerOrString ChatId { get; set; }
public required long MessageId { get; set; }
public bool? DisableNotification { get; set; }
}
This works out-of-the-box:
- snake_case property naming (
BusinessConnectionId→business_connection_id); DateTimeOffset[de]serialization of unix-time fields;- use
IntegerOrStringtype for number-or-string fields (likechat_id); - use
InputFileorInputFileOrStringtypes for requests with files (don't forget to passwithFiles: truetoRequestBase, checkSetWebhookfor example);
Installation
Use NuGet package NetTelegramBotApi.
Dependencies
Only System.Text.Json.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- System.Text.Json (>= 8.0.6)
-
net9.0
- System.Text.Json (>= 9.0.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NetTelegramBotApi:
| Package | Downloads |
|---|---|
|
NetTelegramBot.Framework
Simple framework for building Telegram bots. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on NetTelegramBotApi:
| Repository | Stars |
|---|---|
|
Lunat1q/Catchem-PoGo
Project is DEAD, Discord server: https://discord.me/Catchem
|
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.0 | 256 | 8/19/2025 |
| 7.0.0-alpha.3 | 221 | 10/25/2024 |
| 7.0.0-alpha.2 | 97 | 10/25/2024 |
| 7.0.0-alpha.1 | 96 | 10/25/2024 |
| 6.0.1 | 527 | 10/23/2024 |
| 5.4.1 | 550 | 7/8/2024 |
| 5.4.0 | 212 | 7/8/2024 |
| 5.3.0 | 2,702 | 7/26/2023 |
| 5.2.0 | 2,003 | 2/14/2023 |
| 5.1.0 | 752 | 2/3/2023 |
| 5.0.0 | 3,173 | 5/26/2021 |
| 4.2.0 | 8,985 | 12/15/2017 |
| 4.1.0 | 5,611 | 3/14/2017 |
| 4.0.0 | 3,442 | 11/25/2016 |
| 3.8.1 | 4,162 | 7/17/2016 |
| 3.7.50926 | 3,540 | 9/25/2015 |
| 3.6.50925 | 2,939 | 9/25/2015 |
| 3.5.50818 | 2,073 | 8/18/2015 |
| 3.5.50816 | 1,522 | 8/15/2015 |
| 3.4.50815 | 1,497 | 8/15/2015 |
| 3.3.50701 | 1,617 | 7/1/2015 |
| 3.2.50628 | 1,547 | 6/28/2015 |
| 2.1.50626 | 1,550 | 6/26/2015 |
See GitHub releases.