Create a new custom message
import os
import syllable_sdk
from syllable_sdk import SyllableSDK
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": [
syllable_sdk.DayOfWeek.SA,
syllable_sdk.DayOfWeek.SU,
],
"invert": False,
"text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
},
],
})
# Handle response
print(res)
{
"name": "Customer service greeting",
"text": "Hello and thank you for calling customer service. How can I help you today?",
"label": "Customer service",
"rules": [
{
"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"
}
],
"id": 1,
"updated_at": "2024-01-01T00:00:00Z",
"agent_count": 1,
"last_updated_by": "user@email.com",
"type": "greeting"
}
Request model to create a custom message.
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.
import os
import syllable_sdk
from syllable_sdk import SyllableSDK
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": [
syllable_sdk.DayOfWeek.SA,
syllable_sdk.DayOfWeek.SU,
],
"invert": False,
"text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
},
],
})
# Handle response
print(res)
{
"name": "Customer service greeting",
"text": "Hello and thank you for calling customer service. How can I help you today?",
"label": "Customer service",
"rules": [
{
"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"
}
],
"id": 1,
"updated_at": "2024-01-01T00:00:00Z",
"agent_count": 1,
"last_updated_by": "user@email.com",
"type": "greeting"
}
Create a new custom message
import os
import syllable_sdk
from syllable_sdk import SyllableSDK
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": [
syllable_sdk.DayOfWeek.SA,
syllable_sdk.DayOfWeek.SU,
],
"invert": False,
"text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
},
],
})
# Handle response
print(res)
{
"name": "Customer service greeting",
"text": "Hello and thank you for calling customer service. How can I help you today?",
"label": "Customer service",
"rules": [
{
"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"
}
],
"id": 1,
"updated_at": "2024-01-01T00:00:00Z",
"agent_count": 1,
"last_updated_by": "user@email.com",
"type": "greeting"
}
Request model to create a custom message.
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.
import os
import syllable_sdk
from syllable_sdk import SyllableSDK
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": [
syllable_sdk.DayOfWeek.SA,
syllable_sdk.DayOfWeek.SU,
],
"invert": False,
"text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
},
],
})
# Handle response
print(res)
{
"name": "Customer service greeting",
"text": "Hello and thank you for calling customer service. How can I help you today?",
"label": "Customer service",
"rules": [
{
"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"
}
],
"id": 1,
"updated_at": "2024-01-01T00:00:00Z",
"agent_count": 1,
"last_updated_by": "user@email.com",
"type": "greeting"
}