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
IntegerOrString
type for number-or-string fields (likechat_id
); - use
InputFile
orInputFileOrString
types for requests with files (don't forget to passwithFiles: true
toRequestBase
, checkSetWebhook
for 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 | 92 | 8/19/2025 |
7.0.0-alpha.3 | 219 | 10/25/2024 |
7.0.0-alpha.2 | 86 | 10/25/2024 |
7.0.0-alpha.1 | 84 | 10/25/2024 |
6.0.1 | 461 | 10/23/2024 |
5.4.1 | 514 | 7/8/2024 |
5.4.0 | 158 | 7/8/2024 |
5.3.0 | 2,614 | 7/26/2023 |
5.2.0 | 1,970 | 2/14/2023 |
5.1.0 | 668 | 2/3/2023 |
5.0.0 | 3,082 | 5/26/2021 |
4.2.0 | 8,807 | 12/15/2017 |
4.1.0 | 5,420 | 3/14/2017 |
4.0.0 | 3,340 | 11/25/2016 |
3.8.1 | 4,054 | 7/17/2016 |
3.7.50926 | 3,465 | 9/25/2015 |
3.6.50925 | 2,797 | 9/25/2015 |
3.5.50818 | 1,991 | 8/18/2015 |
3.5.50816 | 1,462 | 8/15/2015 |
3.4.50815 | 1,435 | 8/15/2015 |
3.3.50701 | 1,552 | 7/1/2015 |
3.2.50628 | 1,471 | 6/28/2015 |
2.1.50626 | 1,483 | 6/26/2015 |
See GitHub releases.