TCN.NET
0.1.0
dotnet add package TCN.NET --version 0.1.0
NuGet\Install-Package TCN.NET -Version 0.1.0
<PackageReference Include="TCN.NET" Version="0.1.0" />
<PackageVersion Include="TCN.NET" Version="0.1.0" />
<PackageReference Include="TCN.NET" />
paket add TCN.NET --version 0.1.0
#r "nuget: TCN.NET, 0.1.0"
#:package TCN.NET@0.1.0
#addin nuget:?package=TCN.NET&version=0.1.0
#tool nuget:?package=TCN.NET&version=0.1.0
TCN.NET
A modern .NET SDK for the TCN API, providing a type-safe, production-ready client library with built-in resilience policies and source-generated JSON serialization.
Features
- Modern .NET: Multi-targets .NET 9.0 and .NET 10.0
- Resilience: Built-in retry policies and circuit breaker with Polly
- Performance: System.Text.Json source generation for optimal performance
- Type-Safe: Fully typed API with comprehensive models
- Well-Tested: High test coverage with xUnit
- Easy Integration: Seamless dependency injection support
- Real-Time Streaming: IAsyncEnumerable support for agent and caller event monitoring
Installation
dotnet add package TCN.NET
Or via Package Manager Console:
Install-Package TCN.NET
Quick Start
Authentication
TCN.NET supports two authentication mechanisms based on API type:
using TCN.NET;
using TCN.NET.Authentication;
// OAuth 2.0 Authentication (NEW API - LMS, Compliance, Streaming)
var tokenManager = new OAuth2TokenManager(
clientId: "your-client-id",
clientSecret: "your-client-secret",
tokenUrl: "https://auth.tcn.com/token"
);
services.AddTcnClient(options =>
{
options.BaseUrl = "https://api.cbf.tcn.com";
options.AuthenticationProvider = new BearerTokenAuthenticationProvider(tokenManager);
});
// Access Token Authentication (Legacy API - P3_TCN)
services.AddTcnClient(options =>
{
options.LegacyBaseUrl = "https://api.tcnp3.com";
options.LegacyAccessToken = "your-access-token";
});
Legacy API - Contact Upload & Campaign Scheduling
// Upload contacts and schedule a campaign via FtpReceptionServlet
var response = await client.Legacy.UploadContactsAndScheduleCampaignAsync(
new FtpReceptionRequest
{
AccessToken = "your-token",
Description = "Q1 Campaign",
Country = "United States / Canada",
StartTime = DateTime.Now.AddHours(1),
Contacts = contactList
});
Console.WriteLine($"Campaign scheduled: {response.CampaignId}");
LMS - List Management Service
// Process a contact list through the LMS pipeline
await client.LMS.Lists.ProcessListAsync(elementId, new ProcessListRequest
{
List = Convert.ToBase64String(csvBytes)
});
// Create a file template for parsing rules
var template = await client.LMS.FileTemplates.CreateAsync(new FileTemplateRequest
{
Name = "Contact CSV Template",
Delimiter = ",",
Columns = columnDefinitions
});
// Monitor list processing events
await foreach (var evt in client.LMS.Events.StreamEventsAsync(elementId, cancellationToken))
{
Console.WriteLine($"Event: {evt.Type} - {evt.Message}");
}
Compliance - Do Not Contact Management
// Add entries to a scrub list (Do Not Contact)
var result = await client.Compliance.AddScrubListEntriesAsync(
new AddScrubListEntriesRequest
{
ListId = "scrub-list-id",
ContentType = ContentType.CT_PHONE_NUMBER,
CountryCode = "1",
ScrubEntryDetails = new[]
{
new ScrubEntryDetail { Content = "5551234567" },
new ScrubEntryDetail { Content = "5559876543" }
}
});
Console.WriteLine($"Added {result.EntriesAdded} DNC entries");
Streaming - Real-Time Agent & Caller Monitoring
// Monitor an individual agent session with voice events
await foreach (var evt in client.Streaming.FollowAgentAsync(userId, cancellationToken))
{
switch (evt)
{
case AgentStateChangeEvent state:
Console.WriteLine($"Agent state changed: {state.NewState}");
break;
case AgentVoiceStartEvent voice:
Console.WriteLine($"Voice started - SIP: {voice.SipDialUrl}");
break;
case AgentVoiceEndEvent:
Console.WriteLine("Voice ended");
break;
}
}
// Organization-wide agent state monitoring
await foreach (var evt in client.Streaming.StreamAgentEventsAsync(cancellationToken))
{
Console.WriteLine($"Agent {evt.AgentId}: {evt.State}");
}
// Manager dashboard - all agent states
await foreach (var state in client.Streaming.ManagerStreamAgentStateAsync(cancellationToken))
{
Console.WriteLine($"Dashboard update: {state.TotalAgents} agents, {state.ActiveCalls} calls");
}
// Caller activity monitoring
await foreach (var evt in client.Streaming.StreamCallerEventsAsync(cancellationToken))
{
Console.WriteLine($"Caller {evt.CallerId}: {evt.EventType}");
}
Dependency Injection
using Microsoft.Extensions.DependencyInjection;
using TCN.NET;
var services = new ServiceCollection();
services.AddTcnClient(options =>
{
options.BaseUrl = "https://api.cbf.tcn.com";
options.AuthenticationProvider = new BearerTokenAuthenticationProvider(tokenManager);
options.Timeout = TimeSpan.FromSeconds(30);
});
var serviceProvider = services.BuildServiceProvider();
var tcnClient = serviceProvider.GetRequiredService<ITcnClient>();
Configuration
Client Options
var client = new TcnClient(options =>
{
// NEW API (OAuth 2.0)
options.BaseUrl = "https://api.cbf.tcn.com";
options.AuthenticationProvider = new BearerTokenAuthenticationProvider(tokenManager);
// Legacy API (Access Token)
options.LegacyBaseUrl = "https://api.tcnp3.com";
options.LegacyAccessToken = "your-access-token";
// Optional: Timeout (default: 30 seconds)
options.Timeout = TimeSpan.FromSeconds(60);
// Optional: Retry configuration
options.MaxRetryAttempts = 3;
options.RetryDelaySeconds = 2;
});
API Coverage
Current (v0.1.x - MVP)
Data Ingestion:
- Legacy API: FtpReceptionServlet - Contact upload + campaign scheduling (backward compatibility)
- LMS Operations: List processing (ProcessList, StreamList), FileTemplate CRUD, Element CRUD, Event monitoring
Compliance:
- Compliance: AddScrubListEntries - Do Not Contact list management
Real-Time Monitoring:
- Streaming: FollowAgent, StreamAgentEvents, ManagerStreamAgentState, StreamCallerEvents
Roadmap (v0.2.x)
- Campaign Operations: OmniApi campaign management
- Report Operations: Ana/P3Api reporting and analytics
Requirements
- .NET 9.0 or .NET 10.0
- C# 12 or higher (LangVersion: latest)
Dependencies
- RestSharp - HTTP client
- Polly - Resilience and transient fault handling
- Microsoft.Extensions.DependencyInjection.Abstractions - DI support
- Microsoft.Extensions.Options - Configuration binding
Documentation
Support
For issues, questions, or contributions:
- Issues: GitHub Issues
- Documentation: TCN API Docs
License
This project is licensed under the MIT License - see the LICENSE file for details.
About
Developed and maintained by Spire Recovery Solutions.
Note: This SDK is in active development. The API surface may change between v0.1.x releases. Version 1.0.0 will mark the first stable release with semantic versioning guarantees.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Polly (>= 8.6.3)
- RestSharp (>= 112.1.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Polly (>= 8.6.3)
- RestSharp (>= 112.1.0)
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 |
|---|