Booking Policy Snapshots API: Sample Use Cases and Flows

This article shares some possible use cases your code could support, as well as a sample flow that could support each use case. This can be a helpful jumping off point as you plan your code's implementation.

Notify business owners of bookings under an outdated policy

Your app could give business owners an overview of all bookings made under an older version of a service policy.

To display a list of bookings with outdated booking policy:

  1. Listen to onBookingPolicyUpdated().
  2. Retrieve all services that are using the affected policy with queryServices(). Make sure to pass the relevant policy ID from the previous step as filter.
  3. Use queryExtendedBookings(). For appointment-based service include bookedEntity.item.slot.serviceId in the filter. For classes or courses include bookedEntity.item.schedule.serviceId in the filter. You may use a conditional or for both filter options in a single call.
  4. Retrieve the policy snapshots for the affected bookings with listPolicySnapshotsByBookingIds().
  5. Create a summary of these bookings, highlighting the policy changes for each booking.
  6. Send the summary to the business owners.
Did this help?