Setup reminders to send emails or trigger webhooks before or after a booking takes place.
This article will give you an overview of how to configure reminders on Timekit.
You can choose to setup reminders on app-level, project-level or simply directly when creating a booking.
Timekit currently operates with two types of reminders: emails and webhooks.
Email reminders
The easiest way to send reminder emails before or after a booking is to use the built-in reminder emails. If you prefer using your own emails, jump to the next section where we talk about using webhooks to achieve the same result.
The emails will look like this in the recipients inbox:
Setting up an email-reminder to be send to the owner 15 minutes before a booking takes place looks like this:
{
"type": "email",
"settings": {
"recipient": "owner",
"subject": "Sales call in 15 mins!"
},
"when": {
"type": "before",
"unit": "mins",
"time": 15
}
}
Valid values for recipient are "owner" (the resource being booked) or "customer" (the person/email booking the resource).
Valid values for when.type are "before" (the booking begins) and "after" (the booking begins).
Valid values for when.unit are "secs", "mins" and "hours"
Webhook reminders
In addition to emails, you can also set up webhook reminders that will be triggered either before or after the booking begins. This is useful if you want to send your own emails, and just want to know when to send them.
Webhooks can be used for many other things than just reminders. Maybe you want to send out a questionnaire to your customers a day after the booking?
Setting up a webhook-reminder to be executed one hour after the booking starts looks like this:
{
"type": "webhook",
"settings": {
"url": "https://example.com/timekit-webhook",
"method": "post",
"expected_response_code": 201
},
"when": {
"type": "after",
"unit": "hours",
"time": 1
}
}
Valid values for settings.method are "post" and "get".
The payload of the webhook request looks similar to the response you get when you [GET] the /bookings/:id endpoint.
App-level reminders
Setting up reminders on app-level is done through our admin interface: https://admin.timekit.io
Project-level reminders
Setting up reminders on a project is done by providing the 'reminders' attribute when creating or updating a project, like so:
curl --request PUT \
--url https://api.timekit.io/v2/projects/<id> \
--header 'Content-Type: application/json' \
--user :test_api_key_nvHfRSlhvsnlg4rS7Wt28Ty47qdgegwSu3YK7hPW \
--data '{
"reminders": [
{
"type":"email",
"settings": {
"recipient": "owner",
"subject": "Time for take-off!"
},
"when": {
"type": "before",
"unit": "mins",
"time": 15
}
}
]
}'
Please note that you are not limited to one single reminder per project.
Booking-level reminders
You can also setup reminders specifically for each single booking you make. Notice that reminders are called event_notifications
when setting them on the booking!
curl --request POST \
--url https://api.timekit.io/v2/bookings \
--header 'Content-Type: application/json' \
--user :test_api_key_nvHfRSlhvsnlg4rS7Wt28Ty47qdgegwSu3YK7hPW \
--data '{
"resource_id": <id>,
"graph": "instant",
"action": "confirm",
"customer": {
"name": "Marty McFly",
"email": "[email protected]"
},
"event": {
"start": "2016-11-23 15:00:00",
"end": "2016-11-23 16:00:00",
"what": "Mens haircut",
"where": "Sesame St, Middleburg, FL 32068, USA",
"calendar_id": <calendar_id>
},
"event_notifications": [
{
"type": "webhook",
"settings": {
"url": "https://example.com/timekit-webhook",
"method": "post",
"expected_response_code": 200
},
"when": {
"type": "after",
"unit": "hours",
"time": 24
}
}
]
}
This example sets up a webhook-reminder, to be triggered 24 hours after the booking began.