How it works
Three steps, each an API call:- Read the stays with Browse bookings, which pairs every booking with the guest it belongs to.
- Read the profile with Get a guest, for the sourced attributes the index does not carry.
- Write back with Partially update a guest, which appends to array attributes instead of replacing them.
The examples reuse the bearer token from the Quick start. Replace
{entityId} with your entity.Read the stays
Browse bookings lives on the bookings service, so its path starts with/api/bookings-manager/. It paginates with limit and offset, and the response carries a total, so the first call also sizes the work. The query below keeps the confirmed stays that ended in August 2026. With > and <, departure takes a plain YYYY-MM-DD date, so the API filters the window for you.
Write back what you learned
UsePATCH, not PUT. On an array attribute it appends: the language the guest answered in joins the one the PMS wrote instead of erasing it, and a note lands next to the ones the staff already took. Set from to the real origin of what you write: guest for what the guest told you, agent for what a human recorded.
Tailor the next message
Get a guest’s segments tells you which groups a profile belongs to, so the follow-up you send matches how the hotel already thinks about that guest. Read it before composing, and fall back to a neutral message when the list comes back empty.Tips
PATCHis not idempotent. Array attributes append on every call, so a retried write can duplicate a note. Key your retries on your side, or read the profile before sending again.- Check the opt-out flags before any message. When a channel preference has been recorded, the profile carries it under
optedOut; the attribute is absent until something sets it, so handle both cases. Read it on the profile rather than on your own copy, since another system may have changed it since your last sync. - Write the real source. A note stored as
pmswhen a human wrote it makes the next partner trust it more than it deserves. Thefromfield is what keeps a shared profile readable.
Related
Browse bookings
Stays paired with their guest, page by page.
Partially update a guest
The append-style write.