Salesforce CRM webhook
  • 12 Oct 2021
  • 4 Minutes to read
  • Dark

Salesforce CRM webhook

  • Dark

Article Summary

You can use Salesforce’s Web-to-Lead form option to automatically deliver your organization’s G2 leads via a webhook to your Salesforce instance. This means any leads generated from your product profile page are instantly added to your Salesforce instance and ready to be worked by your sales and marketing teams.

The following information details examples of how to set up the webhook for this process. There could potentially be dozens of fields that need to be matched between your G2 lead form and Salesforce, and these fields will be different depending on the G2 leads data that you want delivered to your Salesforce leads. Your organization should adjust steps 12-14 based on your own selections.

You should set up your G2 lead form before starting this process.

To send your G2 leads to Salesforce:

  1. Log in to your Salesforce instance and go to Setup.
  2. Search for and select Web-to-Lead.
  3. In the Web-to-Lead Setup page, ensure that Web-to-Lead Enabled checkbox is selected. If not, select Edit and enable Web-to-Lead forms before proceeding.


  1. Select Create Web-to-Lead Form.
  2. Add and remove the Salesforce fields for your leads.

    The options you move to the Selected Fields column should ultimately match with both the standard and custom fields you choose to include in the G2 lead form. For example, the standard First Name (first_name) field in the G2 lead form could match with the default First Name (first_name) field in Salesforce.


  1. Remove the Return URL entry and uncheck the Include reCAPTCHA in HTML checkbox. Both should be empty.
  2. Select Generate.
  3. In the sample HTML generated by Salesforce, you should look for several elements that need to be copy-and-pasted to your my.G2.

    First, find and copy the endpoint URL. The code for the URL should be similar to the following:

    <form action="" method="POST">

    Ignore the surrounding HTML. Copy only the URL inside the quotation marks.


  1. Go to the my.G2 Lead Webhooks tab. Paste the URL from Salesforce into the Choose endpoint field and select the Form Data option. Then, select Save.

Select Send Test Lead to test the endpoint URL. This option ensures that your endpoint URL is valid, but does not send an actual lead to your Salesforce instance.

  1. Next, go back to your Salesforce sample HTML and find the oid value. The code for the oid value should be similar to the following:

    <input type=hidden name="oid" value="00D4x000006swyD">

    Ignore the surrounding HTML. Copy only the 15-digit value inside the quotation marks.

  2. Go to the my.G2 Lead Form tab. In the Custom Fields section, select Add Field and enter the following details:

    • Label: oid
    • API Name: This should auto-populate with oid.
    • Field Type: Hidden
    • Field Value: Paste the oid value you copied in step 11 into this field.

  3. Select Save.


  1. Finally, go back to your Salesforce sample HTML and find the various API fields for each of your chosen Salesforce fields from step 5. Each of these field values need to be transferred to the corresponding fields in your G2 lead form.

    For example, the code for the default Salesforce field First Name should be similar to the following:

    <label for="first_name">First Name</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

    Ignore the surrounding HTML. Copy only the API field first_name that is inside the quotation marks of the label for= entry.


  1. With the first value from step 12 copied, go to the my.G2 Lead Webhooks tab and find the API Name for the matching G2 lead form field. Paste your copied Salesforce field into the matching Override API Name field.
  2. Repeat steps 12-13 to find and map each of your Salesforce fields to the fields in your G2 lead form, and then select Save. This should include any custom fields that have been created for your G2 lead form.


  1. Go back to your sample HTML page in Salesforce and select Finished.
  2. With the endpoint URL, oid value, and all Salesforce fields moved from the sample HTML to your my.G2 dashboard, the webhook should be established between your G2 lead form and Salesforce.

    Test the webhook by going to your G2 product profile page and submitting a lead form. If the webhook has been successfully connected, the lead data you submit to G2 should appear in your Salesforce instance almost immediately.

    If any fields in your Salesforce leads are not populating appropriately, repeat this process starting with step 1 to create a new Web-to-Lead form. Ensure that the Salesforce fields you add to your Web-to-Lead form match the fields that you include in your G2 lead form.

If you successfully receive a G2 lead in your Salesforce instance, the webhook is working and future G2 leads should also be delivered to Salesforce.

When G2 leads are added to Salesforce, they are routed according to your organization’s existing Salesforce rules. If you would like to learn more about how to automatically assign leads in Salesforce, review the Creating Lead Assignment Rule section of this Salesforce Lead Management Implementation Guide.

What's Next