Cirreum.Runtime.Communications 1.0.28

dotnet add package Cirreum.Runtime.Communications --version 1.0.28
                    
NuGet\Install-Package Cirreum.Runtime.Communications -Version 1.0.28
                    
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="Cirreum.Runtime.Communications" Version="1.0.28" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cirreum.Runtime.Communications" Version="1.0.28" />
                    
Directory.Packages.props
<PackageReference Include="Cirreum.Runtime.Communications" />
                    
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 Cirreum.Runtime.Communications --version 1.0.28
                    
#r "nuget: Cirreum.Runtime.Communications, 1.0.28"
                    
#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 Cirreum.Runtime.Communications@1.0.28
                    
#: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=Cirreum.Runtime.Communications&version=1.0.28
                    
Install as a Cake Addin
#tool nuget:?package=Cirreum.Runtime.Communications&version=1.0.28
                    
Install as a Cake Tool

Cirreum.Runtime.Communications

NuGet Version NuGet Downloads GitHub Release License .NET

Unified communication services for modern .NET applications

Overview

Cirreum.Runtime.Communications provides a standardized approach to integrating email and SMS services into .NET applications. It offers provider-agnostic abstractions with built-in support for multiple providers: SendGrid and Azure Email Service for email, and Twilio and Azure SMS Service for SMS, including health checks, bulk operations, and Azure Key Vault integration.

Features

  • Multi-provider support - SendGrid and Azure Email Service for email, Twilio and Azure SMS Service for SMS
  • Named instances - Configure multiple instances of the same provider
  • Health checks - Built-in health check support with caching
  • Bulk operations - Efficient batch processing for mass communications
  • Azure Key Vault integration - Secure credential management
  • Sandbox mode - Safe testing in development environments
  • Retry policies - Configurable retry logic for resilience

Choosing a Provider

Email Providers

  • SendGrid - Best for high-volume transactional emails, marketing campaigns, and detailed analytics
  • Email.Azure - Ideal when already using Azure services, provides native Azure integration and compliance

SMS Providers

  • Twilio - Industry leader with global reach, programmable messaging, and extensive features
  • Sms.Azure - Perfect for Azure-centric applications, integrated billing, and compliance requirements

Prerequisites

The package includes the following provider SDKs:

  • SendGrid SDK (for SendGrid email)
  • Azure Communication Services SDK (for Email.Azure and Sms.Azure)
  • Twilio SDK (for Twilio SMS)

Getting Started

Installation

dotnet add package Cirreum.Runtime.Communications

Basic Usage

var builder = WebApplication.CreateBuilder(args);

// Add email and SMS services
builder.AddEmailServices()
       .AddSmsServices();

// Add health checks
builder.Services.AddHealthChecks()
    .AddCheck<EmailHealthCheck>("email-health")
    .AddCheck<SmsHealthCheck>("sms-health");

var app = builder.Build();

// Map health check endpoints
app.MapHealthChecks("/health");

// Inject and use default services
app.MapPost("/notify", async (IEmailService email, ISmsService sms) =>
{
    await email.SendAsync(new EmailMessage
    {
        To = "user@example.com",
        Subject = "Welcome!",
        Body = "Thanks for signing up."
    });
    
    await sms.SendAsync(new SmsMessage
    {
        To = "+1234567890",
        Body = "Your code is: 123456"
    });
});

// Use named instances (when multiple instances are configured)
app.MapPost("/marketing", async (IServiceProvider sp) =>
{
    var marketingEmail = sp.GetRequiredKeyedService<IEmailService>("marketing");
    var alertsSms = sp.GetRequiredKeyedService<ISmsService>("alerts");
    
    // Use specific instances for different purposes
});

Configuration

Add to your appsettings.json:

{
  "Cirreum": {
    "Communications": {
      "Providers": {
        "SendGrid": {
          "Instances": {
            "default": {
              "Name": "sendgrid-api-key",
              "MaxRetries": 3,
              "SandboxMode": false
            }
          }
        },
        "Email.Azure": {
          "Instances": {
            "default": {
              "Name": "azure-email-connection",
              "MaxRetries": 3
            }
          }
        },
        "Sms.Azure": {
          "Instances": {
            "default": {
              "Name": "azure-sms-connection",
              "From": "+1234567890",
              "MaxRetries": 3
            }
          }
        },
        "Twilio": {
          "Instances": {
            "default": {
              "Name": "twilio-connection",
              "From": "+1234567890",
              "MaxRetries": 3
            }
          }
        }
      }
    }
  }
}

