Logo
Search
API Docs

First Message & Greetings

Core Assistant Configuration

Dynamic First Message & Greetings

Overview

An assistant's opening line doesn't have to be static text. The firstMessage field supports variable injection, so the same assistant can greet a caller by name, reference the number they dialed, or open in a different language depending on how the call was placed.


The firstMessage Field

firstMessage is the line the assistant speaks when the call connects, before the caller says anything. It accepts plain text, but any text field on the assistant — including firstMessage and the system prompt — can also contain variable placeholders using double curly braces:

"firstMessage": "Hello, {{name}}! Thanks for calling {{phoneNumber.name}}."

Injecting Variables

Custom variable values are supplied via assistantOverrides.variableValues when you create the call:

{
  "assistantId": "your-assistant-id",
  "assistantOverrides": {
    "variableValues": {
      "name": "John"
    }
  },
  "customer": {
    "number": "+1xxxxxxxxxx"
  },
  "phoneNumberId": "your-phone-id"
}

With a firstMessage of "Hello, {{name}}!", the caller hears "Hello, John!". Variable values can't be set directly in the dashboard — they must be passed through the API when the call or session is created.

Advanced date/time formatting

Date and time variables support LiquidJS-style filters for timezone-aware formatting:

{{"now" | date: "%A, %B %d, %Y, %I:%M %p", "America/Los_Angeles"}}

which renders as, for example, Monday, January 01, 2024, 03:45 PM.


Default Variables

These variables are always available automatically, with no need to set them in variableValues:

VariableDescriptionExample
{{now}}Current date and time (UTC)Jan 1, 2024 12:00 PM
{{date}}Current date (UTC)Jan 1, 2024
{{time}}Current time (UTC)12:00 PM
{{month}}Current month (UTC)January
{{day}}Current day of month (UTC)1
{{year}}Current year (UTC)2024
{{customer.number}}The caller's phone number+1xxxxxxxxxx
{{customer.X}}Any other customer property set when creating the call
{{phoneNumber.number}}The number used for the call+1xxxxxxxxxx
{{phoneNumber.name}}Display name set on the phone numberMain Support Line
{{call.id}}Unique call ID5fe26c8e-...
{{call.type}}The kind of callinboundPhoneCall / outboundPhoneCall / webCall

Multilingual Greetings via Contents Array

For assistants that need to greet callers in different languages, firstMessage can be paired with a contents array, giving you a per-language variant of the opening line rather than relying on a single-language string with runtime translation. Combine this with your assistant's language detection so the greeting itself — not just the rest of the conversation — matches the caller's language from the very first word.