Naty.Core
1.0.0-rc.1
dotnet add package Naty.Core --version 1.0.0-rc.1
NuGet\Install-Package Naty.Core -Version 1.0.0-rc.1
<PackageReference Include="Naty.Core" Version="1.0.0-rc.1" />
<PackageVersion Include="Naty.Core" Version="1.0.0-rc.1" />
<PackageReference Include="Naty.Core" />
paket add Naty.Core --version 1.0.0-rc.1
#r "nuget: Naty.Core, 1.0.0-rc.1"
#:package Naty.Core@1.0.0-rc.1
#addin nuget:?package=Naty.Core&version=1.0.0-rc.1&prerelease
#tool nuget:?package=Naty.Core&version=1.0.0-rc.1&prerelease
Naty.Core
Official .NET SDK for the Naty platform — a multi-channel corporate messaging system built on WhatsApp.
Naty.Core provides a strongly-typed, async-first HTTP client that wraps the Naty REST API (V2 and V3) with built-in retry logic, rate-limit handling, and transparent error mapping.
Table of Contents
Installation
dotnet add package Naty.Core
Or via the NuGet Package Manager:
Install-Package Naty.Core
Requirements: .NET Standard 2.0 compatible runtime (.NET 6+, .NET Framework 4.6.1+, .NET Core 2.0+).
Quick Start
Send a Message
using Naty.Core;
using Naty.Core.Enums;
using Naty.Core.Models;
var settings = new NatySettings
{
BaseUrl = "https://api.portal.naty.app",
JwtToken = "your-jwt-token-here"
};
// Use ApiVersion.V2 or ApiVersion.V3
var client = new NatyClient(ApiVersion.V3, settings);
// Send a single WhatsApp message
var response = await client.MessageService.SendAsync(new MessageRequest
{
WhatsappId = Guid.Parse("your-whatsapp-id"),
Number = "5511999999999",
Text = "Hello from Naty.Core!"
});
Console.WriteLine($"Message ID: {response.MessageId}");
Create and Start a Campaign
var campaign = await client.CampaignService.CreateAsync(new CampaignRequest
{
Name = "My First Campaign",
WhatsappId = Guid.Parse("your-whatsapp-id"),
Messages = new List<MessageRequestItem>
{
new MessageRequestItem { Number = "5511999999999", Text = "Hi there!" },
new MessageRequestItem { Number = "5511888888888", Text = "Hi there!" }
}
});
await client.CampaignService.StartAsync(campaign.Id);
Access V3 Services
// List open tickets
var tickets = await client.V3.Tickets.ListAsync(new TicketFilter
{
Status = TicketStatus.Open,
Page = 1,
Limit = 20
});
foreach (var ticket in tickets.Data)
Console.WriteLine($"[{ticket.Id}] {ticket.Subject}");
// Trigger a ChatFlow
await client.V3.ChatFlow.TriggerAsync(
chatFlowId: Guid.Parse("chatflow-guid"),
whatsappId: Guid.Parse("whatsapp-guid"),
number: "5511999999999"
);
Configuration
Instantiate NatySettings and pass it to the NatyClient constructor.
| Property | Type | Default | Description |
|---|---|---|---|
BaseUrl |
string |
— | Required. Absolute URL of the Naty API (e.g. https://api.naty.app). |
JwtToken |
string |
— | Required. Bearer token for API authentication. |
Retry |
int |
1 |
Number of retry attempts on transient failures. |
MinMsgInterval |
int (ms) |
3000 |
Minimum random delay between messages in a bulk send (milliseconds). |
MaxMsgInterval |
int (ms) |
9000 |
Maximum random delay between messages in a bulk send (milliseconds). Must be greater than MinMsgInterval. |
Settings are validated at construction time. Invalid values (e.g. bad URL, missing token,
MinMsgInterval >= MaxMsgInterval) throw immediately with a descriptive message.
Constructor Overloads
// Without logging
var client = new NatyClient(ApiVersion.V3, settings);
// With Microsoft.Extensions.Logging
ILoggerFactory loggerFactory = LoggerFactory.Create(b => b.AddConsole());
var client = new NatyClient(ApiVersion.V3, settings, loggerFactory);
API Reference
V2 Services
Accessed via the top-level INatyClient properties.
| Property | Interface | Key Methods |
|---|---|---|
client.MessageService |
IMessageService |
SendAsync, BulkSendAsync |
client.CampaignService |
ICampaignService |
CreateAsync, CreateInstantlyAsync, GetSummaryAsync, StartAsync, SuspendAsync, DeleteAsync |
client.ChannelService |
IChannelService |
ListAsync |
client.QueueService |
IQueueService |
ListAsync |
client.UserService |
IUserService |
ListAsync |
client.WhatsappService |
IWhatsappService |
ListAsync, StartConnectionAsync |
Every method has an overload that accepts IRequestOptions for per-call customization (e.g. custom timeout or headers).
V3 Services
Accessed via client.V3.*.
| Property | Interface | Key Methods |
|---|---|---|
client.V3.Messages |
IMessageServiceV3 |
SendAsync |
client.V3.Campaigns |
ICampaignServiceV3 |
ListAsync, GetAsync, CreateAsync, CreateInstantAsync, SuspendAsync, ResumeAsync, DeleteAsync |
client.V3.Tickets |
ITicketService |
ListAsync, GetAsync, CreateAsync, PatchAsync, ListMessagesAsync |
client.V3.Contacts |
IContactService |
ListAsync, GetAsync, CreateAsync, UpdateAsync, PatchAsync, DeleteAsync |
client.V3.Connections |
IConnectionService |
ListAsync, GetAsync, RestartAsync |
client.V3.Channels |
IChannelServiceV3 |
ListAsync, GetAsync |
client.V3.Queues |
IQueueServiceV3 |
ListAsync, GetAsync |
client.V3.Users |
IUserServiceV3 |
ListAsync, GetAsync |
client.V3.Tags |
ITagService |
ListAsync, CreateAsync, UpdateAsync, DeleteAsync |
client.V3.Medias |
IMediaService |
UploadAsync, GetAsync, DeleteAsync |
client.V3.Webhooks |
IWebhookService |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync, TestAsync |
client.V3.ChatFlow |
IChatFlowService |
TriggerAsync |
client.V3.Usage |
IUsageService |
GetAsync |
Exception Handling
| Exception | When thrown |
|---|---|
MaxRequestPerHourException |
Hourly API rate limit exceeded. Contains Limit, Remaining, and Reset (UTC DateTime). |
NatyApiV3Exception |
V3 API returned an error response. Contains StatusCode, RequestId, and ApiMessage. |
try
{
await client.MessageService.SendAsync(request);
}
catch (MaxRequestPerHourException ex)
{
Console.WriteLine($"Rate limit hit. Resets at {ex.Reset:u}. Limit: {ex.Limit}");
}
catch (NatyApiV3Exception ex)
{
Console.WriteLine($"API error [{ex.StatusCode}] {ex.ApiMessage} (requestId: {ex.RequestId})");
}
Error code constants are available in ErrorCodes:
// ErrorCodes.ERR_MAX_REQUEST_PER_HOUR
// ErrorCodes.ERR_SLOW_DOWN
Logging
Pass an ILoggerFactory to enable structured logging inside the SDK:
using Microsoft.Extensions.Logging;
var loggerFactory = LoggerFactory.Create(builder =>
builder.AddConsole().SetMinimumLevel(LogLevel.Debug));
var client = new NatyClient(ApiVersion.V3, settings, loggerFactory);
The SDK logs HTTP requests, retries, and rate-limit events at Debug / Warning levels.
License
This project is licensed under the MIT License.
© 2026 NatyApp
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- System.Text.Json (>= 10.0.9)
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.0.0-rc.1 | 96 | 6/29/2026 |
Release 1.0.0-rc.1