Saturday, September 23, 2023
HomeUncategorizedJoin Google Advertisements Lead Kind Extension to Salesforce - The Full Information

Join Google Advertisements Lead Kind Extension to Salesforce – The Full Information


Lead Kind extensions are one of many latest extension sorts Google Advertisements has launched. These extensions let you seize leads when individuals submit a lead type immediately in your advert. You may have the choice to obtain your leads in a CSV file or create a webhook integration to obtain them immediately in your CRM. In the present day, we’ll demo how one can create a customized webhook to seize these leads in Salesforce.

Setting Up Your Salesforce Org

There are only a few issues that should be arrange in Salesforce earlier than establishing your webhook. You’ll be making a customized metadata sort, a brand new website, and a customized object that may log any errors thrown out of your webhook.

Create a Customized Metadata Sort

Utilizing a customized metadata sort to retailer related info on your webhook quite than hardcoding this info in Apex permits for a better method to replace the webhook key and non-compulsory e-mail. You may identify this something you’d like. For simplicity, we named our’s Google Leads Webhook Settings. It will maintain your Google lead type secret, and if you wish to ship an e-mail notification upon creation of the lead, an e-mail tackle.

salesforce webhook custom metadata type

After creating the customized metadata sort, you’ll then create a file for it. Our file is labeled “Default Settings,” which we are going to question for and reference in our Apex class. The file will retailer your Google lead key that you simply’ll create by way of any random key generator you select and can retailer the e-mail tackle you prefer to the notification despatched to, in the event you selected to ship a notification.

salesforce webhook custom metadata type record

dont miss out iconRemember to take a look at: All About Custom MetaData Types | The Salesforce Developer Guide

Customized Object for Error Logging

With the intention to log any errors you might expertise when utilizing your webhook, it would be best to create a customized object to log these errors. For this instance, the error logging object’s identify is “Google Lead Webhook Error.” You’ll create one customized textual content subject that shall be used to retailer the error message obtained. After creating this object, you’re able to arrange your Apex controller.

salesforce custom error object

Apex Controller for Your Webhook

Now that your org is ready up, you’ll have to create an Apex class that may create a lead and, optionally, ship an e-mail notification.

Create a category that makes use of Relaxation Useful resource that has a URL map to the Lead object.

international with sharing class googleLeadsWebhook {}

Subsequent, you’ll create an httpPost methodology that may retrieve the lead info despatched on your Google Advertisements Lead Kind.

international static void handleNotification() {
    String requestBody = RestContext.request.requestBody.toString();

Inside this methodology, you’ll seize the physique from the request and parse by means of the physique’s knowledge. After parsing by means of the information and performing some error dealing with, you will create a brand new Lead file, populate the knowledge with the lead info within the request physique, and insert the brand new file into your org.

Non-obligatory: Ship a New Lead Electronic mail Notification

If you wish to obtain an e-mail notification each time a brand new lead is added from the lead type, you will have to create a further methodology to take action. You may carry out a question in your customized metadata sort file to seize your notification e-mail tackle. From there, you will populate the mandatory info to ship an e-mail by means of Apex utilizing the Messaging class. The Messaging class lets you set the “Reply to” e-mail tackle, which lets you reply on to the person who submitted the lead type. You may add any mandatory info such because the lead’s identify, telephone quantity, description, and many others. into the physique of the e-mail. After customizing the e-mail, your work in Apex is completed, and also you’re able to create the customized web site.

Customized Web site

Your customized website will bridge the hole between Google Advertisements and Salesforce. After labeling and naming your website, arrange your website with the settings displayed within the picture under.

salesforce webhook site details

Save and activate your new website and duplicate the Web site URL to make use of in a while when establishing your webhook in Google Advertisements.

After saving, choose the “Public Entry Settings” button. It will take you to the profile that was created for this website. Give this profile entry to your Apex class. Should you’re sending a notification e-mail, give the profile entry to ship e-mail.

dont miss out iconTry one other superb weblog by DB Services right here: Salesforce Field Service Implementation – The Complete Guide

Setting Up A Google Lead Kind Extension

Within the Advertisements & Extensions part of Google Advertisements, go to Extensions. Click on the + button so as to add a brand new extension and choose Lead Kind Extension. You may add the extension to your total account or only a marketing campaign. Choose Create New and fill out the specified fields. Be aware: You will have a URL that hyperlinks to your organization’s Privateness Coverage to create a lead type extension.

Saving Your Webhook and Key on the Google Lead Kind

On the backside of the lead type you simply created, there’s a part labeled “Export leads from Google Advertisements.” Underneath “Different knowledge integration choices” you’ll insert your Web site URL from the positioning you created in Salesforce into the webhook URL part and insert your key that’s saved in your customized metadata sort.

google ads lead form extension export integration salesforce

After inserting these, you’ll choose “Ship take a look at knowledge” on the backside, and you’ll both obtain successful message or a failure message. After receiving your success message, a brand new take a look at lead needs to be generated in your Salesforce org and your non-compulsory notification e-mail needs to be despatched.


Lead Kind extensions from Google Advertisements are a fast and simple method to acquire leads immediately out of your advert. With just a little assist from Apex and a webhook, you will be automating lead creation very quickly.


Source link



Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments