CRADמפתחים
עברית

Customer requests, clinic approval and proposed times

Keep a new request pending, let the clinic decide from either admin, and confirm an alternative only after the customer agrees.

לפני שימוש חי — בדקו יכולות פרוסות, הרשאות ומוכנות של החיבור שלכם.

בדקו את היכולות הפרוסות, הרשאות המפתח ומוכנות העסק בסביבה שלכם. דוגמאות HTTP נלכדו בבדיקות מבודדות; הסימון local-unreleased שלהן אינו אומר שה־API אינו פועל, ואינו מאשר את החיבור שלכם. במסלול הלקוח מאמתים טלפון בתבנית WhatsApp שהעסק הגדיר; SMS אינו נתמך. רישום בידי אדמין מורשה הוא פעולה נפרדת ללא קוד.

One appointment, one decision source

CRAD is the canonical booking and capacity authority. Your website admin submits the same authorized calendar commands as CRAD; its local database is a permitted read projection. Do not confirm locally, dual-write appointments or let a stale projection override a committed receipt.

Read requireBookingApproval and customerAppointmentChanges through the business booking policy. Changes use its existing versioned preview/apply lifecycle and preserve existing appointments. Existing businesses default to automatic confirmation and self_service; enabling a clinic policy does not change other businesses.

The public catalogue discloses approvalRequired and customerAppointmentChanges. Keep them under the catalogue/configuration freshness rules. They explain the current interface; the final commit still checks current policy, quote, authority and capacity.

Choose a treatment and review its price terms

The customer chooses a published treatment in both the website and WhatsApp booking flow, then a time and their details. Use that selected service ID for the current quote; do not pick the first service, infer an option from its name or replace an uncertain request when the catalogue changes.

The HALA treatment catalogue can offer a fixed price, a price range, or a consultation whose treatment and price are decided at the visit. The unpriced 90-minute option is titled טיפול בהתאמה אישית. Its customer explanation is: נבחר יחד עם חלא את הטיפול המתאים לעור שלך. המחיר ייקבע בביקור, לפני תחילת הטיפול. It is an ordinary published service choice, with its own canonical ID.

For a range, the exact price stays null. Public services and accepted snapshots can include priceRangeMinor: {min,max} in integer minor units. Management service terms use priceRangeMajor; quotes use totalPriceRangeMajor and accepted terms retain the base and total ranges in major units. Display the returned range as an estimate, never as a fixed minimum charge. A consultation has null exact price and no range; zero remains a real zero price.

Read the current quote after selecting a treatment. A fixed provider price can replace the catalogue range, and a fixed removal fee adds to both range bounds. Preserve the authoritative result rather than calculating a quote from the display catalogue. A range minimum is not fixed service value or a payment; monthly reports must keep unknown exact amounts unpriced.

Service edits affect future quotes. Existing accepted terms, including ranges or an unknown price, stay frozen. Recover the original request/operation UUID, body, quote identity and service binding before preparing anything new. Never substitute today’s catalogue price for an authoritative null quote or historical snapshot.

Receiving a request is different from confirming it

Management status is PENDING or CONFIRMED; Customer API receipt status is pending or confirmed. Render the returned status, including after operation recovery. A pending request already reserves its original capacity; do not create a second appointment while waiting for a decision.

A delegated request can include communicationPreferences with an explicit whatsapp boolean and noticeVersion: website-transactional-whatsapp-v1. Obtain that choice from the customer. Recording a contact, recognizing a phone number or selecting bookingIntent does not grant messaging consent. Customer API intents retain their existing explicit communication preference and phone-proof requirements.

For a delegated customer request, send its optional language: he, ar or en to choose the update and reminder language for that booking. This does not overwrite an existing customer profile. Preserve the exact saved language or its absence when recovering an operation.

Entry pointCorrect behavior
Verified Customer API or customer booking in the botThe business policy determines the result. When approval is required, accept a pending request and say “Request received; awaiting the clinic.” Do not show “Appointment confirmed.”
Explicitly approved delegated website backendUse the separately granted Management contact/calendar operations and bookingIntent: request. This is a delegated customer request, not phone proof or authority to show customer history.
Appointment entered by an authorized administratorOmitting bookingIntent, or using appointment, retains the existing manually entered appointment behavior. Do not use this to bypass approval for an anonymous customer booking.
Management request fields — server-side, alongside the current quote and operation UUID
{
  "businessCustomerId": "${BUSINESS_CUSTOMER_ID}",
  "providerId": "${PROVIDER_ID}",
  "serviceId": "${SERVICE_ID}",
  "withRemoval": false,
  "startAt": "${RETURNED_SLOT_START_AT}",
  "quoteVersion": "${CURRENT_QUOTE_VERSION}",
  "bookingIntent": "request",
  "language": "ar",
  "communicationPreferences": {
    "whatsapp": true,
    "noticeVersion": "website-transactional-whatsapp-v1"
  }
}

Approve or decline through either admin

A successful command proves that the decision was saved, not that WhatsApp arrived. Show the immutable receipt separately from current state and notificationCurrent. Current consent, STOP, connection, template, daily budget and actor/resource authority are checked again before delivery. An unavailable or uncertain message must not undo a saved decision or create another send.

A website booking or phone proof does not open a WhatsApp customer-service window. Confirmation, rejection and proposed-time messages use approved Utility templates even if the customer has never messaged the business or the last inbound message is older than 24 hours. The exact language/template must be approved and currently available. There is no free-form fallback when template readiness fails.

