Message Templates
Message templates define the content of messages sent to customers for booking events such as confirmation, reminder, and follow-up.
Attributes
| Name | Type | Description |
|---|---|---|
| id | Integer | Automatically set |
| created_at | Datetime | Automatically set |
| updated_at | Datetime | Automatically set |
| message_type | String | Values: confirmation, reminder, follow_up. See message types. |
| delivery_type | String | Values: email, sms. |
| subject | String | Message subject line. Only applicable for email. |
| template | Liquid-Text | Message body template. |
| delivery_timing | String | When the message should be delivered. See delivery timing. |
| active | Boolean | Whether the template is active. |
| services | Array | Service IDs this template applies to. |
| custom_data | Array | Not required |
Message types
confirmation— sent when a booking is created.reminder— sent before a booking starts.follow_up— sent after a booking ends.
Delivery timing
The delivery_timing value is a natural language time expression parsed relative to a base time that depends on message_type:
| message_type | Base time | Example delivery_timing | Result |
|---|---|---|---|
| confirmation | created_at (booking creation) | in 5 minutes | 5 min after booking is created |
| reminder | starts_at (booking start) | 3 hours ago | 3 hours before booking starts |
| reminder | starts_at | 1 day ago | 1 day before booking starts |
| follow_up | ends_at (booking end) | in 2 hours | 2 hours after booking ends |
| follow_up | ends_at | in 1 day | 1 day after booking ends |
The expression is parsed relative to the base time. So 3 hours ago relative to starts_at means 3 hours before the booking starts, and in 2 hours relative to ends_at means 2 hours after the booking ends.
Listing
GET /message_templates will return all message templates.
Response
[
{
"message_template": {
"id": 1,
"created_at": "2012-09-20T15:34:16+02:00",
"updated_at": "2012-09-20T15:34:16+02:00",
"message_type": "confirmation",
"delivery_type": "email",
"subject": "Your booking is confirmed",
"template": "Hi , your booking is confirmed.",
"delivery_timing": "in 5 minutes",
"active": true,
"services": [1, 2],
"custom_data": null
}
}
]
Get message template
GET /message_templates/{message_template_id} will get a message template with id {message_template_id}.
Add new message template
POST /message_templates will create a new message template.
Update message template
PUT /message_templates/{message_template_id} will update existing message template with id {message_template_id}.
Delete message template
DELETE /message_templates/{message_template_id} will delete existing message template with id {message_template_id}.