Baileys.NET 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Baileys.NET --version 1.2.0
                    
NuGet\Install-Package Baileys.NET -Version 1.2.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="Baileys.NET" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Baileys.NET" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Baileys.NET" />
                    
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 Baileys.NET --version 1.2.0
                    
#r "nuget: Baileys.NET, 1.2.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 Baileys.NET@1.2.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=Baileys.NET&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Baileys.NET&version=1.2.0
                    
Install as a Cake Tool

Baileys — WhatsApp Web Library for .NET 10

NuGet License: MIT .NET 10

A .NET 10 port of the Baileys TypeScript library for interacting with the WhatsApp Web API.

Installation

dotnet add package Baileys.NET

Or via the NuGet Package Manager:

Install-Package Baileys.NET

Documentation

Full documentation is available in the docs/ folder:

Guide Description
Getting Started Installation, quick start, first session
Dependency Injection ASP.NET Core / Worker Service integration
Session Storage InMemory, File, and custom DB providers
Cryptography AES-GCM/CBC/CTR, HMAC, HKDF, PBKDF2
JID Utilities Encode, decode, classify JIDs
Auth Utilities Credential init, key generation
WABinary Codec Binary node encoding / decoding
Types Reference All WhatsApp domain types
Events Reference Event payload types
Defaults & Constants Protocol constants, browser presets

Features

  • Binary Protocol Codec — Encode and decode the WhatsApp binary node wire format (WABinary), including zlib decompression
  • Cryptographic Utilities — AES-256-GCM/CBC/CTR, HMAC-SHA-256/512, SHA-256/MD5, HKDF, PBKDF2 — all via System.Security.Cryptography (no third-party deps)
  • JID Utilities — Encode, decode, normalise, and classify JIDs (user, group, broadcast, newsletter, LID, hosted)
  • Auth UtilitiesInitAuthCreds(), Curve25519 key-pair generation, signed pre-key generation
  • Noise Protocol Handler — Noise_XX_25519_AESGCM_SHA256 handshake state machine
  • Complete Type Definitions — All WhatsApp types: Contact, Chat, GroupMetadata, Message, Call, Label, Newsletter, Business, Product, State, Event payloads
  • Default Constants — WebSocket URL, noise-protocol constants, media HKDF key mappings, browser description presets, timing defaults
  • Structured LoggingILogger interface + NullLogger and ConsoleLogger implementations
  • Dependency InjectionAddBaileys(), AddBaileysWithFileStorage(), AddBaileysWithProvider<T>() helpers
  • Pluggable Session StorageIAuthStateProvider interface with in-memory and file-based implementations

Quick Start

using Baileys.Types;
using Baileys.Utils;
using Baileys.WABinary;
using Baileys.Defaults;
using Baileys.Extensions;

// ── Dependency injection (Program.cs) ────────────────────────────────────────
builder.Services.AddBaileys(o => o.PhoneNumber = "15551234567");
// or persist to a JSON file:
builder.Services.AddBaileysWithFileStorage("creds.json", o => o.PhoneNumber = "15551234567");

// ── Credential initialisation ─────────────────────────────────────────────────
var creds = AuthUtils.InitAuthCreds();
Console.WriteLine($"Registration ID: {creds.RegistrationId}");

// ── JID utilities ─────────────────────────────────────────────────────────────
var jid     = JidUtils.JidDecode("123456789@s.whatsapp.net");
var isGroup = JidUtils.IsJidGroup("120363000000001@g.us");    // true

// ── Crypto ────────────────────────────────────────────────────────────────────
var key = Crypto.RandomBytes(32);
var iv  = Crypto.RandomBytes(12);
var ct  = Crypto.AesEncryptGcm("Hello WhatsApp!"u8, key, iv, ReadOnlySpan<byte>.Empty);
var pt  = Crypto.AesDecryptGcm(ct, key, iv, ReadOnlySpan<byte>.Empty);

// ── WABinary round-trip ───────────────────────────────────────────────────────
var node    = new BinaryNode { Tag = "iq", Attrs = new() { ["type"] = "get" } };
var wire    = WaBinaryEncoder.EncodeBinaryNode(node);
var decoded = await WaBinaryDecoder.DecodeBinaryNodeAsync(wire);

// ── Browser description ───────────────────────────────────────────────────────
var browser = Browsers.MacOs("Chrome");   // ["Mac OS", "Chrome", "14.4.1"]

Namespace Map

Namespace Contents
Baileys.Types All domain types and enums
Baileys.Utils Crypto, JidUtils, AuthUtils, Generics, NoiseHandler, ILogger
Baileys.WABinary WaBinaryEncoder, WaBinaryDecoder, WaBinaryConstants
Baileys.Defaults BaileysDefaults, Browsers
Baileys.Options BaileysOptions
Baileys.Session IAuthStateProvider, InMemoryAuthStateProvider, FileAuthStateProvider
Baileys.Extensions ServiceCollectionExtensions

Requirements

  • .NET 10+
  • Runtime NuGet dependencies: Microsoft.Extensions.DependencyInjection.Abstractions and Microsoft.Extensions.Options

License

MIT — see LICENSE

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.9.1 227 4/25/2026
1.9.0 140 4/24/2026
1.8.0 177 4/10/2026
1.7.0 184 3/16/2026
1.6.0 130 3/15/2026
1.5.0 124 3/14/2026
1.4.0 167 3/13/2026
1.3.0 124 3/13/2026
1.2.0 125 3/13/2026
1.1.1 148 3/11/2026
1.1.0 120 3/11/2026
1.0.0 120 3/11/2026