Connection Strings

For development, add connection strings to your configuration:

{
  "ConnectionStrings": {
    "sendgrid-api-key": "SG.actual-api-key-here",
    "azure-email-connection": "endpoint=https://your-resource.communication.azure.com/;accesskey=your-key",
    "azure-sms-connection": "endpoint=https://your-resource.communication.azure.com/;accesskey=your-key",
    "twilio-connection": "AccountSid=AC...;AuthToken=your-auth-token"
  }
}

Azure Key Vault Integration

In production, the Name field in configuration maps to Key Vault secret names using the pattern ConnectionStrings--{Name}:

{
  "Cirreum": {
    "Communications": {
      "Providers": {
        "SendGrid": {
          "Instances": {
            "default": {
              "Name": "sendgrid-api-key"  // Maps to Key Vault secret: ConnectionStrings--sendgrid-api-key
            }
          }
        }
      }
    }
  }
}

Key Vault secret values (stored as JSON strings):

// Key Vault secret name: ConnectionStrings--sendgrid-api-key
{
  "ConnectionString": "SG.actual-api-key-here"
}

// Key Vault secret name: ConnectionStrings--azure-email-connection
{
  "ConnectionString": "endpoint=https://your-resource.communication.azure.com/;accesskey=your-key"
}

// Key Vault secret name: ConnectionStrings--twilio-connection
{
  "ConnectionString": "AccountSid=AC...;AuthToken=your-auth-token",
  "From": "+1234567890",
  "ServiceId": "IS..."  // Optional
}

// Key Vault secret name: ConnectionStrings--azure-sms-connection
{
  "ConnectionString": "endpoint=https://your-resource.communication.azure.com/;accesskey=your-key",
  "From": "+1234567890"
}

Advanced Usage

Bulk Operations

Send multiple messages efficiently:

var messages = GetEmailMessages(); // Your list of messages

await emailService.SendBulkAsync(messages, new BulkOptions 
{
    MaxBatchSize = 100,      // Process in batches of 100
    MaxConcurrency = 4       // Up to 4 parallel operations
});

Health Checks

Health checks are automatically registered and can be configured:

{
  "HealthOptions": {
    "IncludeInReadinessCheck": true,
    "TestEmailAddress": "health@example.com",
    "TestApiConnectivity": true,
    "CachedResultTimeout": "00:01:00"  // Cache results for 1 minute
  }
}

Multiple Named Instances

Configure multiple instances for different use cases:

{
  "SendGrid": {
    "Instances": {
      "transactional": {
        "Name": "sendgrid-transactional-key",
        "MaxRetries": 5
      },
      "marketing": {
        "Name": "sendgrid-marketing-key",
        "SandboxMode": false,
        "GlobalCategories": ["marketing", "campaigns"]
      }
    }
  }
}

Documentation

Contribution Guidelines

  1. Be conservative with new abstractions
    The API surface must remain stable and meaningful.

  2. Limit dependency expansion
    Only add foundational, version-stable dependencies.

  3. Favor additive, non-breaking changes
    Breaking changes ripple through the entire ecosystem.

  4. Include thorough unit tests
    All primitives and patterns should be independently testable.

  5. Document architectural decisions
    Context and reasoning should be clear for future maintainers.

  6. Follow .NET conventions
    Use established patterns from Microsoft.Extensions.* libraries.

Versioning

Cirreum.Runtime.Communications follows Semantic Versioning:

  • Major - Breaking API changes
  • Minor - New features, backward compatible
  • Patch - Bug fixes, backward compatible

License

This project is licensed under the MIT License - see the LICENSE file for details.


Cirreum Foundation Framework
Layered simplicity for modern .NET

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.0.28 44 8/4/2026
1.0.27 92 7/30/2026
1.0.26 95 7/20/2026
1.0.25 98 7/19/2026
1.0.24 110 7/9/2026
1.0.23 102 7/5/2026
1.0.22 116 5/10/2026
1.0.21 107 5/1/2026
1.0.20 116 4/28/2026
1.0.19 119 4/26/2026
1.0.18 129 4/15/2026
1.0.17 120 4/13/2026
1.0.16 125 4/10/2026
1.0.15 204 3/14/2026
1.0.14 149 3/13/2026
1.0.12 122 3/9/2026
1.0.11 130 2/5/2026
1.0.10 127 1/28/2026
1.0.9 126 1/21/2026
1.0.8 131 1/11/2026
Loading failed