Please use our free Quform Zapier add-on to integrate with Zoho CRM.
Show legacy instructions
Note: The API version used by the legacy integration may not function after 31st December 2019.
This guide will show you how to add a new lead to Zoho CRM when a user submits a Quform form. In this guide we’ll create a new plugin to contain the code needed for the integration to work.
Step 1 – create a WordPress plugin
Create a new folder named quform-zoho-integration and inside it create a file named quform-zoho-integration.php
Inside the quform-zoho-integration.php file add the following code.
1 2 3 4 5 6 7 8 910 11 1213 1415 16 17 18 19 20 21 22 23 2425 26 27 28 29 30 31 32 33 34 | <?php /* * Plugin Name: Quform Zoho Integration * Description: Add leads to Zoho CRM from Quform forms. * Version: 1.0 */ add_filter('quform_post_process_1', function (array $result, Quform_Form $form) { require 'vendor/autoload.php'; $client = new CristianPontes\ZohoCRMClient\ZohoCRMClient('Leads', 'yourAuthToken', 'com'); $name = $form->getValue('quform_1_3'); $firstName = $name[2]; $lastName = $name[4]; try { $client->insertRecords() ->setRecords(array( array( 'First Name' => $firstName, 'Last Name' => $lastName, 'Email' => $form->getValue('quform_1_4') ) ))->request(); } catch (Exception $e) { if (defined('WP_DEBUG') && WP_DEBUG) { Quform::log($e); } } return $result; }, 10, 2); |
<?php /* * Plugin Name: Quform Zoho Integration * Description: Add leads to Zoho CRM from Quform forms. * Version: 1.0 */ add_filter('quform_post_process_1', function (array $result, Quform_Form $form) { require 'vendor/autoload.php'; $client = new CristianPontes\ZohoCRMClient\ZohoCRMClient('Leads', 'yourAuthToken', 'com'); $name = $form->getValue('quform_1_3'); $firstName = $name[2]; $lastName = $name[4]; try { $client->insertRecords() ->setRecords(array( array( 'First Name' => $firstName, 'Last Name' => $lastName, 'Email' => $form->getValue('quform_1_4') ) ))->request(); } catch (Exception $e) { if (defined('WP_DEBUG') && WP_DEBUG) { Quform::log($e); } } return $result; }, 10, 2);
- On line 9, replace the number
1
with the form ID - On line 12, replace
yourAuthToken
with your Zoho CRM auth token - On line 12, only if you are integrating with zoho.eu – replace
com
witheu
- On line 14, replace
1_3
with the Name element unique ID - On line 24, replace
1_4
with the Email element unique ID
1 2 3 4 5 6 7 8 9 10 11 12 1314 1516 17 18 19 20 21 22 23 24 2526 27 28 29 30 31 32 33 34 35 36 | <?php /* * Plugin Name: Quform Zoho Integration * Description: Add leads to Zoho CRM from Quform forms. * Version: 1.0 */ function my_zoho_integration(array $result, Quform_Form $form) { require 'vendor/autoload.php'; $client = new CristianPontes\ZohoCRMClient\ZohoCRMClient('Leads', 'yourAuthToken', 'com'); $name = $form->getValue('quform_1_3'); $firstName = $name[2]; $lastName = $name[4]; try { $client->insertRecords() ->setRecords(array( array( 'First Name' => $firstName, 'Last Name' => $lastName, 'Email' => $form->getValue('quform_1_4') ) ))->request(); } catch (Exception $e) { if (defined('WP_DEBUG') && WP_DEBUG) { Quform::log($e); } } return $result; } add_filter('quform_post_process_1', 'my_zoho_integration', 10, 2); |
<?php /* * Plugin Name: Quform Zoho Integration * Description: Add leads to Zoho CRM from Quform forms. * Version: 1.0 */ function my_zoho_integration(array $result, Quform_Form $form) { require 'vendor/autoload.php'; $client = new CristianPontes\ZohoCRMClient\ZohoCRMClient('Leads', 'yourAuthToken', 'com'); $name = $form->getValue('quform_1_3'); $firstName = $name[2]; $lastName = $name[4]; try { $client->insertRecords() ->setRecords(array( array( 'First Name' => $firstName, 'Last Name' => $lastName, 'Email' => $form->getValue('quform_1_4') ) ))->request(); } catch (Exception $e) { if (defined('WP_DEBUG') && WP_DEBUG) { Quform::log($e); } } return $result; } add_filter('quform_post_process_1', 'my_zoho_integration', 10, 2);
- On line 13, replace
yourAuthToken
with your Zoho CRM auth token, click here to generate an auth token - On line 13, only if you are integrating with zoho.eu – replace
com
witheu
- On line 15, replace
1_3
with the Name element unique ID - On line 25, replace
1_4
with the Email element unique ID - On line 36, replace the number
1
with the form ID
Step 2 – install the Zoho CRM PHP client
Next you need to install the Zoho CRM PHP client using composer. You can do this on your computer or on the web server. In a terminal navigate to the directory of the plugin you created in Step 1, then run this command:
composer require cristianpontes/zoho-crm-client-php
This will install all required files into the vendor folder within the plugin. Upload the quform-zoho-integration folder to the web server at wp-content/plugins then go to the Plugins page within WordPress and activate the plugin Quform Zoho Integration and you’re done.
Troubleshooting
If the integration does not work, try temporarily enabling debug logging then submit the form again and check for an error message in the wp-content/debug.log file.