# Testing Zoho CRM Integration ## Prerequisites Your `.env` file now contains: - `ZOHO_CLIENT_ID` ✓ - `ZOHO_CLIENT_SECRET` ✓ ## Testing Process ### Option 1: Using the Test Script (Recommended) 1. Open a terminal and run: ```bash cd /Users/ben/dev/upskill-event-manager/wordpress-dev ./bin/test-zoho-integration.sh ``` 2. When prompted, choose 'y' to start the OAuth callback server 3. Open a new terminal and run the script again, choosing 'n' this time 4. Follow the prompts: - Open the authorization URL in your browser - Log in to Zoho and authorize the app - Copy the authorization code from the callback page - Paste it in the terminal ### Option 2: Manual Testing 1. Generate the authorization URL: ``` https://accounts.zoho.com/oauth/v2/auth? scope=ZohoCRM.settings.all,ZohoCRM.modules.all,ZohoCRM.users.all,ZohoCRM.org.all& client_id=1000.Z0HOF1VMMJ9W2QWSU57GVQYEAVUSKS& response_type=code& access_type=offline& redirect_uri=http://localhost:8080/callback& prompt=consent ``` 2. Open the URL in your browser 3. After authorization, copy the code from the redirect URL 4. Run the test script: ```bash cd /Users/ben/dev/upskill-event-manager/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/zoho php test-integration.php ``` 5. Paste the authorization code when prompted ## What the Test Does 1. **Validates Credentials** - Checks that your client ID and secret work 2. **Gets Tokens** - Exchanges the auth code for access and refresh tokens 3. **Fetches Org Info** - Gets your Zoho organization details 4. **Tests Module Access** - Verifies access to Campaigns, Contacts, and Invoices 5. **Creates Config File** - Saves all credentials to `zoho-config.php` 6. **Updates .env** - Adds the refresh token for future use ## Expected Output You should see: - ✓ Credentials loaded from .env file - ✓ Tokens received successfully - ✓ Organization found - ✓ Campaigns module accessible - ✓ Contacts module accessible - ✓ Invoices module accessible - ✓ Configuration file created ## Next Steps After successful testing: 1. The system is ready for field creation 2. You can start syncing data 3. Check WordPress admin → Events → Zoho CRM for status ## Troubleshooting ### "Invalid Client" Error - Verify the client ID and secret in your .env file - Check that you're using the correct Zoho data center (US, EU, IN, AU) ### "Invalid Code" Error - Authorization codes expire in ~1 minute - Generate a new code and use it immediately ### Connection Issues - Make sure you can access https://accounts.zoho.com - Check if you need to use a different regional URL ### Module Access Issues - Ensure all required modules are enabled in your Zoho CRM - Check that your Zoho plan includes API access