How would one integrate Zoho CRM with the Drupal Webform module? Salesforce has a webform module that woks well. As I understand the webform module API is different to the Drupal forms API, making it more challenging. I have found an sandbox ZOHO API drupal module that seems to have lost some steam. Any pointers would be appreciated.
3 Answers
Please checkout http://www.drupal.org/project/zohocrm. There isn't a submodule in there to specifically syncronize webforms, however, when you have zohocrm set up properly, it's pretty easy to use it with some custom code to send webform data to zoho. In the code below, we are inserting a Case into Zoho. You could easily modify to insert a Lead or Contact:
/**
* Implements hook_webform_submission_insert().
*/
function my_module_webform_submission_insert($node, $submission) {
$components = $node->webform['components'];
// Get all submission values.
$form_values = array();
foreach ($components as $key => $component) {
$form_values[$component['form_key']] = $component['type'] == 'textfield' ? check_plain(trim($submission->data[$key]['value'][0])) : $submission->data[$key]['value'][0];
}
switch($node->nid) {
case '234':
$notes = 'Phone: ' . $form_values['phone_number'] . "\n";
$notes .= 'Message: ' . $form_values['message'];
// Build Zoho data for Case.
$data['records'][] = array(
'Request Type' => $form_values['topic'],
'Subject' => $form_values['subject'],
'Description' => $notes,
);
// Send case data to Zoho.
my_module_send_record($data, 'Cases', NULL, TRUE);
break;
}
}
/**
* Send record to Zoho to insert or update.
*/
function my_module_send_record($data, $module, $record_id = NULL, $workflow = NULL) {
$zoho = zohocrm_get_client();
if ($zoho === FALSE) {
return;
}
zohocrm_log($data, 'ZOHO DATA');
$zoho->setModule($module);
// Trigger Zoho workflow rules
if ($workflow) {
$params = array('wfTrigger' => 'true');
}
try {
if (!empty($record_id)) {
zohocrm_log('UPDATE RECORD');
$response = $zoho->updateRecords($record_id, $data, $params);
}
else {
zohocrm_log('INSERT RECORD');
$params['duplicate'] = 2;
$response = $zoho->insertRecords($data, $params);
}
watchdog('zohocrm', t("Successfully sent data to Zoho CRM. Zoho module: @module"), array('@module' => $module), WATCHDOG_INFO);
zohocrm_log($result = $response->getResponse(), 'ZOHO CRM RESPONSE');
// Let other modules process their tasks.
module_invoke_all('zoho_record_sent', $data, $module, $result['recordId']);
}
catch (Exception $e) {
drupal_set_message(t('Sending data to Zoho CRM failed. Error message: @message', array('@message' => $e->getMessage())), 'error');
watchdog('zohocrm', t("Sending data to Zoho CRM failed. Zoho module: @module. Error message: @message"), array('@module' => $module, '@message' => $e->getMessage()), WATCHDOG_ERROR);
}
}
yes it is absolutely possible to integrate zoho crm (any module) with drupal webform, Just open your webform.module from Drupal Backend and add Zoho Api method to integrate your webform data with Zoho.
if (isset($form['#node']) && $form_id == 'webform_client_form_177') {
$node = menu_get_object();
$title = $node->title;
$form['form_name'] = array(
'#type' => 'hidden',
'#value' => $node->title,
);
$form['#submit'][] = 'insert_into_zoho';
}
insert_into_zoho is the simple function i created to post data into crm with api method insertRecord().
https://www.zoho.com/crm/help/api/insertrecords.html
-
if you want to capture leads from drupal webform, you can use zoho api method to get leads/contacts from drupal webform form. Commented Nov 29, 2016 at 10:19
We were able to accomplish this easily using Zapier, which has built-in Zoho integration. Zapier is a subscription service which allows you to map inputs from one source to values in another destination. Using Webform's built-in handler to POST the submission values to Zapier makes it possible to easily forward the results into a new Zoho lead.