Metadata
Metadata is how you save the values of a user's selections, answers, and inputs.
There are three types of metadata that can be stored for the different types of appointment booking flows.
- Normal: Saved when a new appointment is booked.
- Cancel: Saved to the original appointment before canceling.
- Reschedule: Rescheduling cancels the old appointment in the background to create a new one. The reschedule metadata is saved to the new appointment that is created.
{
"steps": {},
"flow": {},
"summaries": {},
"meta": {
"normal": {},
"cancel": {},
"reschedule": {}
}
}
Get Saved Meta Data
Before we look at how we save data to an appointment, let's briefly look at how we find that data when we need it at a later date. Currently, there are two ways to retrieve this data:
- Download Report: From the Setster dashboard
- Fetch From API: Since the data is appended to the appointment, it can be retrieved using the API.
Download Report
This custom data can be retrieved by downloading your appointment's reports as JSON in the Setster dashboard in the Reports tab. The metadata that you set will be saved under the custom_data property.
Fetch Custom Data From API
The metadata you set in your settings file is appended to the appointment as custom_data when the appointment is
created, which happens after the appointment booking form has been submitted.
You can retrieve this custom_data by making a GET request to the /appointment endpoint outlined in the API Reference.
Save Meta Data
Arbitrary Values
We can set any arbitrary values on our metadata in the meta object to be stored in the appointment's custom_data property in the Setster API. For example, You might want to pass a value to be stored in the custom_data to let you know that the user came from an email they clicked, and we'd like our custom data to look like the following.
Desired Custom Data Structure
{
"user_journey": "clicked-promo-email"
}
In order to achieve this, we'll set it on the meta.normal object, which saves the custom data when the appointment is created.
{
"meta": {
"normal": {
"user_journey": "clicked-promo-email"
}
}
}
Save User Selections
To grab the values of the user's selection from a given step, we use a double curly braces syntax, specify that we want to recall a step's value, and include the name of the step that we'd like to obtain the value from.
Find Step Name
Let's say we have a step called looking_for in our steps content, and we want to append that user selection value to the appointment being booked; we add it to the meta.normal property since the normal flow is for booking a new appointment.
{
"steps": {
"looking_for": {}
},
"meta": {}
}
Structure Your Data
First, we'll need to decide how to format the custom_data that will be stored alongside the created appointment. You can customize the shape of this object by supplying a custom property name in the meta-object.
Let's say we'd like to store the looking_for user selection value as product_quiz_looking_for in our appointment's custom_data so that we know that it came from this particular Setster Studio embed on the looking_for step.
{
"steps": {
"looking_for": {}
},
"meta": {
"normal": {
"product_quiz_looking_for": ""
}
}
}
Recall User Selections
Below, we've added the product_quiz_looking_for property. To grab the value of the step, we use the recall syntax mentioned above: {{steps:}} followed by the step's name, which would be looking_for in this example.
Finally, to recall the looking_for step in our example we'd use {{steps:looking_for}}
{
"steps": {
"looking_for": {}
},
"meta": {
"normal": {
"product_quiz_looking_for": "{{steps:looking_for}}"
}
}
}
Full Example
Now, let's take a look at the full example, excluding all the specific steps' details for brevity.
{
"account_id": "YOUR_ACCOUNT_ID",
"steps": {
"product_quiz_looking_for": {},
"product_quiz_age": {},
"product_quiz_skin_feel": {},
"product_quiz_environment": {},
"product_quiz_concern": {},
"product_quiz_schedule_meeting": {},
"product_quiz_services_step": {},
"product_quiz_locations_step": {},
"product_quiz_staff_step": {}
},
"flow": {},
"summaries": {},
"meta": {
"normal": {
"product_quiz_looking_for": "{{steps:product_quiz_looking_for}}",
"product_quiz_age": "{{steps:product_quiz_age}}",
"product_quiz_skin_feel": "{{steps:product_quiz_skin_feel}}",
"product_quiz_environment": "{{steps:product_quiz_environment}}",
"product_quiz_concern": "{{steps:product_quiz_concern}}",
"product_quiz_schedule_meeting": "{{steps:product_quiz_schedule_meeting}}",
"product_quiz_services_step": "{{steps:product_quiz_services_step}}",
"product_quiz_locations_step": "{{steps:product_quiz_locations_step}}",
"product_quiz_staff_step": "{{steps:product_quiz_staff_step}}"
},
"cancel": {},
"reschedule": {
"reschedule_service": "{{steps:product_quiz_services_step}}",
"reschedule_location": "{{steps:product_quiz_locations_step}}",
"reschedule_staff": "{{steps:product_quiz_staff_step}}"
}
}
}
Schema
| normal required | object (IMetaItem) |
| cancel | object (IMetaItem) |
| reschedule | object (IMetaItem) |
{- "normal": {
- "user_journey": "clicked-promo-email"
}, - "cancel": {
- "user_journey": "clicked-promo-email"
}
}