Skip to main content
POST
/
api
/
v1
/
custom_messages
Python (SDK)
import os
from syllable_sdk import SyllableSDK, models


with SyllableSDK(
    api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:

    res = ss_client.custom_messages.create(request={
        "name": "Customer service greeting",
        "text": "Hello and thank you for calling customer service. How can I help you today?",
        "label": "Customer service",
        "rules": [
            {
                "description": "Closed on New Year's Day",
                "time_range_start": "09:00",
                "time_range_end": "17:00",
                "date_": "2025-01-01",
                "invert": False,
                "text": "Hello, thank you for calling. Sorry, we're closed today.",
            },
            {
                "description": "Closed on weekends",
                "time_range_start": "09:00",
                "time_range_end": "17:00",
                "days_of_week": [
                    models.DayOfWeek.SA,
                    models.DayOfWeek.SU,
                ],
                "invert": False,
                "text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
            },
        ],
    })

    # Handle response
    print(res)
{
  "name": "<string>",
  "text": "<string>",
  "id": 123,
  "updated_at": "2023-11-07T05:31:56Z",
  "last_updated_by": "<string>",
  "label": "Customer service",
  "rules": [],
  "agent_count": 1,
  "type": "greeting"
}

Authorizations

Syllable-API-Key
string
header
required

Body

application/json

Request model to create a custom message.

name
string
required

The name of the custom message

text
string
required

The default message that the agent will deliver if no rules are set or no rules match the current timestamp.

label
string | null

The label of the custom message

Example:

"Customer service"

rules
CustomMessageRule · object[]

Rules for time-specific message variants

type
string
default:greeting

Type of the custom message (must be "greeting" for now)

Response

Successful Response

Response model for custom message operations. A custom message is a pre-configured message delivered by an agent as a greeting at the beginning of a conversation. Multiple agents can use the same custom mesasage. A custom message has one or more rules defined, which allow for different messages to be dynamically selected and delivered at runtime based on the current time and either date or day of the week. For more information, see Console docs.

name
string
required

The name of the custom message

text
string
required

The default message that the agent will deliver if no rules are set or no rules match the current timestamp.

id
integer
required

The ID of the custom message

updated_at
string<date-time>
required

Timestamp of the most recent update to the custom message

last_updated_by
string
required

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

label
string | null

The label of the custom message

Example:

"Customer service"

rules
CustomMessageRule · object[]

Rules for time-specific message variants

agent_count
integer | null

The number of agents using the custom message

Example:

1

type
string
default:greeting

Type of the custom message (must be "greeting" for now)