# Zoho CRM Setup Guide for Queue North Admins This guide walks you through the current Zoho CRM integration. Contact leads use the legacy Zoho WebToLead form tokens, while the OAuth/API integration remains available as a standby option for future lead upserts or support cases. --- ## Prerequisites Before you begin, ensure you have: - A Zoho CRM account (admin access required) - The WebToLead hidden field values from the old Zoho form --- ## Step 1: Gather WebToLead Values The current integration needs the old Zoho form's hidden fields: ```text xnQsjsdp xmIwtLD actionType returnURL zc_gad ``` These values are stored locally in `zoho.md`, which is ignored by git. --- ## Optional Standby: Create a Zoho Self-Client App Only use these OAuth steps if switching `ZOHO_FORWARDING_MODE=api`. 1. Go to **https://api-console.zoho.com** 2. Click **"Create Self Client"** 3. 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) 4. Click **Create** 5. **Copy and save**: - **Client ID** - **Client Secret** > ⚠️ Store these securely — they're like a username and password. --- ## Optional Standby: Generate an Authorization Code 1. In the Self Client tab, click **"Generate Code"** 2. Set the **Scope** to: ``` ZohoCRM.modules.leads.CREATE,ZohoCRM.modules.leads.READ,ZohoCRM.modules.cases.CREATE,ZohoCRM.modules.cases.READ ``` 3. Set **Expiry** to **10 minutes** (use it quickly) 4. Click **Generate** 5. **Copy the authorization code** — it expires in 10 minutes --- ## Optional Standby: Exchange Auth Code for Tokens Run this `curl` command (replace placeholders): ```bash curl -X POST https://accounts.zoho.com/oauth/v2/token \ -d "code=" \ -d "client_id=" \ -d "client_secret=" \ -d "grant_type=authorization_code" \ -d "redirect_uri=https://www.zoho.com" ``` **Response will include:** ```json { "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 2: Configure Environment Variables The current production-friendly setup uses the legacy Zoho WebToLead form tokens for contact leads while keeping the OAuth API integration available as a standby option. Add these to your `.env` file for WebToLead lead forwarding: ```env ZOHO_FORWARDING_MODE=webtolead ZOHO_WEBTOLEAD_ENABLED=true ZOHO_WEBTOLEAD_URL=https://crm.zoho.com/crm/WebToLeadForm ZOHO_WEBTOLEAD_XNQSJSDP=