# Condo Intel — GHL Workflow Snapshot

This folder ships the GoHighLevel workflow snapshot that Condo Intel customers import after install. It contains two workflows that wire Condo Intel's outbound webhooks to actual sends inside GHL.

If `condo-intel-workflows.json` ever fails to import (GHL changes their JSON format from time to time), use the spec in this README to rebuild manually — every field and merge tag is documented.

---

## What's in the snapshot

### 1. Condo Intel — HOA Application Request

**Trigger:** Inbound Webhook
**Webhook URL:** auto-generated by GHL on publish — copy this URL into Condo Intel admin → Integration Settings → **HOA Application Webhook URL**.

**Purpose:** When a deal reaches the "ready to request HOA application" stage, Condo Intel POSTs the deal payload here. The workflow creates/updates the management-company contact, sends the application request email on the customer's branded template, and (optionally) sets a follow-up trigger 5 days out.

**Steps:**

1. **Inbound webhook (trigger)** — receives JSON with the deal payload.
2. **Find/Create Contact** by `management_company_email`. Set custom field `Condo Intel Payload` to the full incoming JSON.
3. **If/Else: management_company_email is not blank**
   - **Then →** Send Email step.
   - **Else →** Internal Notification to sender email.
4. **Send Email**
   - To: `{{custom_values.contact.email}}`
   - Subject: `Condo board application request — {{custom_values.condo_intel.property_address}}`
   - Body: HTML from your Condo Intel admin → Email Templates → "HOA Application Request" template. Body merge tags listed below.
5. **Wait 5 days** — gives the management company time to respond.
6. **Find/Update Contact** — Condo Intel will have updated the same contact via API by then. If `condo_intel.application_status` is still `requested`, fall into the follow-up branch.
7. **Send Email (follow-up)** — second touch with shorter body.

### 2. Condo Intel — Party Outreach

**Trigger:** Inbound Webhook
**Webhook URL:** auto-generated by GHL on publish — copy this URL into Condo Intel admin → Integration Settings → **Party Outreach Webhook URL**.

**Purpose:** Notifies the right party (agent / lender / title / buyer / seller) at the right moment with the right template. Condo Intel passes a `template_key` discriminator so the workflow can branch.

**Steps:**

1. **Inbound webhook (trigger)** — receives JSON with `party_type`, `template_key`, and the deal payload.
2. **Find/Create Contact** by party email.
3. **If/Else branch on `template_key`** — split into:
   - `welcome_buyer` — buyer welcome message
   - `welcome_seller` — seller welcome message
   - `agent_brief` — agent task briefing
   - `lender_intake` — lender intake request
   - `title_intake` — title company intake
   - `general_notification` — fallback
4. **Send Email** branches — each branch loads the matching template from your Condo Intel admin → Email Templates.

---

## Field mapping — what Condo Intel sends

Both webhooks POST a JSON body with these top-level fields. The workflow's custom-fields step should map every one of these to a contact custom field named `Condo Intel <Field>` so merge tags work cleanly.

```json
{
  "tenant_id": "abc-123",
  "deal_id": "def-456",
  "deal_url": "https://condo-intel-web.pages.dev/transactions/def-456",
  "template_key": "hoa_application_request",
  "party_type": "management_company",
  "to": {
    "email": "approvals@magnoliamgmt.com",
    "name": "Magnolia Property Management",
    "phone": "+19545551212"
  },
  "from": {
    "name": "Scott Lehr",
    "email": "scott@scottlehrrealtor.com",
    "brokerage": "RESF",
    "phone": "+19545550000"
  },
  "buyer_name": "John Smith",
  "seller_name": "Jane Doe",
  "property_address": "1234 Ocean Dr, Hollywood FL 33019",
  "association_name": "Ocean Towers Condominium Association",
  "management_company": "Magnolia Property Management",
  "sale_price_usd": 685000,
  "listing_effective_date": "2026-05-15",
  "listing_expiration_date": "2026-09-30",
  "contract_effective_date": "2026-06-01",
  "application_deadline": "2026-06-10",
  "approval_deadline": "2026-07-15",
  "closing_date": "2026-07-30",
  "mls_number": "F11234567",
  "listing_agent_name": "Scott Lehr",
  "listing_brokerage": "RESF",
  "buyer_agent_name": "Maria Rodriguez",
  "buyer_brokerage": "Acme Realty",
  "lender_name": "Wells Fargo",
  "title_company": "Florida Title Co",
  "deal_token": "k7d92mxhj1"
}
```

---

## Merge tags to use in your templates

Once the workflow stores the payload into the contact's custom fields, you can reference any field in the Send Email step using GHL's merge-tag syntax. Examples:

| What you want to insert | Merge tag |
|---|---|
| Buyer name | `{{contact.custom_field.condo_intel_buyer_name}}` |
| Property address | `{{contact.custom_field.condo_intel_property_address}}` |
| Association name | `{{contact.custom_field.condo_intel_association_name}}` |
| Application deadline | `{{contact.custom_field.condo_intel_application_deadline}}` |
| Approval deadline | `{{contact.custom_field.condo_intel_approval_deadline}}` |
| Closing date | `{{contact.custom_field.condo_intel_closing_date}}` |
| Sender name | `{{contact.custom_field.condo_intel_from_name}}` |
| Sender brokerage | `{{contact.custom_field.condo_intel_from_brokerage}}` |
| Link back to deal | `{{contact.custom_field.condo_intel_deal_url}}` |

Note: GHL's merge tag name is whatever you name the custom field. If you named the field "Condo Intel - Buyer Name", the tag is `{{contact.custom_field.condo_intel_buyer_name}}`. Keep the names lowercase with underscores for cleanest merge-tag generation.

---

## Import steps (customer-facing — same as on getting-started.html)

1. Download `condo-intel-workflows.json` from this folder.
2. In GoHighLevel sub-account → **Automation → Workflows → + Create Workflow → Import from File**.
3. Select the JSON. Two workflows appear:
   - **Condo Intel — HOA Application Request**
   - **Condo Intel — Party Outreach**
4. Open each one. The first node is **Inbound Webhook** — copy the URL it shows.
5. Click **Publish** on both workflows.
6. In Condo Intel admin → **Integration Settings → GHL Webhooks**:
   - Paste the **HOA Application** URL into the corresponding field.
   - Paste the **Party Outreach** URL into the corresponding field.
   - Save.

That's it. Real deals will now fire through your sub-account's email-sending domain on your branded templates.

---

## Troubleshooting the import

**"GHL won't import my JSON."**
GHL occasionally changes the snapshot format. If import fails, build the workflows manually using the spec above. The Condo Intel side doesn't care how the workflows are built — it just needs the two webhook URLs.

**"My contact custom fields don't auto-populate from the webhook."**
You need a **Update Contact** step after the inbound webhook trigger that explicitly maps each JSON field to a contact custom field. The Condo Intel admin → Email Templates editor shows you which fields are referenced by the default templates, so you know which ones to map.

**"Emails are sending from the wrong domain."**
Set the workflow's default sending email in **Email Configuration** (top of workflow editor). For best deliverability, set up a sending domain in **Settings → Email Services → Dedicated Domain & IP** first.

---

## Maintenance

When Condo Intel ships a new field (rare, but it happens), we'll update the JSON in this folder and announce it. Customers can re-import the updated workflow OR just add the new field to their existing contact custom-fields mapping — the snapshot is additive, not destructive.
