Create a LEAD in ZOHO CRM using API
In this article, I will explain you that, how we can insert a lead in ZOHO CRM, for this we will create lead with XMLDATA using CURL request. You can create leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, and notes also with ZOHO CRM.
https://crm.zoho.com/crm/private/json/Leads/insertRecords API is used to insert a LEAD in ZOHO CRM with XMLDATA . Below is XMLDATA format:
<Leads>
<row no="1">
<FL val="SMOWNERID">2000000016714</FL>
<FL val="Lead Owner">Scott@zohotest.com</FL>
<FL val="Company">Zoho</FL>
<FL val="First Name">Peter</FL>
<FL val="Last Name">John</FL>
<FL val="Designation">CEO</FL>
<FL val="Email">john@test.com</FL>
<FL val="Phone">04422334455</FL>
<FL val="Fax">98889</FL>
<FL val="Mobile">09999999999</FL>
<FL val="Website">www.sample.com</FL>
<FL val="Lead Source">External Referral</FL>
<FL val="Lead Status">Contacted</FL>
<FL val="Industry">Financial Services</FL>
<FL val="No of Employees">100</FL>
<FL val="Annual Revenue">100.0</FL>
<FL val="Email Opt Out">true</FL>
<FL val="Skype ID">peter</FL>
<FL val="Salutation">Mr.</FL>
<FL val="Street">Street One</FL>
<FL val="City">Chennai</FL>
<FL val="State">Tamil Nadu</FL>
<FL val="Zip Code">6000001</FL>
<FL val="Country">India</FL>
<FL val="Description">Sample Description.</FL>
</row>
</Leads>
To insert LEAD in ZOHO CRM auth_token is required. I'm using the following code to insert LEAD.
<?php
//fields$auth_token = "AUTH TOKEN HERE";
$firstname = 'test';
$lastname = 'user';
$email = 'emailaddress@yopmail.com';
$phone = '+91999999999';
//pass fields in xmlData$xml ="
<Leads>
<row no=\"1\">
<FL val=\"Company\">Your Company</FL>
<FL val=\"Lead Owner\">testemail@yopmail.com</FL>
<FL val=\"First Name\">$firstname</FL>
<FL val=\"Last Name\">$lastname</FL>
<FL val=\"Phone\">1234567890</FL>
</row>
</Leads>
";
$url = 'https://crm.zoho.com/crm/private/json/Leads/insertRecords';
$fields = "authtoken=".$auth_token."&scope=crmapi&xmlData=".$xml."";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // -H
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$resp = curl_exec($ch);
print_r($resp);
?>
In this article, I will explain you that, how we can insert a lead in ZOHO CRM, for this we will create lead with XMLDATA using CURL request. You can create leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, and notes also with ZOHO CRM.
https://crm.zoho.com/crm/private/json/Leads/insertRecords API is used to insert a LEAD in ZOHO CRM with XMLDATA . Below is XMLDATA format:
<Leads>
<row no="1">
<FL val="SMOWNERID">2000000016714</FL>
<FL val="Lead Owner">Scott@zohotest.com</FL>
<FL val="Company">Zoho</FL>
<FL val="First Name">Peter</FL>
<FL val="Last Name">John</FL>
<FL val="Designation">CEO</FL>
<FL val="Email">john@test.com</FL>
<FL val="Phone">04422334455</FL>
<FL val="Fax">98889</FL>
<FL val="Mobile">09999999999</FL>
<FL val="Website">www.sample.com</FL>
<FL val="Lead Source">External Referral</FL>
<FL val="Lead Status">Contacted</FL>
<FL val="Industry">Financial Services</FL>
<FL val="No of Employees">100</FL>
<FL val="Annual Revenue">100.0</FL>
<FL val="Email Opt Out">true</FL>
<FL val="Skype ID">peter</FL>
<FL val="Salutation">Mr.</FL>
<FL val="Street">Street One</FL>
<FL val="City">Chennai</FL>
<FL val="State">Tamil Nadu</FL>
<FL val="Zip Code">6000001</FL>
<FL val="Country">India</FL>
<FL val="Description">Sample Description.</FL>
</row>
</Leads>
To insert LEAD in ZOHO CRM auth_token is required. I'm using the following code to insert LEAD.
<?php
//fields$auth_token = "AUTH TOKEN HERE";
$firstname = 'test';
$lastname = 'user';
$email = 'emailaddress@yopmail.com';
$phone = '+91999999999';
//pass fields in xmlData$xml ="
<Leads>
<row no=\"1\">
<FL val=\"Company\">Your Company</FL>
<FL val=\"Lead Owner\">testemail@yopmail.com</FL>
<FL val=\"First Name\">$firstname</FL>
<FL val=\"Last Name\">$lastname</FL>
<FL val=\"Phone\">1234567890</FL>
</row>
</Leads>
";
$url = 'https://crm.zoho.com/crm/private/json/Leads/insertRecords';
$fields = "authtoken=".$auth_token."&scope=crmapi&xmlData=".$xml."";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // -H
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$resp = curl_exec($ch);
print_r($resp);
?>
Recommanded Articles
- Get Facebook long live access token in AWS Lambda function
- How to make image background transparent using PHP
- Paypal credit card payment on website in PHP
- Capture page screenshot by URL PHP script
- How to get all UK addresses by postal code
- API versioning in Laravel App
- Get all the lists from Mailchimp account using CURL
- Create a LEAD in ZOHO CRM using Node JS
- Create a LEAD in ZOHO CRM using API
- Add new subscriber in a Klaviyo list API
Latest Comments
Andrew Clark
14 Jan 2021Saurav Sharma
30 Jan 2021