User login

RSS Feed

InsideSales.com Free Trial

Free Trial button

(866)-342-5370

automatically add leads from a from using SOAP

No replies
tamraica
User offline. Last seen 14 weeks 6 days ago. Offline
Joined: 12/07/2011
Points: 0

does this code look okay for adding leads? or am i missing something?
InsideSales.com SOAP v2.0
This example code uses the InsideSales.com SOAP v2.0 API.
Replace these with your company subdomain and security token and your username and password.
The API requires that you login with the credentials of an existing CRM user.
*/
$base_url = "https://[subdomain].insidesales.com";
$username = "[username]";
$password = "[password]";
$token = "[token]";
/*
Use your company site's WSDL.
For human readable documentation on what methods are available through
the API, go to: http://[YOUR_SUBDOMAIN].insidesales.com/noauth/services/documentation
*/
$wsdl_url = $base_url.'/do=noauth/soap/service?wsdl';
$service_options = array("cache_wsdl" => WSDL_CACHE_NONE, "encoding" => "ISO-8859-1", "trace" => true);
// update the "1" in "gform_post_submission_1" to the ID of your Gravity Form
add_action("gform_post_submission_1", "post_submission_to_api");

// -- Function Name : post_submission_to_api
// -- Params : $entry
// -- Purpose :
function post_submission_to_api($entry){
$form_id = "1";
// form id
// Add a new lead
$info = array (

'email' => $entry[1], // UPDATE: 1 to the ID of your GF email field
'registered' => time(),
'source' => 'API-GFSubmission',
'first_name' => $entry[1.3], // UPDATE: 2 to the ID of your GF firstname field
'last_name' => $entry[1.6], // UPDATE: 3 to the ID of your GF lastname field
'address' => $entry[2.1], // Address
'city' => $entry[2.3], // City
'state' => $entry[2.4], // State
'zip' => $entry[2.5], // Zip
'country' =>$entry[2.6], // Country
'phone' =>$entry[3], // Phone
'email' =>$entry[4], // Email
'campaign' =>$campaign, // Campaign
'referring url' =>$entry[7], // Referring url
'lead_source' => ('Internet'), // Lead Source
);
$new_lead = new SoapVar($info, SOAP_ENC_OBJECT, 'Lead');
try{
$new_lead_id = $client->addLead($new_lead, $add_lead_options);
echo "added a Lead with ID {$new_lead_id}";
}

catch (Exception $e) {
handleSoapError ($e);
}

}

Products  |  Services  |  Resources  |  Customers  |  Events  |  Partners  |  About Us
Insider Blog  |  Developers  |  Terms  |  Policy  |  Site Map  |  News  |  Awards  |  Careers  |  Partners