The native CRAD admin uses its owner-authorized command path. Optional WhatsApp alerts and approval buttons for the clinic owner require separate native owner settings and approved templates; they are not a Management API endpoint and are not enabled for other businesses by this booking policy.

A cancelled approval request cannot be revived by setting its original physical appointment back to confirmed, including after the customer accepted a successor. Use current allowedActions. If a new booking is needed, read fresh availability and obtain a new quote/operation through the canonical create flow.

  1. Read the current request

    Use the physical appointment ID, current ETag/version and allowedActions. Local replicas may render the list, but do not invent a current version or permission for the final action.

    Read one current appointment
  2. Approve its original time

    Submit action: status, status: CONFIRMED with the original If-Match and a saved Idempotency-Key. Approval of an approval-required pending request automatically queues its customer confirmation; do not send a second message from your website.

    Apply a reviewed appointment action
  3. Decline the request

    Preview action: cancel with notificationIntent: request_notice, then apply the same reviewed action with its preview token, original If-Match and saved operation UUID. The appointment becomes CANCELLED and its capacity is released; a rejection update is queued. There is no separate REJECTED appointment status.

    Review an appointment actionApply a reviewed appointment action

Propose a time without silently moving the request

A proposal expires no later than the original time, the proposed time or 24 hours after it was offered. Expiry is not automatic rejection or cancellation of the original request. The clinic must review any request still pending after an expired or declined alternative.

The local 16 October correction publishes existing status_changed events for proposal offers, replacements and declines. Apply the current receipt version, approvalRequired and timeProposal. This event is not an approved reschedule; customer acceptance uses the existing command and publishes the real change. Exact replay does not duplicate the event or notification. No new event enum is required; verify the deployed behavior before depending on proposal freshness.

  1. Read one alternative day

    Call proposal-availability for this pending approval-required appointment and localDate. The result uses its frozen treatment duration, provider and business timezone. Do not preload a whole month or use a client-side replica as available capacity.

    Read alternative times for a pending request
  2. Review and save the proposal

    Preview action: propose_time, newStartAt and notificationIntent: request_notice with the original appointment If-Match. Apply that exact proposal, preview token and operation UUID. The original appointment remains PENDING at its original time; the proposed alternative is advisory and is checked again on acceptance.

    Review an appointment actionApply a reviewed appointment action
  3. Wait for customer consent

    Use timeProposal.proposalId, appointmentVersion, expiry and state. While a current offer awaits the customer, direct confirmation is refused with PROPOSAL_AWAITS_CUSTOMER. Do not display the alternative as an already confirmed appointment.

Accept or decline with current customer proof

POST proposal-response for the booking using its verified same-phone customer session and the original site/integration. Retain one Idempotency-Key and the exact {proposalId,response} body. The optional companion server credential must belong to that integration and have bookings:write:customer; never expose it in browser code. WhatsApp reply buttons use the authenticated inbound customer identity through the bot, not an anonymous public callback.

Acceptance rechecks the proposal version, expiry, current customer/provider/service and available capacity. It atomically cancels the original physical request and creates one confirmed successor with the same frozen terms and public booking lineage. The confirmation is queued once. Declining the alternative keeps the original request PENDING.

An occupied alternative returns SLOT_UNAVAILABLE and leaves the original untouched. An expired or superseded proposal returns PROPOSAL_UNAVAILABLE. Read the latest request and ask the clinic for another offer; do not automatically pick a different time. A conflicting choice under the same UUID returns OPERATION_CONFLICT.

Exact response replay can recover the original receipt after the lineage moves. Keep that historical receipt separate from a fresh booking read. A transport timeout is uncertain: retry only the same UUID/body after restoring required proof; never create a replacement acceptance UUID to force a different decision.

Honor a clinic that handles changes directly

customerAppointmentChanges: contact_business disables customer cancellation and rescheduling in the bot and public website. Read allowedActions and its contactPhoneNumber; show a direct telephone/WhatsApp link with clear wording that the appointment has not changed. Do not show a disabled self-service form without a useful next step.

The fresh database policy also refuses stale customer commands with CONTACT_BUSINESS_REQUIRED. Business managers retain their authorized calendar actions. Responding to an offered alternative is a separate consent action and remains available; this restriction must not block the customer accepting or declining that proposal.

Use each business’s saved contact number; never hardcode HALA’s number into shared components, API handlers or templates. The contact number and the bot’s Meta WhatsApp sending identity are separate. A policy change does not replace the connected bot number.

Configure 24 hours for this business only

Once the business is activated on the common reminder engine, choose offsetsMinutes: [1440] through the existing reminder policy preview/apply operations. Keep one reminder within its current ceiling. Use existing_future only after reviewing its impact when eligible existing future appointments must also move from two hours to 24 hours; new_bookings leaves prior schedules intact.

ROLLOUT_NOT_READY means an authorized CRAD operator must complete the existing safe per-business legacy-to-common-engine transition. Do not directly update the engine, add another cron or create a second website sender. Engine activation and website reminder authority are native operational settings, not permissions a developer gains from an installed API.

Use the approved neutral appointment_reminder_general language templates, whose text refers to an absolute date/time and has no self-cancel or change buttons. Pending requests never receive appointment reminders. If the clinic approves less than 24 hours before the start, the approval message is separate and the elapsed reminder target is skipped; do not send a late catch-up or silently fall back to two hours.