Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.6.0] - 2026-08-17

### Added
- **Template-controlled SMS sending** (CLOUD-2885): optional `TemplateId` on `SMSCampaign`/`SMSRequest`, plus new `SMS.SendWithTemplateAsync()` and `SMS.SendSingleWithTemplateAsync()` methods for accounts that require a pre-approved template.

## [1.4.0] - 2025-09-03

### Added
Expand Down
26 changes: 23 additions & 3 deletions integration/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// .NET SDK integration tests — 52 tests
// .NET SDK integration tests — 54 tests
// Covers: SMS (1-6), MMS (7-17), Email (18-22), Webhook (23-29), Contact (30-31),
// Brands (32-36), Campaigns (37-42), ContactValidator (43-46), Negative cases (47-52)
// Brands (32-36), Campaigns (37-42), ContactValidator (43-46), Negative cases (47-52),
// SMS Templates (53-54)
//
// Test results use three states:
// PASS — the test ran and all assertions held
Expand Down Expand Up @@ -111,7 +112,7 @@ string WriteTempPng()
"CCAI_TEST_FIRST_NAME", "CCAI_TEST_LAST_NAME",
"CCAI_TEST_FIRST_NAME_2", "CCAI_TEST_LAST_NAME_2",
"CCAI_TEST_FIRST_NAME_3", "CCAI_TEST_LAST_NAME_3",
"WEBHOOK_URL",
"WEBHOOK_URL", "CCAI_TEST_TEMPLATE_ID",
];
var missing = requiredEnv.Where(k => string.IsNullOrEmpty(Environment.GetEnvironmentVariable(k))).ToList();
if (missing.Count > 0)
Expand All @@ -134,6 +135,7 @@ string WriteTempPng()
var ln2 = Environment.GetEnvironmentVariable("CCAI_TEST_LAST_NAME_2")!;
var fn3 = Environment.GetEnvironmentVariable("CCAI_TEST_FIRST_NAME_3")!;
var ln3 = Environment.GetEnvironmentVariable("CCAI_TEST_LAST_NAME_3")!;
var templateId = long.Parse(Environment.GetEnvironmentVariable("CCAI_TEST_TEMPLATE_ID")!);

// Unique per-run suffix so parallel SDK runs don't collide on the same webhook URL
var runId = $"dotnet-{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}";
Expand Down Expand Up @@ -823,6 +825,24 @@ await Run("52 PERMISSIVE: MMS.SendAsync with nonexistent fileKey (API accepts)",
"nonexistent fileKey accepted", ".NET Permissive 52");
AssertSmsResponse(resp);
});

Console.WriteLine("\n--- SMS Templates ---");

await Run("53 SMS.SendWithTemplateAsync", async () =>
{
var resp = await client.SMS.SendWithTemplateAsync(
[
new Account { FirstName = fn1, LastName = ln1, Phone = phone1 },
new Account { FirstName = fn2, LastName = ln2, Phone = phone2 },
], templateId, ".NET Template Test");
AssertSmsResponse(resp);
});

await Run("54 SMS.SendSingleWithTemplateAsync", async () =>
{
var resp = await client.SMS.SendSingleWithTemplateAsync(fn1, ln1, phone1, templateId, ".NET Single Template Test");
AssertSmsResponse(resp);
});
}
finally
{
Expand Down
2 changes: 1 addition & 1 deletion src/CCAI.NET/CCAI.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<PackageId>CloudContactAI.CCAI.NET</PackageId>
<Version>1.5.0</Version>
<Version>1.6.0</Version>
<Authors>CloudContactAI LLC</Authors>
<Company>CloudContactAI LLC</Company>
<Description>C# client for CloudContactAI API with SMS, MMS, Email, and Webhook support. Enhanced webhook support with new CloudContact event format, contact.unsubscribed events, environment variable configuration, and comprehensive examples.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/CCAI.NET/SMS/SMSService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public async Task<SMSResponse> SendAsync(SMSRequest request, CancellationToken c
throw new ArgumentException("At least one account is required", nameof(request.Accounts));
}

if (string.IsNullOrEmpty(request.Message))
if (string.IsNullOrEmpty(request.Message) && request.TemplateId is null)
{
throw new ArgumentException("Message is required", nameof(request.Message));
}
Expand Down