🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

Waha

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Waha

Package Description

1.0.1
NuGet
Version published
Maintainers
1
Created
Source

.NET language OS GitHub release Build & Publish NuGet to GitHub Registry

⭐ Star us on GitHub — it motivates us a lot!

Waha Net

A .NET C# Library for WAHA (WhatsApp HTTP API)

Installation

To install the Waha library, run the following command in your .NET project:

dotnet add package Waha

Usage

Below is a short example showing how to integrate Waha into your .NET projects to retrieve WhatsApp chats, once the session is started and the QR has been validated.

ASP .NET

using Waha;

var builder = WebApplication.CreateBuilder(args);

//This method will look for "Waha" settings configuration section or connectionstring in your appsettings.json
//It also will use Waha default endpoint value ("localhost:3000") if can´t find a valid configuration
builder.AddWahaApiClient("Waha");

var app = builder.Build();
app.MapDefaultEndpoints();

app.MapGet("/chats", async (
  IWahaApiClient wahaApiClient, CancellationToken cancellationToken,
  [FromHeader] int limit = 5, [FromHeader] int offset = 0, [FromHeader] string sortBy = "", [FromHeader] string sortOrder = "")
{
  var sessions = await wahaApiClient.GetSessionsAsync(true, cancellationToken);
  var session = sessions.FirstOrDefault();
  if (session == null)
  {
      return Results.Json(new { Message = "No active session found." }, statusCode: StatusCodes.Status412PreconditionFailed);
  }
  var chats = await wahaApiClient.GetChatsAsync(session.Name, limit, offset, sortBy, sortOrder, cancellationToken);
  return Results.Ok(chats);
}).WithName("GetChats");

OTHERS APPS

using Waha;

var wahaApiClient = new WahaApiClient(new HttpClient() { BaseAddress = WahaSettings.Default.Endpoint });
var sessions = await wahaApiClient.GetSessionsAsync(true, cancellationToken);
var session = sessions.FirstOrDefault();
if (session != null)
{
    var chats = await wahaApiClient.GetChatsAsync(session.Name, 10, 0, "", "", null);
    // Process the chats as needed...
}

Contributing

We welcome and appreciate contributions from the community. You can open a pull request or report issues through our GitHub Issues. Please review our contribution guidelines for details on coding standards and development practices.

Feedback & Support

For any questions, issues, or ideas, feel free to reach out via:

  • GitHub Issues

Your feedback helps us make Waha library even better!

Keywords

waha

FAQs

Package last updated on 25 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts