NetTelegramBotApi 7.0.0

dotnet add package NetTelegramBotApi --version 7.0.0
                    
NuGet\Install-Package NetTelegramBotApi -Version 7.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetTelegramBotApi" Version="7.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetTelegramBotApi" Version="7.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NetTelegramBotApi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NetTelegramBotApi --version 7.0.0
                    
#r "nuget: NetTelegramBotApi, 7.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NetTelegramBotApi@7.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NetTelegramBotApi&version=7.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NetTelegramBotApi&version=7.0.0
                    
Install as a Cake Tool

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.

NuGet .NET 9.0 .NET 8.0 MIT License

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 (BusinessConnectionIdbusiness_connection_id);
  • DateTimeOffset [de]serialization of unix-time fields;
  • use IntegerOrString type for number-or-string fields (like chat_id);
  • use InputFile or InputFileOrString types for requests with files (don't forget to pass withFiles: true to RequestBase, check SetWebhook for example);

Installation

Use NuGet package NetTelegramBotApi.

Dependencies

Only System.Text.Json.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.