# Salesforce integration via Zapier

Removes the "ConstructConnect / Dodge integrate with Salesforce" objection.
SFDC integration via Zapier is slightly heavier than HubSpot / Pipedrive
(Salesforce's data model is more rigid) but still no native connector
required on our side.

> Setup: 15 minutes — Salesforce's permission model is the slowest part.
> Recurring cost: $0 incremental (Salesforce subscription is its own
> line; Zapier free tier covers 100 tasks/month).

## End-to-end Zap

### Step 1 — Trigger
- **Webhooks by Zapier** → **Catch Hook**
- Paste the URL into Shovel Radar dashboard → Account → Webhook URL

### Step 2 — Filter
- Filter: `delivery.row_count > 0`

### Step 3 — Loop over permits
- **Looping by Zapier** → loop over `delivery.permits`

### Step 4 — Find or create Salesforce Account
- App: **Salesforce** → Event: **Find Record**
- Object: Account · Lookup field: `Name`
- Lookup value: applicant or contractor
- If not found → branch to **Create Record (Account)**
- Map:
  | Salesforce Field | Permit field |
  |---|---|
  | Name             | applicant or contractor |
  | Type             | `Lead` or `Customer Prospect` |
  | Industry         | `Construction` |
  | BillingCity      | (city slug) |
  | Phone            | phone |

### Step 5 — Find or create Contact
- App: **Salesforce** → Event: **Find Record**
- Object: Contact · Lookup: by `Email` or `Phone`
- If not found → branch to **Create Record (Contact)**
- Map: standard contact fields + `AccountId` from Step 4

### Step 6 — Create Opportunity
- App: **Salesforce** → Event: **Create Record**
- Object: Opportunity
- Map fields:
  | SFDC Field        | Permit field |
  |---|---|
  | Name              | `{applicant} — {scope_short}` |
  | AccountId         | from Step 4 |
  | StageName         | `Prospecting` (or your first stage) |
  | CloseDate         | today + 90 days |
  | Amount            | cost |
  | LeadSource        | `Shovel Radar` |
  | Description       | full permit row |

### Step 7 — Add custom fields (one-time SFDC admin work)

Salesforce Admin needs to create these on the Opportunity object:
- `Permit_ID__c` (Text 32) — `permit_id`
- `Permit_Address__c` (Text 255) — `address`
- `Permit_Applied_Date__c` (Date) — `applied`
- `Permit_Source_URL__c` (URL 255) — `download_url`
- `Permit_Scope__c` (Long Text 1000) — `description`

After they exist, add them to Step 6's map.

### Step 8 — Add Task for the rep
- App: **Salesforce** → Event: **Create Task**
- Map fields:
  | SFDC Field | Permit field |
  |---|---|
  | Subject    | `Call {applicant} re permit at {address}` |
  | WhatId     | Opportunity from Step 6 |
  | OwnerId    | (your round-robin user, or queue) |
  | ActivityDate | today + 2 days |
  | Description| permit scope + cost + "Source: Shovel Radar weekly delivery on {run_date}" |
  | Type       | `Call` |
  | Priority   | `Normal` |

## Done — verify in Salesforce

1. Reports → New Report → Opportunities
2. Filter: `LeadSource = Shovel Radar AND CreatedDate = THIS WEEK`
3. Should match `delivery.row_count`

## Gotchas

- **Salesforce profile permissions** — the Salesforce user Zapier
  authenticates as needs Create on Accounts, Contacts, Opportunities,
  Tasks. Easiest: dedicated integration user with API access.
- **API limits** — Professional 1,000 API calls/day/license; Enterprise
  unlimited. 50-row weekly delivery uses ~200 calls — fine for both.
- **Duplicates** — Salesforce has built-in duplicate-rules at the
  Account + Contact level; verify they're enabled. Zapier's "Find
  Record" only finds exact matches, so fuzzy variants ("Acme Inc"
  vs "Acme Inc.") still create dupes.
- **Sandbox first** — test the Zap in a Salesforce sandbox before
  production. Bad mapping creates 50 garbage Opportunities; the only
  fix is mass-delete by report.
- **Multi-currency** — if your org is multi-currency enabled, set
  `CurrencyIsoCode` on every Opportunity in Step 6 to `CAD`.

## Cost

| Tier | Cost | Notes |
|---|---|---|
| Zapier Free | $0 | 100 tasks/mo |
| Zapier Professional | $50 USD/mo | Required for Salesforce premium-app actions on some events |
| Salesforce Essentials | $25 USD/user/mo | Includes API |
| Salesforce Professional | $80 USD/user/mo | Has Workflow Rules + Process Builder for downstream automation |

**Net for the typical case:** if you already pay for Salesforce
Professional, the integration is $50/mo extra Zapier + 15 minutes
of setup.

## When to escalate to a real Salesforce consultant

If any of these are true, hire a Salesforce admin:
- You need bidirectional sync (Salesforce changes flow back to Shovel Radar)
- You have custom validation rules that reject Zapier writes
- You need Lightning Web Components in the Opportunity UI
- You want a "Shovel Radar" custom object instead of repurposing Opportunity

For 95% of customers, the Zap above is enough.
