# Origamy playbook spec v1. Reference: /playbooks/spec-format/
spec_version: 1
id: hospitality.pre-arrival
title: Pre-arrival messages for guests
sector: hospitality
source:
  kind: synthesized
  notes: >-
    No hotel, guesthouse or host has built this with us yet. Written from the base patterns: a
    check-in date kept on each guest (from a synced sheet or a staff form), segments on that date
    and a daily schedule over each. The idea comes from what hosts already send by hand the day
    before a stay: directions, check-in time and a number to call.
derived_from: null
vocabulary:
  person: guest
  people: guests
  group: front desk
summary: >-
  The day before a guest arrives, sends them directions, the check-in time and your number. On
  the morning of arrival, a short "we're ready for you". Optionally gives your front desk or
  host a task to prepare the room. Never includes door codes or Wi-Fi passwords.
when_to_use:
  - You run a hotel, guesthouse, serviced apartments or short-lets, and guests often ask the same arrival questions.
  - Your reservations are in a Google Sheet or Excel file, or your front desk can type them into a short form.
  - You want fewer "where are you?" calls on arrival day.

requires:
  data_in:
    - how: sheet_sync
      what: "Your reservations sheet, synced every hour as People: guest phone, email, check-in date, check-out date and room or unit."
    - how: staff_form
      what: "Or the Reservation form this playbook creates, which the front desk or host fills in for each booking (matched by phone)."
  channels:
    - channel: sms
      for: The day-before and arrival-day messages
      needs: An SMS provider, or Origamy managed SMS after business verification (KYC).
    - channel: whatsapp
      for: The same two messages, if you answer yes to WhatsApp
      needs: A connected WhatsApp Business number, and both templates approved by Meta.
  events: []
  traits:
    - check_in_date
    - check_out_date
    - unit

parameters:
  - key: org_name
    ask: true
    question: What should messages call your property?
    label: Property name
    type: string
    example: Northwind Guesthouse
  - key: checkin_time
    ask: true
    question: When does check-in start? (as guests should read it)
    label: Check-in time
    type: string
    example: from 2pm
  - key: host_phone
    ask: true
    question: Which number should guests call or message on arrival day?
    label: Host phone
    type: string
    default: "{{ workspace.phone }}"
  - key: directions_url
    ask: true
    question: What link gives directions to the property? (a map link or a page with a short guide)
    label: Directions link
    type: url
    example: https://maps.example.com/your-property
  - key: use_whatsapp
    ask: true
    question: Should these messages go by WhatsApp instead of SMS?
    help: Needs a connected WhatsApp Business number and Meta-approved templates.
    label: Use WhatsApp
    type: boolean
    default: false
  - key: prepare_task
    label: Give the host a task to prepare the room the day before
    type: boolean
    default: false
  - key: host_team
    label: Team that prepares rooms (when the task is on)
    type: team_name
    default: Front desk
  - key: day_before_time
    label: Time of the day-before message
    type: time
    default: "10:00"
  - key: arrival_time
    label: Time of the arrival-day message
    type: time
    default: "08:00"
  - key: default_country
    label: Default phone country on the form
    type: country_code
    default: "{{ workspace.country }}"
  - key: timezone
    label: Time zone for the daily runs
    type: timezone
    default: "{{ workspace.timezone }}"
  - key: greeting_fallback
    label: Greeting when a first name is missing
    type: string
    default: there

timings:
  - At {{ params.day_before_time }} the day before check-in (the run is daily, in {{ params.timezone }}), each arriving guest gets directions, the check-in time and your number.
  - At {{ params.arrival_time }} on the day of check-in, a short "we're ready for you".
  - If the preparation task is on, the host team gets it at the same time as the day-before message, due in 12 hours.

customer_must:
  - "Keep the check-in date (a date like 2026-12-01), the check-out date and the room or unit on each guest, either as columns in your synced sheet named check_in_date, check_out_date and unit, or through the Reservation form. For a cancelled stay, clear the check-in date so the guest gets nothing."
  - "Publish the Reservation form and bookmark it on the front-desk phone or computer (skip this if you use a sheet)."
  - "If you chose WhatsApp: connect your WhatsApp Business number and submit the two templates (pre_arrival_directions and pre_arrival_ready) for Meta approval before switching the follow-ups on."
  - Add people to the {{ params.host_team }} team if you switch the room preparation task on. If you host alone, put yourself in it.
  - Connect an SMS provider or finish business verification, switch the follow-ups on and test with your own phone and a reservation for tomorrow.
  - Do not put door codes, Wi-Fi passwords or the exact room in any message. Share those when the guest arrives.

