# Origamy playbook spec v1. Reference: /playbooks/spec-format/
spec_version: 1
id: schools.school-tour-to-enrolment
title: School tour to enrolment
sector: schools
source:
  kind: synthesized
  notes: >-
    No school has built this with us yet. Written from the base call-task pattern (an enquiry
    gets a call task with an escalation), the booking pattern
    (a booking saves its time on the person and drives hourly reminders), and the staff-form
    pattern used for decisions (a trigger filter on the form's answer picks the message). The
    admissions wording follows the admissions funnel playbook, which was built with a school.
derived_from: edtech.admissions-funnel
vocabulary:
  person: parent
  people: parents
  group: admissions office
summary: >-
  Takes a family from first enquiry to a place at your school. Enquiries get a thank-you with
  the tour booking link and a call from admissions. Tours get a confirmation and a reminder the
  day before, then a follow-up the day after with your application link. When your staff record
  a decision, the parent gets the right message, and the head teacher gets a weekly summary.
when_to_use:
  - Parents find you by word of mouth, social media or a sign at the gate, and visit before they apply.
  - Admissions is one person or a small office, and enquiries sometimes wait too long for a call.
  - You decide places by hand (offer, waiting list, decline) and want each parent told the same day.

requires:
  data_in:
    - how: public_form
      what: "The Enquiry form and the Application form this playbook creates. Put the Enquiry link on your website, Instagram bio and WhatsApp status, or print it as a QR code for the gate."
    - how: booking_form
      what: "The Tour booking form this playbook creates: a date and time slot question. Each booking saves the tour time on the parent, which drives the reminders."
    - how: staff_form
      what: "A staff-only Admission decision form your admissions office fills in for each family, matched by the parent's phone number."
  channels:
    - channel: sms
      for: Every message to parents
      needs: An SMS provider, or Origamy managed SMS after business verification (KYC).
    - channel: email
      for: The weekly report to your team
      needs: Nothing extra. Reports go to your team members by email.
  events:
    - onboarding.submitted
    - booking.created
    - booking.cancelled
  traits:
    - tour_at
    - admission_stage
    - admission_decision

parameters:
  - key: org_name
    ask: true
    question: What should messages call your school?
    label: School name
    type: string
    example: Northwind Academy
  - key: admissions_team
    ask: true
    question: Which team calls new enquiries and follows up after tours? (can be one person)
    label: Admissions team
    type: team_name
    default: Admissions
  - key: head_team
    ask: true
    question: Who should hear if admissions is slow, and get the weekly report? (for example the head teacher)
    label: Head teacher
    type: team_name
    default: Head teacher
  - key: tour_where
    ask: true
    question: Where should parents go when they arrive for a tour?
    label: Arrival directions
    type: text
    example: "Come to the front gate and ask for the admissions office."
  - key: school_phone
    ask: true
    question: Which number should parents call to change a tour or ask a question?
    label: School phone
    type: string
    default: "{{ workspace.phone }}"
  - key: enquiry_due_hours
    label: Hours admissions has to call a new enquiry
    type: hours
    default: 24
  - key: review_due_hours
    label: Hours admissions has to review a new application
    type: hours
    default: 72
  - key: follow_up_time
    label: Daily time for the after-tour follow-up
    type: time
    default: "09:00"
  - key: report_cron
    label: Weekly admissions report
    type: cron
    default: "0 8 * * 1"
  - key: default_country
    label: Default phone country on the forms
    type: country_code
    default: "{{ workspace.country }}"
  - key: greeting_fallback
    label: Greeting when a first name is missing
    type: string
    default: there
  - key: timezone
    label: Time zone for the daily and hourly runs
    type: timezone
    default: "{{ workspace.timezone }}"

timings:
  - A new enquiry gets an SMS straight away, and admissions gets a call task due in {{ params.enquiry_due_hours }} hours. If nobody has responded by then, it escalates to {{ params.head_team }}.
  - A booked tour is confirmed by SMS straight away. A reminder goes out when the tour is less than a day away. The reminders run every hour.
  - Every day at {{ params.follow_up_time }} ({{ params.timezone }}), parents who toured in the last day get the application link by SMS, and admissions gets a call task due in 24 hours.
  - A submitted application gets an SMS straight away and a review task due in {{ params.review_due_hours }} hours.
  - A decision recorded on the Admission decision form sends the matching SMS straight away.
  - "Weekly admissions report: {{ params.report_cron }} in {{ params.timezone }}."

customer_must:
  - "Open the Tour booking form in the form builder and set your tour days, times and how many families fit in a slot. The playbook creates the form with the slot question; the opening hours are yours."
  - "Switch on the \"Tour booked\" and \"Tour cancelled\" follow-ups: they copy each tour's time onto the parent, which is what the reminders read."
  - Add your admissions staff to the {{ params.admissions_team }} team and the head teacher to {{ params.head_team }} (Settings → Collaborators → Teams). A task assigned to an empty team reaches nobody.
  - "Have admissions fill in the Admission decision form for every family as soon as a decision is made. It matches the parent by phone number, so use the number on their enquiry. The internal note is never sent to the parent, but keep it factual anyway."
  - Publish the four forms, connect an SMS provider or finish business verification, then switch the follow-ups and the report on and test with your own phone.

objects:
  - ref: team_admissions
    kind: team
    about: Gets the enquiry calls, the after-tour calls and the application reviews.
    body: { name: "{{ params.admissions_team }}" }
  - ref: team_head
    kind: team
    about: Hears about calls and reviews not done in time; gets the weekly report.
    body: { name: "{{ params.head_team }}" }

  - ref: form_enquiry
    kind: form
    about: The enquiry form. A hidden field marks the family as an enquiry.
    body:
      name: School Enquiry
      slug: school-enquiry
      description: Tell us about your child and we'll be in touch.
      draft_state:
        version: 1
        meta: { layout: classic, submit_label: Send enquiry, success_message: "Thank you! Someone from {{ params.org_name }} will call you soon." }
        pages:
          - id: p1
            title: Enquire about a place
            description: A few details so we can call you back.
            fields:
              - { id: f_first, key: first_name, type: short_text, label: Your first name, required: true, maps_to: { mode: custom, key: first_name, trait: true } }
              - { id: f_last, key: last_name, type: short_text, label: Your surname, required: true, maps_to: { mode: custom, key: last_name, trait: true } }
              - { id: f_phone, key: phone, type: phone, label: Your phone number (WhatsApp if you have it), 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: Your email address, required: false, maps_to: { mode: mapped, slot: profile.email } }
              - id: f_class
                key: child_class
                type: single_select
                label: Which stage is your child joining?
                required: true
                maps_to: { mode: custom, key: child_class }
                options:
                  - { value: nursery, label: Nursery or pre-school }
                  - { value: primary, label: Primary }
                  - { value: secondary, label: Secondary }
              - id: f_term
                key: start_term
                type: single_select
                label: When would you like your child to start?
                required: true
                maps_to: { mode: custom, key: start_term }
                options:
                  - { value: next_term, label: Next term }
                  - { value: following_term, label: The term after }
                  - { value: next_year, label: Next academic year }
                  - { value: not_sure, label: Not sure yet }
              - id: f_heard
                key: heard_from
                type: single_select
                label: How did you hear about us?
                required: false
                maps_to: { mode: custom, key: heard_from }
                options:
                  - { value: friend, label: Friend or family }
                  - { value: social, label: Social media }
                  - { value: passing, label: Passed the school }
                  - { value: event, label: A school event }
                  - { value: search, label: Online search }
                  - { value: other, label: Other }
              - { id: f_stage, key: stage, type: hidden, label: "", required: false, default: enquiry, maps_to: { mode: custom, key: admission_stage, trait: true } }
      verification_settings: { required: false }
  - ref: form_tour
    kind: form
    about: The tour booking form. Each booking sends booking.created with the tour's start time.
    body:
      name: School Tour
      slug: school-tour
      description: Book a time to see the school.
      draft_state:
        version: 1
        meta: { layout: classic, submit_label: Book my tour, success_message: "You're booked. We'll text you to confirm." }
        pages:
          - id: p1
            title: Book a school tour
            description: Choose a time that suits you.
            fields:
              - { id: f_first, key: first_name, type: short_text, label: Your first name, required: true, maps_to: { mode: custom, key: first_name, trait: true } }
              - { id: f_phone, key: phone, type: phone, label: Your phone number, required: true, maps_to: { mode: mapped, slot: profile.phone }, config: { country_picker: true, default_country: "{{ params.default_country }}", verify: "off" } }
              - { id: f_slot, key: tour_slot, type: date_slot, label: Pick a day and time, required: true, maps_to: { mode: mapped, slot: booking.slot } }
      verification_settings: { required: false }
  - ref: form_apply
    kind: form
    about: The application form. A hidden field moves the family to the applied stage.
    body:
      name: School Application
      slug: school-application
      description: Apply for a place at our school.
      draft_state:
        version: 1
        meta: { layout: classic, submit_label: Submit application, success_message: "Thank you! We've received your application and will be in touch." }
        pages:
          - id: p1
            title: Apply for a place
            description: Please fill in this form once for each child.
            fields:
              - { id: f_first, key: first_name, type: short_text, label: Parent's first name, required: true, maps_to: { mode: custom, key: first_name, trait: true } }
              - { id: f_last, key: last_name, type: short_text, label: Parent's surname, required: true, maps_to: { mode: custom, key: last_name, trait: true } }
              - { id: f_phone, key: phone, type: phone, label: Parent's phone number, 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: Parent's email address, required: false, maps_to: { mode: mapped, slot: profile.email } }
              - { id: f_child_name, key: child_name, type: short_text, label: Child's full name, required: true, maps_to: { mode: custom, key: child_name } }
              - { id: f_child_dob, key: child_birth_date, type: date, label: Child's date of birth, required: true, maps_to: { mode: custom, key: child_birth_date } }
              - id: f_class
                key: child_class
                type: single_select
                label: Which stage is your child applying for?
                required: true
                maps_to: { mode: custom, key: child_class }
                options:
                  - { value: nursery, label: Nursery or pre-school }
                  - { value: primary, label: Primary }
                  - { value: secondary, label: Secondary }
              - { id: f_prev, key: previous_school, type: short_text, label: Current or previous school (if any), required: false, maps_to: { mode: custom, key: previous_school } }
              - { id: f_notes, key: parent_notes, type: long_text, label: Anything you'd like us to know?, required: false, maps_to: { mode: custom, key: parent_notes } }
              - { id: f_stage, key: stage, type: hidden, label: "", required: false, default: applied, maps_to: { mode: custom, key: admission_stage, trait: true } }
      verification_settings: { required: false }
  - ref: form_decision
    kind: form
    about: Staff-only form the admissions office fills in to record a decision. Matched to the parent by phone.
    body:
      name: Admission Decision
      slug: admission-decision
      description: Admissions office only. One entry for each family, when a decision is made.
      draft_state:
        version: 1
        meta: { layout: classic, submit_label: Save decision, success_message: Saved. The parent will be told by SMS. }
        pages:
          - id: p1
            title: Admission decision
            description: Use the phone number from the enquiry.
            fields:
              - { id: f_phone, key: phone, type: phone, label: Parent's phone number, required: true, maps_to: { mode: mapped, slot: profile.phone }, config: { country_picker: true, default_country: "{{ params.default_country }}", verify: "off" } }
              - id: f_decision
                key: admission_decision
                type: multiple_choice
                label: Decision
                required: true
                maps_to: { mode: custom, key: admission_decision, trait: true }
                options:
                  - { value: offered, label: Offered a place }
                  - { value: waitlisted, label: Put on the waiting list }
                  - { value: declined, label: Not offered a place }
              - { id: f_by, key: decided_by, type: short_text, label: Your name, required: true, maps_to: { mode: custom, key: decided_by } }
              - { id: f_note, key: decision_note, type: long_text, label: Internal note (the parent never sees this), required: false, maps_to: { mode: custom, key: decision_note } }
      verification_settings: { required: false }

  - ref: seg_tour_soon
    kind: segment
    about: Tour within the next day.
    body:
      name: Tour within a day
      description: tour_at within the next 24 hours.
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: tour_at, cond_operator: within_next, value: 1d }
  - ref: seg_toured
    kind: segment
    about: Toured in the last day and hasn't applied yet.
    body:
      name: Toured in the last day
      description: tour_at within the last day, and the admission stage is not applied.
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: tour_at, cond_operator: within_last, value: 1d }
          - { type: trait, trait_key: admission_stage, cond_operator: neq, value: applied }
  - ref: seg_enquiry
    kind: segment
    about: Families at the enquiry stage.
    body:
      name: Enquiries
      description: Admission stage is enquiry (set by the Enquiry form).
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: admission_stage, cond_operator: eq, value: enquiry }
  - ref: seg_applied
    kind: segment
    about: Families who applied and are waiting for a decision.
    body:
      name: Applied, waiting for a decision
      description: Admission stage is applied (set by the Application form).
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: admission_stage, cond_operator: eq, value: applied }
  - ref: seg_offered
    kind: segment
    about: Families offered a place.
    body:
      name: Offered a place
      description: Admission stage is offered (set when the decision is recorded).
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: admission_stage, cond_operator: eq, value: offered }
  - ref: seg_waitlisted
    kind: segment
    about: Families on the waiting list.
    body:
      name: On the waiting list
      description: Admission stage is waitlisted (set when the decision is recorded).
      segment_type: dynamic
      status: active
      definition:
        operator: and
        conditions:
          - { type: trait, trait_key: admission_stage, cond_operator: eq, value: waitlisted }

  - ref: tmpl_enquiry
    kind: template
    about: Thank-you SMS with the tour booking link.
    body:
      name: Enquiry received (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: hello {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}, thank you for your enquiry. We'd love to show you around. Book a tour here: {{ ref.form_tour.url }} or call {{ params.school_phone }}. Reply STOP to opt out."
  - ref: tmpl_tour_confirm
    kind: template
    about: Tour confirmation by SMS.
    body:
      name: Tour booked (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: your tour is booked for {{ properties.slot_start_ts | date: \"%a %-d %b, %H:%M\" }}. {{ params.tour_where }} To change it, call {{ params.school_phone }}. Reply STOP to opt out."
  - ref: tmpl_tour_reminder
    kind: template
    about: Reminder the day before the tour.
    body:
      name: Tour tomorrow (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: a reminder of your school tour on {{ traits.tour_at | date: \"%a %-d %b, %H:%M\" }}. {{ params.tour_where }} Can't make it? Call {{ params.school_phone }}. Reply STOP to opt out."
  - ref: tmpl_tour_follow_up
    kind: template
    about: After-tour SMS with the application link.
    body:
      name: After the tour (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: thank you for visiting us, {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}. We hope you enjoyed the tour. When you're ready, you can apply here: {{ ref.form_apply.url }} Questions? Call {{ params.school_phone }}. Reply STOP to opt out."
  - ref: tmpl_applied
    kind: template
    about: Acknowledgement when an application comes in.
    body:
      name: Application received (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: thank you, {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}. We've received your application. Our admissions office will be in touch about the next steps. Reply STOP to opt out."
  - ref: tmpl_offered
    kind: template
    about: Message when a place is offered.
    body:
      name: Place offered (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: good news, {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}! We're pleased to offer your child a place. Please call {{ params.school_phone }} to accept it and we'll explain the next steps. Reply STOP to opt out."
  - ref: tmpl_waitlisted
    kind: template
    about: Message when a family goes on the waiting list.
    body:
      name: Waiting list (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: thank you for applying, {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}. Your child is on our waiting list and we'll contact you as soon as a place opens. Questions? Call {{ params.school_phone }}. Reply STOP to opt out."
  - ref: tmpl_declined
    kind: template
    about: Kind message when a place can't be offered.
    body:
      name: Place not offered (SMS)
      channel: sms
      category: Admissions
      style: text
      status: active
      subject: ""
      metadata: {}
      variables: {}
      body: "{{ params.org_name }}: thank you for applying and for your interest in our school, {{ traits.first_name | default: \"{{ params.greeting_fallback }}\" }}. We're not able to offer a place this time. You're welcome to apply again for a later intake. We wish your family all the best. Reply STOP to opt out."

  - ref: report_weekly
    kind: report
    about: Where families are now and how admissions is keeping up, to the head teacher each week.
    body:
      name: "Weekly: admissions"
      description: Where families stand in admissions, and the state of the admissions calls and reviews.
      schedule_cron: "{{ params.report_cron }}"
      timezone: "{{ params.timezone }}"
      enabled: false
      spec:
        period: last_7_days
        compare: previous_period
        week_start: monday
        sections:
          - id: stages
            kind: segment_sizes
            title: Where families are now
            params: { segment_ids: ["{{ ref.seg_enquiry.id }}", "{{ ref.seg_applied.id }}", "{{ ref.seg_offered.id }}", "{{ ref.seg_waitlisted.id }}"] }
          - { id: tasks, kind: tasks_summary, title: Admissions calls and reviews, params: {} }
          - { id: note, kind: text, params: { body: "Families still at the enquiry stage need a call or a tour booking. Tour booking link: {{ ref.form_tour.url }}" } }
      recipients: [{ type: team, id: "{{ ref.team_head.id }}" }]
      channel_policy: { mode: email_only }

  - ref: wf_enquiry
    kind: workflow
    about: A new enquiry gets the tour link by SMS and a call task for admissions, escalated to the head teacher if nobody calls.
    body:
      name: "Tour 1: new enquiry"
      description: SMS with the tour booking link and a call task for admissions; the outcome and note are saved on the parent.
      enabled: false
      trigger_type: event
      trigger_config: { event_name: onboarding.submitted, form_id: "{{ ref.form_enquiry.id }}" }
      steps:
        - { id: s1, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_enquiry.id }}" } } } }
        - id: s2
          type: human_task
          config:
            human_task:
              title: "Call enquiry: {{ traits.first_name }} {{ traits.last_name }}"
              instructions: |-
                {{ traits.first_name }} {{ traits.last_name }} ({{ traits.phone }}) asked about a place.
                Stage: {{ properties.child_class | default: "not given" }}. Starting: {{ properties.start_term | default: "not given" }}. Heard about us: {{ properties.heard_from | default: "not given" }}.

                Call, answer their questions and invite them to book a tour. Choose an outcome and add a short note.
              assignee_refs: [{ type: team, id: "{{ ref.team_admissions.id }}" }]
              strategy: round_robin
              completion_policy: first_response_wins
              outcome_options:
                - { id: tour_booked, label: Booked a tour, intent: positive }
                - { id: thinking, label: Thinking about it, intent: neutral }
                - { id: not_interested, label: Not interested, intent: neutral }
                - { id: not_reached, label: Could not reach, intent: negative }
              due_hours: "{{ params.enquiry_due_hours }}"
              wait: true
              wait_timeout_hours: 168
              notify: immediate
              escalation_ladder:
                - { after_hours: "{{ params.enquiry_due_hours }}", to: [{ type: team, id: "{{ ref.team_head.id }}" }] }
        - { id: s3, type: action, config: { action_type: set_trait, traits: { enquiry_call: "{{ properties.task_outcome | default: \"unknown\" }}", enquiry_call_note: "{{ properties.task_note }}" } } }
      re_entry_policy: cooldown
      re_entry_cooldown_hours: 168
      goal: {}
      exit_conditions: []
  - ref: wf_tour_booked
    kind: workflow
    about: When a tour is booked, save its time on the parent and confirm by SMS.
    body:
      name: "Tour 2: tour booked"
      description: Copies the tour's time onto the parent and confirms it by SMS.
      enabled: false
      trigger_type: event
      trigger_config: { event_name: booking.created, form_id: "{{ ref.form_tour.id }}" }
      steps:
        - { id: s1, type: action, config: { action_type: set_trait, traits: { tour_at: "{{ properties.slot_start_ts }}" } } }
        - { id: s2, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_tour_confirm.id }}" } } } }
      re_entry_policy: every_time
      re_entry_cooldown_hours: 0
      goal: {}
      exit_conditions: []
  - ref: wf_tour_cancelled
    kind: workflow
    about: A cancelled tour clears the saved time, so no reminder goes out.
    body:
      name: "Tour 3: tour cancelled"
      description: Clears the saved tour time when a booking is cancelled.
      enabled: false
      trigger_type: event
      trigger_config: { event_name: booking.cancelled, form_id: "{{ ref.form_tour.id }}" }
      steps:
        - { id: s1, type: action, config: { action_type: set_trait, traits: { tour_at: "" } } }
      re_entry_policy: every_time
      re_entry_cooldown_hours: 0
      goal: {}
      exit_conditions: []
  - ref: wf_tour_reminder
    kind: workflow
    about: Hourly run over "tour within a day"; one reminder per tour.
    body:
      name: "Tour 4: reminder the day before"
      description: Every hour, a reminder to parents whose tour is less than a day away.
      enabled: false
      trigger_type: schedule
      trigger_config: { segment_id: "{{ ref.seg_tour_soon.id }}", rrule: FREQ=HOURLY, starts_at: "{{ workspace.tomorrow }}T07:00", timezone: "{{ params.timezone }}" }
      steps:
        - { id: s1, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_tour_reminder.id }}" } } } }
      re_entry_policy: cooldown
      re_entry_cooldown_hours: 30
      goal: {}
      exit_conditions: []
  - ref: wf_tour_follow_up
    kind: workflow
    about: 'Daily run over "toured in the last day": the application link by SMS and a "how was the tour?" call for admissions.'
    body:
      name: "Tour 5: after the tour"
      description: Every day, parents who toured in the last day get the application link, and admissions gets a call task; the outcome is saved on the parent.
      enabled: false
      trigger_type: schedule
      trigger_config: { segment_id: "{{ ref.seg_toured.id }}", rrule: FREQ=DAILY, starts_at: "{{ workspace.tomorrow }}T{{ params.follow_up_time }}", timezone: "{{ params.timezone }}" }
      steps:
        - { id: s1, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_tour_follow_up.id }}" } } } }
        - id: s2
          type: human_task
          config:
            human_task:
              title: "How was the tour? {{ traits.first_name }} {{ traits.last_name }}"
              instructions: |-
                {{ traits.first_name }} {{ traits.last_name }} ({{ traits.phone }}) toured the school recently.

                Call to ask how it went and answer any questions. Remind them the application link was sent by SMS. Choose an outcome and add a short note.
              assignee_refs: [{ type: team, id: "{{ ref.team_admissions.id }}" }]
              strategy: round_robin
              completion_policy: first_response_wins
              outcome_options:
                - { id: applying, label: Will apply, intent: positive }
                - { id: thinking, label: Still thinking, intent: neutral }
                - { id: not_interested, label: Not interested, intent: neutral }
                - { id: not_reached, label: Could not reach, intent: negative }
              due_hours: 24
              wait: true
              wait_timeout_hours: 168
              notify: immediate
        - { id: s3, type: action, config: { action_type: set_trait, traits: { tour_follow_up: "{{ properties.task_outcome | default: \"unknown\" }}", tour_follow_up_note: "{{ properties.task_note }}" } } }
      re_entry_policy: cooldown
      re_entry_cooldown_hours: 168
      goal: {}
      exit_conditions: []
  - ref: wf_applied
    kind: workflow
    about: An application gets an SMS acknowledgement and a review task for admissions, escalated to the head teacher.
    body:
      name: "Tour 6: application received"
      description: SMS acknowledgement and a review task when the Application form is submitted.
      enabled: false
      trigger_type: event
      trigger_config: { event_name: onboarding.submitted, form_id: "{{ ref.form_apply.id }}" }
      steps:
        - { id: s1, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_applied.id }}" } } } }
        - id: s2
          type: human_task
          config:
            human_task:
              title: "Review application: {{ traits.first_name }} {{ traits.last_name }}"
              instructions: |-
                {{ traits.first_name }} {{ traits.last_name }} ({{ traits.phone }}) applied for a place: {{ properties.child_class | default: "stage not given" }}.

                Review the application. When a decision is made, record it on the Admission Decision form so the parent is told. Choose an outcome and add a note.
              assignee_refs: [{ type: team, id: "{{ ref.team_admissions.id }}" }]
              strategy: round_robin
              completion_policy: first_response_wins
              outcome_options:
                - { id: decided, label: Decision recorded, intent: positive }
                - { id: more_needed, label: Need more from the parent, intent: neutral }
              due_hours: "{{ params.review_due_hours }}"
              wait: true
              wait_timeout_hours: 336
              notify: immediate
              escalation_ladder:
                - { after_hours: "{{ params.review_due_hours }}", to: [{ type: team, id: "{{ ref.team_head.id }}" }] }
        - { id: s3, type: action, config: { action_type: set_trait, traits: { application_review: "{{ properties.task_outcome | default: \"unknown\" }}", application_review_note: "{{ properties.task_note }}" } } }
      re_entry_policy: every_time
      re_entry_cooldown_hours: 0
      goal: {}
      exit_conditions: []
  - ref: wf_offered
    kind: workflow
    about: 'Admissions records "offered a place": the parent gets the offer message.'
    body:
      name: "Tour 7: place offered"
      description: When admissions records an offer, the stage is saved and the parent gets an SMS.
      enabled: false
      trigger_type: event
      trigger_config:
        event_name: onboarding.submitted
        form_id: "{{ ref.form_decision.id }}"
        property_filters: [{ property: admission_decision, cond_operator: eq, value: offered }]
        properties: { $origamy_property_filters: true }
      steps:
        - { id: s1, type: action, config: { action_type: set_trait, traits: { admission_stage: offered } } }
        - { id: s2, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_offered.id }}" } } } }
      re_entry_policy: every_time
      re_entry_cooldown_hours: 0
      goal: {}
      exit_conditions: []
  - ref: wf_waitlisted
    kind: workflow
    about: 'Admissions records "waiting list": the parent gets the waiting-list message.'
    body:
      name: "Tour 8: waiting list"
      description: When admissions records a waiting-list decision, the stage is saved and the parent gets an SMS.
      enabled: false
      trigger_type: event
      trigger_config:
        event_name: onboarding.submitted
        form_id: "{{ ref.form_decision.id }}"
        property_filters: [{ property: admission_decision, cond_operator: eq, value: waitlisted }]
        properties: { $origamy_property_filters: true }
      steps:
        - { id: s1, type: action, config: { action_type: set_trait, traits: { admission_stage: waitlisted } } }
        - { id: s2, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_waitlisted.id }}" } } } }
      re_entry_policy: every_time
      re_entry_cooldown_hours: 0
      goal: {}
      exit_conditions: []
  - ref: wf_declined
    kind: workflow
    about: 'Admissions records "not offered": the parent gets a kind message.'
    body:
      name: "Tour 9: place not offered"
      description: When admissions records a decline, the stage is saved and the parent gets a kind SMS.
      enabled: false
      trigger_type: event
      trigger_config:
        event_name: onboarding.submitted
        form_id: "{{ ref.form_decision.id }}"
        property_filters: [{ property: admission_decision, cond_operator: eq, value: declined }]
        properties: { $origamy_property_filters: true }
      steps:
        - { id: s1, type: action, config: { action_type: set_trait, traits: { admission_stage: declined } } }
        - { id: s2, type: action, config: { action_type: send_message, channel_config: { mode: single, single: { channel: sms, template_id: "{{ ref.tmpl_declined.id }}" } } } }
      re_entry_policy: every_time
      re_entry_cooldown_hours: 0
      goal: {}
      exit_conditions: []

eval:
  name: 95_schools_school_tour_to_enrolment
  mode: task
  vertical: ""
  prompt: >-
    We're a private primary school. When parents fill in our enquiry form, text them a link to
    book a school tour and give admissions a task to call them within a day. Text a
    confirmation when a tour is booked and a reminder the day before. The morning after the
    tour, text them our application link and have admissions call to ask how it went. When we
    record that a child is offered a place, waitlisted or declined, text the parent the right
    message. Email the head teacher a weekly summary of where families are.
  expect_artifacts: [form, segment, workflow, message_template, report]
  forbid_terms: []
