How to track contact form 7 form in salesforce without plugin

Here we will show you how can you track your form data of contact form 7 into salesforce without using any plugin.

Here we are create function track_salesforce_leads() inside function.php

add_action( 'wpcf7_before_send_mail', 'track_salesforce_leads' );

function track_salesforce_leads(){
	$submission = WPCF7_Submission::get_instance();
	$data = $submission->get_posted_data();
	
	$remote_ip = $submission->get_meta( 'remote_ip' );
	$url = $submission->get_meta( 'url' );
	
	$ip = $data['_remote_ip'];
	$first_name = $data['your-name'];
	$last_name = $data['your-lastname'];
	$company = $data['your-company'];
	$phone = $data['your-phone'];
	$email = $data['your-email'];
	$city = $data['your-city'];
	$country = $data['your-country'];
	$state = $data['your-state'];
	$message = $data['your-message'];
	$title = $data['your-subject'];
	
	$post_items[] = 'oid=000000000'; // Replace this by your OID value
	$post_items[] = 'lead_source=Your Lead Value';
	$post_items[] = '00N90000006pnvV=' .$remote_ip;
	$post_items[] = 'URL=' .$url;
	$post_items[] = 'first_name=' . $first_name;
	$post_items[] = 'last_name=' . $last_name;
	$post_items[] = 'email=' . $email;
	$post_items[] = 'company=' . $company;
	$post_items[] = 'city=' . $city;
	$post_items[] = 'country=' . $country;
	$post_items[] = 'state=' . $state;
	$post_items[] = 'phone=' . $phone;
	$post_items[] = 'title=' . $title;
	$post_items[] = 'description=' . $message;
	
	if(!empty($first_name) && !empty($last_name) && !empty($email) && !empty($phone))
	{
		$post_string = implode ('&', $post_items);
		// Create a new cURL resource
		$ch = curl_init();
		$con_url = 'your sales force url';
		curl_setopt($ch, CURLOPT_URL, $con_url);
		// Set the method to POST
		curl_setopt($ch, CURLOPT_POST, 1);
		// Pass POST data
		curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_string);
		curl_exec($ch); // Post to Salesforce
		curl_close($ch); // close cURL resource
	}
}

Tags:
how to track contact form 7 salesforce crm, contact form 7 with salesforce, salesforce contact form wordpress, pardot contact form 7, brilliant salesforce, contact form salesforce plugin, contact form 7 api integration, caldera forms salesforce

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts: You may like

How to Add Post Thumbnail to RSS Feed in WordPress

Contact Form 7 Redirect to Thank You Page

How to Validation Business Email in Contact Form 7 WordPress

How to Create and get WordPress Custom Field

How to add post from frontend in wordpress without plugin

WordPress Websites Are SEO Friendly Or Not

How to get last insert id in WordPress

How to Change WordPress Email From Sender Name Email Settings Without Plugin

How to Create Custom Shortcodes in WordPress

how to fetch custom post by tags in WordPress

PHPKIDA Offering Free Tools:

INSTA DOWNLOADER

Free online tool to download Instagram videos, photos and save Instagram videos, photos to your device. It's free & easy to use.

Download Now

CURRENCY CONVERTER

Our real time currency converter calculator will convert your money based on current values from around the world. It's free & easy to use.

Convert Now

ROBOST.TXT GEN.

Create robots txt file that help search engines to crawling and indexing your site with help of our free online Robots.txt Generator tool.

Create Now

HTML MINIFIER

Free online tool to minify or compress html code and reduce the size of html code in few clicks. It's free & easy to use.

Minify Now

CSS MINIFIER

Free online tool to minify or compress css code and reduce the size of css code in few clicks. It's free & easy to use.

Minify Now

JAVASCRIPT MINIFIER

Free online tool to minify or compress javascript code and reduce the size of javascript code in few clicks. It's free & easy to use.

Minify Now

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.