SVAML (Sinch Voice Application Markup Language) is the JSON format you return from voice callbacks to tell Sinch what to do with a call. "Say this message." "Run this menu." "Connect to this number." "Record the call." "Hang up."
You almost never write raw SVAML. Both runtimes ship fluent builders that produce the JSON for you, and your IDE autocompletes every action. This page explains what SVAML is, how the builders work, and when to care about the underlying JSON.
A SVAML response is a JSON object with an action field and optional instructions. A minimal example:
{
"instructions": [
{ "name": "say", "text": "Welcome to Acme Corp." }
],
"action": {
"name": "connectPstn",
"number": "+15551234567"
}
}Instructions are things to do before the action — play audio, say a message, set a parameter. The action is the main thing the platform does — run a menu, connect a call, record, hang up.
You never need to remember this structure. The builders hide it.
import { IceSvamlBuilder, MenuTemplates } from '@sinch/functions-runtime';
return new IceSvamlBuilder()
.say('Welcome to Acme Corp.')
.runMenu(MenuTemplates.business('Acme Corp'))
.build();There are three builders matching the three callbacks that return SVAML:
| Builder | Used in |
|---|---|
IceSvamlBuilder | ice handler — the full set of voice actions |
PieSvamlBuilder | pie handler — same actions as ICE except answer |
AceSvamlBuilder | ace handler — only continue() and hangup() |
C# uses IceSvamletBuilder / PieSvamletBuilder / AceSvamletBuilder. The naming quirk is historical — "SVAMLet" was an older name for a single SVAML document.
using SinchFunctions.Utils;
return Ok(new IceSvamletBuilder()
.Instructions.Say("Welcome to Acme Corp.")
.Action.RunMenu(MenuTemplates.Business("Acme Corp"))
.Build());C# builders split instructions from the action using .Instructions and .Action accessors. The Node builder flattens both onto the same chain because TypeScript does not need the separation.
You will use a handful of actions over and over. Here they are with Node snippets — see the SVAML cheat sheet for the C# mirror and the full list.
// Speak text to the caller (text-to-speech)
.say('Welcome to Acme Corp.')
// Play an audio file (from assets/ or a URL)
.play('assets/greeting.wav')
// Connect the call to a phone number
.connectPstn('+15551234567', { cli: '+15559876543' })
// Run an interactive menu
.runMenu({ prompt: 'Press 1 for sales, 2 for support', options: [...] })
// Record the call
.startRecording({ destinationUrl: 'https://...' })
// Hang up
.hangup()
// Bridge to a WebSocket for streaming audio
.connectStream('wss://your-function.fn.sinch.com/stream')Menus are their own little sub-language. Use createMenu() or one of the pre-built MenuTemplates:
import { createMenu, MenuTemplates } from '@sinch/functions-runtime';
// Pre-built
.runMenu(MenuTemplates.business('Acme Corp'))
// Custom
const menu = createMenu()
.prompt('Press 1 for sales, press 2 for support.')
.option('1', 'return(sales)')
.option('2', 'return(support)')
.timeout(5000)
.maxDigits(1)
.build();Available templates: business, yesNo, language, afterHours, recordingConsent, numericInput (Node); C# adds CallbackRequest, CustomerService, SatisfactionSurvey.
When a menu completes, Sinch fires a PIE callback with the result — see voice callbacks for how to handle it.
Almost never. The builders cover every documented action and are versioned alongside the Sinch voice API. The one case where you might look at raw SVAML is when debugging — Sinch logs the exact JSON your function returned, and recognizing the shape is useful.
If you need an action that is not on a builder yet, you can still emit raw SVAML by returning a plain object that matches the schema. Prefer filing a runtime issue though — it usually means the builder is missing coverage.
The authoritative specification of every SVAML action, every parameter, and every edge case lives on the Sinch developer portal:
developers.sinch.com/docs/voice/api-reference/svaml
Treat our docs as "how to use SVAML from the runtime" and the Sinch spec as "what SVAML actually contains."
- SVAML cheat sheet — quick reference for the most-used actions in both runtimes
- Voice callbacks — which callbacks return SVAML and when
- Build an IVR guide — end-to-end example using menus and PIE