Wazen 0.2.0
dotnet add package Wazen --version 0.2.0
NuGet\Install-Package Wazen -Version 0.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="Wazen" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wazen" Version="0.2.0" />
<PackageReference Include="Wazen" />
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 Wazen --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Wazen, 0.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 Wazen@0.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=Wazen&version=0.2.0
#tool nuget:?package=Wazen&version=0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Wazen .NET SDK
Official .NET SDK for the Wazen WhatsApp API.
Installation
dotnet add package Wazen
Install-Package Wazen
Quick Start
using Wazen;
var wazen = new WazenClient("wz_your_api_key");
// Send a message
var message = await wazen.Messages.SendAsync("session-id", new SendMessageRequest
{
To = "+1234567890",
Type = MessageType.Text,
Content = "Hello from Wazen!"
});
// List sessions
var sessions = await wazen.Sessions.ListAsync();
// Check if a number is on WhatsApp
var result = await wazen.Contacts.CheckAsync("session-id", new CheckContactRequest
{
Phone = "+1234567890"
});
Resources
All resources are accessible as properties on the client instance.
Sessions
await wazen.Sessions.CreateAsync();
await wazen.Sessions.ListAsync();
await wazen.Sessions.GetAsync("session-id");
await wazen.Sessions.DeleteAsync("session-id");
await wazen.Sessions.RestartAsync("session-id");
await wazen.Sessions.GetQrAsync("session-id");
await wazen.Sessions.FactoryResetAsync("session-id");
Messages
// Send text
await wazen.Messages.SendAsync("session-id", new SendMessageRequest
{
To = "+1234567890",
Type = MessageType.Text,
Content = "Hello!"
});
// Send image
await wazen.Messages.SendAsync("session-id", new SendMessageRequest
{
To = "+1234567890",
Type = MessageType.Image,
MediaUrl = "https://example.com/photo.jpg"
});
// Get message history
await wazen.Messages.ListAsync("session-id", new ListMessagesQuery
{
Direction = "outgoing",
Limit = 10
});
// Get single message
await wazen.Messages.GetAsync("session-id", "message-id");
Groups
await wazen.Groups.ListAsync("session-id");
await wazen.Groups.CreateAsync("session-id", new CreateGroupRequest
{
Subject = "Team Chat",
Participants = new[] { "+1234567890" }
});
await wazen.Groups.GetAsync("session-id", "group-id");
await wazen.Groups.UpdateAsync("session-id", "group-id", new UpdateGroupRequest
{
Subject = "New Name"
});
await wazen.Groups.LeaveAsync("session-id", "group-id");
await wazen.Groups.ManageParticipantsAsync("session-id", "group-id", new ManageParticipantsRequest
{
Action = ParticipantAction.Add,
Participants = new[] { "+0987654321" }
});
await wazen.Groups.SendMessageAsync("session-id", "group-id", new SendGroupMessageRequest
{
Type = MessageType.Text,
Content = "Hello group!"
});
Channels
await wazen.Channels.CreateAsync("session-id", new CreateChannelRequest
{
Name = "Product Updates",
Description = "Latest news"
});
await wazen.Channels.SendMessageAsync("session-id", "channel-id", new SendChannelMessageRequest
{
Type = MessageType.Text,
Content = "New release!"
});
Contacts
// Check single number
await wazen.Contacts.CheckAsync("session-id", new CheckContactRequest
{
Phone = "+1234567890"
});
// Bulk check
await wazen.Contacts.BulkCheckAsync("session-id", new BulkCheckRequest
{
Phones = new[] { "+1234567890", "+0987654321" }
});
Warming
await wazen.Warming.StartAsync("session-id", new StartWarmingRequest
{
Contacts = new[]
{
new WarmingContact { Phone = "+1234567890", Name = "Alice" },
new WarmingContact { Phone = "+0987654321" }
}
});
await wazen.Warming.GetStatusAsync("session-id");
await wazen.Warming.PauseAsync("session-id");
await wazen.Warming.ResumeAsync("session-id");
await wazen.Warming.CancelAsync("session-id");
Webhooks
await wazen.Webhooks.CreateAsync(new CreateWebhookRequest
{
Url = "https://your-app.com/webhooks/wazen",
Events = new[] { WebhookEvent.MessageReceived, WebhookEvent.MessageDelivered }
});
await wazen.Webhooks.ListAsync();
await wazen.Webhooks.UpdateAsync("webhook-id", new UpdateWebhookRequest { Enabled = false });
await wazen.Webhooks.DeleteAsync("webhook-id");
await wazen.Webhooks.TestAsync("webhook-id");
await wazen.Webhooks.GetLogsAsync("webhook-id");
Account
var account = await wazen.Account.GetAsync();
var usage = await wazen.Account.GetUsageAsync();
API Keys
var key = await wazen.ApiKeys.CreateAsync(new CreateApiKeyRequest { Name = "new-key" });
await wazen.ApiKeys.ListAsync();
await wazen.ApiKeys.RevokeAsync("key-id");
Configuration
var wazen = new WazenClient("wz_your_api_key", new WazenClientOptions
{
BaseUrl = "https://wazen.dev/api/v1", // default
Timeout = TimeSpan.FromSeconds(30) // default
});
Error Handling
using Wazen;
using Wazen.Exceptions;
try
{
await wazen.Messages.SendAsync("session-id", new SendMessageRequest
{
To = "+1234567890",
Type = MessageType.Text,
Content = "Hi"
});
}
catch (WazenApiException ex)
{
Console.WriteLine(ex.StatusCode); // HTTP status code
Console.WriteLine(ex.ErrorCode); // API error code
Console.WriteLine(ex.Message); // Error message
}
Requirements
- .NET 8.0 or later
- A Wazen account with an active subscription
- An API key from your Dashboard
Links
License
MIT
| 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 was computed. 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.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.