Skip to main content
PUT
/
api
/
v1
/
custom_messages
Typescript (SDK)
import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.customMessages.update({
    name: "Customer service greeting",
    preamble: "If this is an emergency, please hang up and call 911.",
    text: "Hello and thank you for calling customer service. How can I help you today?",
    subject: "Your appointment reminder",
    label: "Customer service",
    rules: [
      {
        description: "Closed on New Year's Day",
        timeRangeStart: "09:00",
        timeRangeEnd: "17:00",
        date: "2025-01-01",
        invert: false,
        text: "Hello, thank you for calling. Sorry, we're closed today.",
      },
      {
        description: "Closed on weekends",
        timeRangeStart: "09:00",
        timeRangeEnd: "17:00",
        daysOfWeek: [
          "sa",
          "su",
        ],
        invert: false,
        text: "Hello, thank you for calling. Sorry, we're closed on weekends.",
      },
    ],
    id: 1,
  });

  console.log(result);
}

run();
{
  "name": "<string>",
  "text": "<string>",
  "repeat_after_language_change": true,
  "id": 123,
  "updated_at": "2023-11-07T05:31:56Z",
  "last_updated_by": "<string>",
  "type": "greeting",
  "preamble": "If this is an emergency, please hang up and call 911.",
  "subject": "Your appointment reminder",
  "label": "Customer service",
  "rules": [],
  "agent_count": 1
}

Authorizations

Syllable-API-Key
string
header
required

Body

application/json

Request model to update an existing custom message.

name
string
required

The name of the custom message

Example:

"Customer service greeting"

text
string
required

The default message that the agent will deliver if no rules are set or no rules match the current timestamp. For email_template, this is the body.

Example:

"Hello and thank you for calling customer service. How can I help you today?"

id
integer
required

The ID of the custom message

Example:

1

type
enum<string>
default:greeting

Type of the custom message: greeting (voice) or email_template.

Available options:
greeting,
email_template
Example:

"greeting"

preamble
string | null

An optional preamble that will be delivered before the main message, regardless of whether the current time and date match a rule or the system uses the default message. Cannot contain the "{{ language.mode }}" tag. In the case of a voice conversation, the user will not be able to interrupt the preamble. Can be used for e.g. legal disclaimers that the user must always see/hear.

Example:

"If this is an emergency, please hang up and call 911."

subject
string | null

Email subject. Required for email_template (in type_config); ignored otherwise.

Example:

"Your appointment reminder"

label
string | null

The label of the custom message

Example:

"Customer service"

repeat_after_language_change
boolean | null

If true, if the caller changes language using the language menu in the custom message, the message will be repeated in the new language (not including the language menu). If omitted or null on create, false is stored. If omitted or null on update, existing value will not be changed.

rules
CustomMessageRule · object[]

Rules for time-specific message variants

Example:
[
{
"date": "2025-01-01",
"description": "Closed on New Year's Day",
"invert": false,
"text": "Hello, thank you for calling. Sorry, we're closed today.",
"time_range_end": "17:00",
"time_range_start": "09:00"
},
{
"days_of_week": ["sa", "su"],
"description": "Closed on weekends",
"invert": false,
"text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
"time_range_end": "17:00",
"time_range_start": "09:00"
}
]

Response

Successful Response

Response model for custom message operations. A custom message is a pre-configured message delivered by an agent (e.g. as a greeting at the beginning of a conversation, or as an email template with subject and body). Multiple agents can use the same custom message. Greeting-type messages may have rules for time-based variants; email templates have a subject and body only. For more information, see Console docs.

name
string
required

The name of the custom message

Example:

"Customer service greeting"

text
string
required

The default message that the agent will deliver if no rules are set or no rules match the current timestamp. For email_template, this is the body.

Example:

"Hello and thank you for calling customer service. How can I help you today?"

repeat_after_language_change
boolean
required

If true, if the caller changes language using the language menu in the custom message, the message will be repeated in the new language (not including the language menu).

id
integer
required

The ID of the custom message

Example:

1

updated_at
string<date-time>
required

Timestamp of the most recent update to the custom message

Example:

"2024-01-01T00:00:00Z"

last_updated_by
string
required

The email address of the user who most recently updated the custom message

Example:

"user@email.com"

type
enum<string>
default:greeting

Type of the custom message: greeting (voice) or email_template.

Available options:
greeting,
email_template
Example:

"greeting"

preamble
string | null

An optional preamble that will be delivered before the main message, regardless of whether the current time and date match a rule or the system uses the default message. Cannot contain the "{{ language.mode }}" tag. In the case of a voice conversation, the user will not be able to interrupt the preamble. Can be used for e.g. legal disclaimers that the user must always see/hear.

Example:

"If this is an emergency, please hang up and call 911."

subject
string | null

Email subject. Required for email_template (in type_config); ignored otherwise.

Example:

"Your appointment reminder"

label
string | null

The label of the custom message

Example:

"Customer service"

rules
CustomMessageRule · object[]

Rules for time-specific message variants

Example:
[
{
"date": "2025-01-01",
"description": "Closed on New Year's Day",
"invert": false,
"text": "Hello, thank you for calling. Sorry, we're closed today.",
"time_range_end": "17:00",
"time_range_start": "09:00"
},
{
"days_of_week": ["sa", "su"],
"description": "Closed on weekends",
"invert": false,
"text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
"time_range_end": "17:00",
"time_range_start": "09:00"
}
]
agent_count
integer | null

The number of agents using the custom message

Example:

1