Sinch.Functions.Runtime
0.3.12
dotnet add package Sinch.Functions.Runtime --version 0.3.12
NuGet\Install-Package Sinch.Functions.Runtime -Version 0.3.12
<PackageReference Include="Sinch.Functions.Runtime" Version="0.3.12" />
<PackageVersion Include="Sinch.Functions.Runtime" Version="0.3.12" />
<PackageReference Include="Sinch.Functions.Runtime" />
paket add Sinch.Functions.Runtime --version 0.3.12
#r "nuget: Sinch.Functions.Runtime, 0.3.12"
#:package Sinch.Functions.Runtime@0.3.12
#addin nuget:?package=Sinch.Functions.Runtime&version=0.3.12
#tool nuget:?package=Sinch.Functions.Runtime&version=0.3.12
Sinch.Functions.Runtime
Development runtime for Sinch Functions - build serverless communication workflows with ease.
Getting Started
The easiest way to get started is using the Sinch CLI:
# Install the CLI
npm install -g @sinch/cli
# Create a new function (interactive)
sinch functions init
The interactive prompt will guide you through:
- Selecting a runtime (Node.js, C#, etc.)
- Choosing a template (simple-voice-ivr recommended for first project)
- Setting up your project
Then start the local development server:
sinch functions dev
Your function is now running locally with hot reload!
Deploy to Production
When you're ready to deploy:
sinch functions deploy
Your function will be built and deployed to the Sinch Functions platform.
Features
Voice API
- SinchVoiceController - Base controller for voice callbacks (ICE, PIE, ACE, DICE)
- SVAML Builders - Fluent API for building voice responses (
IceSvamletBuilder,PieSvamletBuilder) - Menu Utilities - IVR menu builders (
MenuFactory.CreateMenu()) - Voice Helpers - TTS, audio playback, and call control utilities
- Webhook Validation - HMAC signature validation for Voice API callbacks
Conversation API
- SinchConversationController - Base controller for omnichannel messaging (SMS, WhatsApp, Messenger, Viber)
- Message Builders - Static helpers and fluent builder for messages
- Extension Methods - Easy access to inbound message properties
- Multi-Channel Support - Automatic SMS_SENDER handling, channel-specific configurations
- Webhook Routing - Automatic routing to typed handlers
Infrastructure
- FunctionContext - Pre-configured SDK clients, caching, logging
- Local Development - In-memory caching, tunnel support for local debugging
- SDK Integration - Pre-configured Sinch SDK clients for Voice and Conversation APIs
Voice IVR Example
using SinchFunctions.Utils;
public class FunctionController : SinchVoiceController
{
public FunctionController(FunctionContext context, IConfiguration configuration, ILogger<FunctionController> logger)
: base(context, configuration, logger) { }
public override async Task<IActionResult> Ice([FromBody] IceCallbackModel callbackData)
{
// Create a voice menu
var menu = MenuFactory.CreateMenu()
.Prompt("Welcome to Sinch! Press 1 for sales, 2 for support.")
.Option("1", "return(sales)")
.Option("2", "return(support)")
.Build();
// Return SVAML response
return Ok(new IceSvamletBuilder()
.Action.RunMenu(menu)
.Build());
}
public override async Task<IActionResult> Pie([FromBody] PieCallbackModel callbackData)
{
var selection = callbackData.MenuResult?.Value;
return selection switch
{
"sales" => Ok(new PieSvamletBuilder().Action.ConnectPstn("+15551234567").Build()),
"support" => Ok(new PieSvamletBuilder().Action.ConnectPstn("+15559876543").Build()),
_ => Ok(new PieSvamletBuilder().Action.Hangup().Build())
};
}
}
Conversation API Chatbot Example
using Sinch.Conversation.Hooks;
using SinchFunctions.Utils;
public class FunctionController : SinchConversationController
{
public FunctionController(FunctionContext context, IConfiguration config, ILogger<FunctionController> logger)
: base(context, config, logger) { }
public override async Task<IActionResult> MessageInbound(MessageInboundEvent inbound)
{
// Use extension methods for easy property access
var text = inbound.GetText();
var channel = inbound.GetChannel();
var contactId = inbound.GetContactId();
if (string.IsNullOrEmpty(text))
{
Logger.LogDebug("Ignoring non-text message from {ContactId}", contactId);
return Ok();
}
Logger.LogInformation("Message from {ContactId} via {Channel}: {Text}", contactId, channel, text);
// Reply using helper method (auto-sets SMS_SENDER from config for SMS)
await Context.Conversation!.Messages.Send(Reply(inbound, "Thanks for your message!"));
return Ok(new { status = "ok" });
}
public override Task<IActionResult> MessageDelivery(MessageDeliveryReceiptEvent callback)
{
var status = callback.MessageDeliveryReport?.Status?.Value;
Logger.LogInformation("Delivery status: {Status}", status);
return Task.FromResult<IActionResult>(Ok());
}
}
Conversation API Extension Methods
// Easy access to inbound message properties
var text = inbound.GetText(); // Message text content
var channel = inbound.GetChannel(); // SMS, WHATSAPP, MESSENGER, etc.
var identity = inbound.GetIdentity(); // Sender's channel identity (phone/PSID)
var contactId = inbound.GetContactId(); // Sinch contact ID
var to = inbound.GetTo(); // Number the message was sent TO
// Check message types
if (inbound.IsTextMessage()) { /* handle text */ }
if (inbound.IsMediaMessage()) { /* handle media */ }
if (inbound.IsPostback()) { /* handle button click */ }
Conversation API Message Builders
// Simple reply - uses channel from inbound message
await Context.Conversation!.Messages.Send(Reply(inbound, "Hello!"));
// Static helper for SMS
var msg = ConversationMessage.CreateSms(appId, "+15551234567", "Hello!", smsSender);
await Context.Conversation!.Messages.Send(msg);
// Static helper for WhatsApp
var msg = ConversationMessage.CreateWhatsApp(appId, "+15551234567", "Hello!");
await Context.Conversation!.Messages.Send(msg);
// Fluent builder for complex cases
var msg = CreateMessage(inbound)
.Text("Custom reply")
.Build();
await Context.Conversation!.Messages.Send(msg);
Conversation API Webhook Events
| Trigger | Method | Description |
|---|---|---|
| MESSAGE_INBOUND | MessageInbound() |
User sends a message |
| MESSAGE_DELIVERY | MessageDelivery() |
Delivery status update |
| EVENT_INBOUND | EventInbound() |
Typing indicators, read receipts |
| CONVERSATION_START | ConversationStart() |
Conversation begins |
| CONVERSATION_STOP | ConversationStop() |
Conversation ends |
Conversation API Configuration
| Variable | Description | Required |
|---|---|---|
CONVERSATION_APP_ID |
Your Conversation API app ID | Yes |
FROM_NUMBER |
Your SMS sender number (E.164) | For SMS only |
CONVERSATION_REGION |
API region (US, EU, BR) | No (default: US) |
Request Limits
| Limit | Value |
|---|---|
| Request body | 10 MB (10485760 bytes) |
| Request/response body retained in logs | First 64 KB |
A body larger than the limit is rejected with 413 before your handler runs.
The platform router in front of a deployed function enforces the same 10 MB cap, so a body that
your handler accepts locally is not rejected in transit once deployed. Exactly 10485760 bytes is
accepted; one byte more returns 413.
Logs retain the first 64 KB of a request or response body, appending
…[truncated — N bytes total] when the body was longer. Only text formats are retained — JSON,
XML, plain text and form data. Anything else, including uploads, images, audio, video, PDFs and
archives, is not logged at all. Your function still receives every body in full.
Documentation
License
MIT License - see LICENSE file for details
| Product | Versions 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. |
-
net10.0
- libphonenumber-csharp (>= 9.0.38)
- Sinch (>= 1.5.1)
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 |
|---|---|---|
| 0.3.12 | 0 | 9/2/2026 |
| 0.3.11 | 89 | 8/24/2026 |
| 0.3.10 | 102 | 8/14/2026 |
| 0.3.9 | 93 | 8/7/2026 |
| 0.3.8 | 94 | 8/5/2026 |
| 0.3.7 | 159 | 5/12/2026 |
| 0.3.6 | 122 | 4/28/2026 |
| 0.3.5 | 119 | 4/28/2026 |
| 0.3.4 | 189 | 3/17/2026 |
| 0.3.3 | 145 | 3/12/2026 |
| 0.3.2 | 127 | 3/11/2026 |
| 0.3.1 | 126 | 3/9/2026 |
| 0.3.0 | 130 | 3/4/2026 |
| 0.2.0 | 134 | 2/23/2026 |
| 0.1.41-beta | 126 | 1/28/2026 |
| 0.1.40-beta | 128 | 1/14/2026 |
| 0.1.39-beta | 127 | 1/12/2026 |
| 0.1.38-beta | 309 | 12/17/2025 |
| 0.1.37-beta | 319 | 12/16/2025 |
| 0.1.36-beta | 298 | 12/16/2025 |
See Sinch.Functions.Runtime for release notes