Automation steps
Add a YCLIENTS app step to the graph. Map its inputs to process variables and save its results for subsequent blocks. You do not need to call the YCLIENTS API manually or supply tokens.
Five steps for a new flow
| Step | Inputs | Outcomes |
|---|---|---|
Nearest available days — day_choices |
service_ids, staff_id; optional date_from, range_days, page_size, cursor |
has_days — days found; no_days — no options; invalid_date — invalid date. |
Available times — time_choices |
service_ids, staff_id, date; optional page_size, cursor |
has_slots, no_slots, invalid_date. |
Find times with branches — find_slots_v2 |
service_ids, staff_id, date as YYYY-MM-DD |
has_slots — times found; no_slots — no availability. |
Create appointment with branches — create_booking_v2 |
service_ids, staff_id, datetime, client_name, client_phone; optional client_email, comment |
created — appointment created; unavailable — the chosen time is no longer available. |
Cancel appointment with branches — cancel_booking_v2 |
record_id |
cancelled — appointment cancelled; not_found — appointment not found. |
service_ids is an array of numeric service IDs; staff_id and record_id are numbers. For datetime, use the full value from the selected available slot, including its timezone. Do not construct it from a button label such as “14:30”.
Use branched steps for new flows. Older flows may contain the single-continuation find_slots, create_booking, and cancel_booking steps; this documentation does not require replacing them.
A simple booking flow
- Obtain the selected service and staff member. A single-service scenario can use real IDs configured in advance; add a selection if several options are offered.
- Show available days, then times for the chosen day.
- Collect the name and phone number, summarize the details, and show a separate confirmation button.
- Run
create_booking_v2after confirmation. - On
created, saverecord_idand send confirmation. Onunavailable, offer another time. - If the customer wants to cancel, obtain consent and pass the saved
record_idtocancel_booking_v2.
A search result does not hold a slot: another customer may book it before confirmation. The “Time unavailable” outcome is useful even when times are selected with buttons.
Process variables and errors
For example, save record_id to run.yclients_record_id and the selected time to run.yclients_datetime. Variable names are up to the flow author. Initialize values before reading them: referencing a variable that does not yet exist can stop the process.
Check the outcome before using fields: unavailable does not contain a created appointment, and not_found does not confirm cancellation. Authorization, connection, and invalid-parameter errors do not mean “no available times”; provide a separate message or administrator handoff.
Adding steps does not publish the automation or assign an agent to channels. Check the draft in a test conversation before enabling the scenario under your own operating rules.