objects:
  - ref: team_host
    kind: team
    when: { param: prepare_task, equals: true }
    about: Prepares the room the day before a guest arrives.
    body: { name: "{{ params.host_team }}" }

  - ref: form_reservation
    kind: form
    about: Staff form to record a reservation, matched to the guest by phone. Skip it if you sync a sheet.
    body:
      name: New reservation
      slug: new-reservation
      description: Front desk or host only. One entry per booking.
      draft_state:
        version: 1
        meta: { layout: classic, submit_label: Save reservation, success_message: Saved. }
        pages:
          - id: p1
            title: Reservation
            description: Enter the guest's details and dates.
            fields:
              - { id: f_first, key: first_name, type: short_text, label: Guest's first name, required: true, maps_to: { mode: custom, key: first_name, trait: true } }
              - { id: f_phone, key: phone, type: phone, label: Guest's phone, required: true, maps_to: { mode: mapped, slot: profile.phone }, config: { country_picker: true, default_country: "{{ params.default_country }}", verify: "off" } }
              - { id: f_email, key: email, type: email, label: Guest's email (optional), required: false, maps_to: { mode: mapped, slot: profile.email } }
              - { id: f_in, key: check_in_date, type: date, label: Check-in date, required: true, maps_to: { mode: custom, key: check_in_date, trait: true } }
              - { id: f_out, key: check_out_date, type: date, label: Check-out date, required: true, maps_to: { mode: custom, key: check_out_date, trait: true } }
              - { id: f_unit, key: unit, type: short_text, label: Room or unit, required: false, maps_to: { mode: custom, key: unit, trait: true } }
      verification_settings: { required: false }

  - ref: seg_arriving_tomorrow
    kind: segment
    about: Check-in within the next day.
    body:
      name: Arriving tomorrow
      description: check_in_date within the next 24 hours.
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: check_in_date, cond_operator: within_next, value: 1d }
  - ref: seg_arriving_today
    kind: segment
    about: Check-in date that started in the last day (today).
    body:
      name: Arriving today
      description: check_in_date is today.
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: check_in_date, cond_operator: within_last, value: 1d }

  - ref: tmpl_before_sms
    kind: template
    about: Day-before SMS with directions, check-in time and the host's number.
    body:
      name: Arriving tomorrow (SMS)
      channel: sms
      category: Arrival
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "Hello {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}, we look forward to welcoming you to {{ params.org_name }} tomorrow. Check-in is {{ params.checkin_time }}. Directions: {{ params.directions_url }} Need anything before you arrive? Call {{ params.host_phone }}. Reply STOP to opt out."
  - ref: tmpl_ready_sms
    kind: template
    about: Short arrival-day SMS.
    body:
      name: Arriving today (SMS)
      channel: sms
      category: Arrival
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "Good morning {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}, we're ready for you at {{ params.org_name }}. Check-in is {{ params.checkin_time }}. Running late? Call {{ params.host_phone }} and we'll wait. Reply STOP to opt out."
  - ref: tmpl_before_wa
    kind: template
    when: { param: use_whatsapp, equals: true }
    about: Day-before WhatsApp message (needs Meta approval).
    body:
      name: Arriving tomorrow (WhatsApp)
      channel: whatsapp
      category: Arrival
      style: text
      status: active
      subject: ""
      provider_template_id: pre_arrival_directions
      metadata: { whatsapp: { category: UTILITY, language: en } }
      variables:
        "1": "{{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}"
        "2": "{{ params.org_name }}"
        "3": "{{ params.checkin_time }}"
        "4": "{{ params.directions_url }}"
        "5": "{{ params.host_phone }}"
      body: "Hello {{1}}, we look forward to welcoming you to {{2}} tomorrow. Check-in is {{3}}. Directions: {{4}} If you need anything before you arrive, call or message {{5}} any time."
  - ref: tmpl_ready_wa
    kind: template
    when: { param: use_whatsapp, equals: true }
    about: Arrival-day WhatsApp message (needs Meta approval).
    body:
      name: Arriving today (WhatsApp)
      channel: whatsapp
      category: Arrival
      style: text
      status: active
      subject: ""
      provider_template_id: pre_arrival_ready
      metadata: { whatsapp: { category: UTILITY, language: en } }
      variables:
        "1": "{{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}"
        "2": "{{ params.org_name }}"
        "3": "{{ params.checkin_time }}"
        "4": "{{ params.host_phone }}"
      body: "Good morning {{1}}, we are ready for you at {{2}}. Check-in is {{3}}. If you are running late, call {{4}} and we will wait for you."

  - ref: wf_day_before
    kind: workflow
    about: 'Daily run over "arriving tomorrow": directions and check-in details, plus an optional room-prep task.'
    body:
      name: "Pre-arrival: the day before"
      description: Every day, directions and check-in details to guests arriving tomorrow, and a room-prep task if switched on.
      enabled: false
      trigger_type: schedule
      trigger_config: { segment_id: "{{ ref.seg_arriving_tomorrow.id }}", rrule: FREQ=DAILY, starts_at: "{{ workspace.tomorrow }}T{{ params.day_before_time }}", timezone: "{{ params.timezone }}" }
      steps:
        - { id: s1, type: action, when: { param: use_whatsapp, equals: false }, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_before_sms.id }}" } } } }
        - { id: s2, type: action, when: { param: use_whatsapp, equals: true }, config: { action_type: send_message, channel_config: { mode: single, single: { channel: whatsapp, template_id: "{{ ref.tmpl_before_wa.id }}" } } } }
        - id: s3
          type: human_task
          when: { param: prepare_task, equals: true }
          config:
            human_task:
              title: "Prepare for arrival: {{ traits.first_name }}, {{ traits.unit | default: \"room not set\" }}"
              instructions: |-
                {{ traits.first_name }} arrives tomorrow ({{ traits.unit | default: "room not set" }}).
                Please get the room or unit ready, and mark Ready when it is, or Problem if something needs fixing before they arrive.
              assignee_refs: [{ type: team, id: "{{ ref.team_host.id }}" }]
              strategy: round_robin
              completion_policy: first_response_wins
              outcome_options:
                - { id: ready, label: Ready, intent: positive }
                - { id: problem, label: Problem to fix, intent: negative }
              due_hours: 12
              wait: false
              notify: immediate
      re_entry_policy: cooldown
      re_entry_cooldown_hours: 72
      goal: {}
      exit_conditions: []
  - ref: wf_today
    kind: workflow
    about: 'Daily run over "arriving today": a short "we''re ready for you".'
    body:
      name: "Pre-arrival: the morning of check-in"
      description: Every morning, a short message to guests arriving today.
      enabled: false
      trigger_type: schedule
      trigger_config: { segment_id: "{{ ref.seg_arriving_today.id }}", rrule: FREQ=DAILY, starts_at: "{{ workspace.tomorrow }}T{{ params.arrival_time }}", timezone: "{{ params.timezone }}" }
      steps:
        - { id: s1, type: action, when: { param: use_whatsapp, equals: false }, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_ready_sms.id }}" } } } }
        - { id: s2, type: action, when: { param: use_whatsapp, equals: true }, config: { action_type: send_message, channel_config: { mode: single, single: { channel: whatsapp, template_id: "{{ ref.tmpl_ready_wa.id }}" } } } }
      re_entry_policy: cooldown
      re_entry_cooldown_hours: 72
      goal: {}
      exit_conditions: []

eval:
  name: 85_hospitality_pre_arrival
  mode: task
  vertical: ""
  prompt: >-
    We run a guesthouse. The day before a guest checks in, text them directions, our check-in
    time and our number, and on the morning of check-in send a short message that we're ready
    for them. The check-in date is in check_in_date on each guest. Don't put any Wi-Fi password
    or door code in the messages.
  expect_artifacts: [segment, workflow, message_template]
  forbid_terms: [password, door code]
