4.9 KiB
4.9 KiB
Zoho CRM Setup Guide for Queue North Admins
This guide walks you through setting up Zoho CRM integration to automatically capture leads and support cases from Queue North's website.
🔒 Prerequisites
Before you begin, ensure you have:
- A Zoho CRM account (admin access required)
- Access to Zoho API Console: https://api-console.zoho.com
Step 1: Create a Zoho Self-Client App
- Go to https://api-console.zoho.com
- Click "Create Self Client"
- Fill in:
- Client Name: Queue-North-Zoho-Integration
- Description: Auto-capture leads and cases from Queue North website
- Redirect URI:
https://www.zoho.com(required for Self-Client, not used)
- Click Create
- Copy and save:
- Client ID
- Client Secret
⚠️ Store these securely — they're like a username and password.
Step 2: Generate an Authorization Code
- In the Self Client tab, click "Generate Code"
- Set the Scope to:
ZohoCRM.modules.leads.CREATE,ZohoCRM.modules.leads.READ,ZohoCRM.modules.cases.CREATE,ZohoCRM.modules.cases.READ - Set Expiry to 10 minutes (use it quickly)
- Click Generate
- Copy the authorization code — it expires in 10 minutes
Step 3: Exchange Auth Code for Tokens
Run this curl command (replace placeholders):
curl -X POST https://accounts.zoho.com/oauth/v2/token \
-d "code=<YOUR_AUTH_CODE>" \
-d "client_id=<YOUR_CLIENT_ID>" \
-d "client_secret=<YOUR_CLIENT_SECRET>" \
-d "grant_type=authorization_code" \
-d "redirect_uri=https://www.zoho.com"
Response will include:
{
"access_token": "1000.xxxxx.xxxxx",
"refresh_token": "1000.yyyyy.yyyyy",
"expires_in": 3600,
"token_type": "bearer"
}
Save the refresh_token — this never expires and must be kept secret.
Step 4: Configure Environment Variables
Add these to your .env file:
ZOHO_ENABLED=true
ZOHO_API_DOMAIN=https://www.zohoapis.com
ZOHO_ACCOUNTS_DOMAIN=https://accounts.zoho.com
ZOHO_CLIENT_ID=<from Step 1>
ZOHO_CLIENT_SECRET=<from Step 1>
ZOHO_REFRESH_TOKEN=<from Step 3>
ZOHO_CASES_ENABLED=true
Datacenter Variants
If your Zoho datacenter is outside the US, adjust the domains:
| Region | API Domain | Accounts Domain |
|---|---|---|
| US | www.zohoapis.com |
accounts.zoho.com |
| EU | www.zohoapis.eu |
accounts.zoho.eu |
| IN | www.zohoapis.in |
accounts.zoho.in |
| AU | www.zohoapis.com.au |
accounts.zoho.com.au |
Step 5: Test the Integration
Test Lead Capture
- Submit a lead on the contact form (name, email, phone, message)
- Wait ~5–10 seconds
- Log in to Zoho CRM → Leads tab
- Verify the new lead appears with correct data
Test Case Capture
- Submit a support request (e.g., booking inquiry, technical question)
- Wait ~5–10 seconds
- Log in to Zoho CRM → Cases tab
- Verify the new case appears with correct data
Troubleshooting
Token Errors
- "invalid_grant": Your authorization code expired. Generate a new one in Step 2 and repeat Step 3.
- "invalid_client": Double-check Client ID and Secret — no extra spaces.
- "invalid_scope": Re-run Step 2 with the exact scopes listed above.
Field Mismatches
- If leads/cases don't appear, check if Zoho requires custom fields like
Service_Interest - Edit the field mapping in
server/zoho/to match your Zoho CRM field API names
Cases Not Appearing
- Ensure
ZOHO_CASES_ENABLED=trueis set - Verify the Cases tab is enabled in your Zoho CRM plan
- Check that your Zoho CRM user has Cases CREATE permissions
Lead Upsert Behavior
- Leads are upserted by email: duplicate email = update existing lead
- Cases are always inserted (new ticket each time)
- If you see duplicate leads, check for slight email variations (e.g.,
test@vstest+1@)
Architecture Notes
Flow Overview
Website Contact Form → SQLite (always saved)
↓
Zoho CRM (best-effort)
↓
Fire-and-forget (no failure blocking)
OAuth2 Refresh Token Flow
- Use
refresh_tokento get a newaccess_tokenwhen expired access_tokenexpires in 1 hourrefresh_tokennever expires — store it securely
Upsert Logic
- Leads: Email-based upsert (update if exists, create if new)
- Cases: Always insert (new case per submission)
Fire-and-Forget Design
- Zoho failures do not block form submissions
- All data is saved to SQLite first
- Zoho attempts happen in the background
- No retry logic needed — users won't wait for Zoho
What Happens Next?
After configuration, your team (Ripley + Bishop) will:
- Deploy environment variables to production
- Run integration tests
- Verify data flows to Zoho CRM
- Update
PROJECT.mdwith the integration status
Questions? Contact Ripley (Infrastructure) or Neo (Backend).