Speed up Salesforce: act on CRM activity instantly with webhooks

Jun 7, 2024
Speed up Salesforce with webhooks

For companies that handle customer data, Salesforce is one of the main platforms of choice.

But any data platform is only as good as it is fast. When attempting to secure a new deal, for example, speed of prospect engagement correlates directly with customer win rate, impacting a company's bottom line.

So, how can you act quicker on your CRM activity? Let's explore how to automate such processes in Make using Salesforce.

Automatic action on new records

Make's automation platform provides integrations with more than 1,800 applications, including Salesforce. This supports use cases like, for example, scoring a new CRM record, adding it to a Mailchimp campaign, passing it to sales and creating a new targeted ad campaign, all in an automatic workflow.

"Triggers" fire the starting gun on Make automations - or, "scenarios" - whenever your Salesforce records match pre-defined criteria. For example, the Salesforce integration's "Watch Records" trigger module starts an automation when a record of a specific type (like Contact or Account) is updated or created.

Salesforce - Watch Records

Set your schedule

Triggers can be set to watch for changes in Salesforce on a schedule of your choosing.

Make has two kinds of triggers - polling triggers, which check for changes since their previous run, as frequently as every 60 seconds, and instant triggers, which allow apps to notify Make about changes immediately.

In Make, Salesforce uses polling triggers. Using these, your scenario can check a Salesforce Org. It happens by calling Salesforce's API, yet these technical details are handily hidden behind Make's visual interface.

Even so, marketers with a need for speed may want to act on changes to Salesforce records - like additions of or updates to sales leads - quicker than every 60 seconds. After all, in modern business, speed is of the essence.

The good news is, it is indeed possible to monitor your Salesforce activity in real-time, triggering a transformative workflow as soon as a change is made.

Instant action with webhooks

The secret to instant Salesforce action is the webhook app.

Technically, a webhook is a convention allowing a web application to send a HTTP request to a remote URL, triggering an action in the destination app. In this way, an application can trigger a webhook by sending data over the internet to a receiving application, in real-time.

By using webhooks in your Salesforce workflow, you turn around the communication direction - rather than checking for record updates regularly, with webhooks, Make waits to be called by Salesforce, instantly.

With Make's universal webhook app, you can set a trigger that constantly listens for incoming requests. There are two benefits to using this method:

  • A scenario can begin the very second a trigger condition occurs.

  • By waiting for Salesforce activity, rather than checking for it, you can significantly reduce the number of Make operations used.

Starting an automation with a webhook, then, is the key to unlocking instant workflow zen. This is known as an “event-driven integration”.

So, let's build a Salesforce automation that can transform your CRM data into gold, in real-time, by using a webhook.

Salesforce hand-off to Slack

Real-time hand-off

Let's imagine you want to send a Slack message notifying your sales team about a new lead in Salesforce while it's still "hot".

Here is a quick template for that:

And here's how you can build it yourself...

Create a webhook

First, you need to create the webhook URL that your Salesforce Org will communicate with. 

Create new webhook for Salesforce

Start by adding the webhook app's "Custom webhook" module as your scenario trigger. This is the trigger that will listen for instructions from Salesforce. The module will create the webhook URL - copy it to your clipboard for now.

Salesforce, meet webhook

Next, you need to instruct Salesforce to send a record update message to Make. You do this using Salesforce's Outbound Messages feature, which requires appropriate admin access to be configured.

In Salesforce Setup, go to "Outbound Messages" and create a "New Outbound Message".

Salesforce create new outbound message

Select the Salesforce Object for the kind of changes you want to trigger your workflow. In our case this is "Lead", but the use case could also be adapted to "Case" for service tickets, or any other data object.

Configure the message:

  • Name: Assign a name to your message.

  • Endpoint URL: Paste your Make webhook URL here.

  • Fields to send. Include any information which should be used in the final Slack message:

    • ID

    • First Name

    • Last Name

    • Email

Send the message

Now tell Salesforce how to send the Outbound Message. Salesforce has multiple options for this, the easiest being a Salesforce Flow that defines the trigger logic for sending the message.

Salesforce Flow creation

In the Salesforce Setup, go to "Flows" and create a new Flow:

  1. In the Flow Builder, select the flow type "Record-Triggered Flow".

  2. Select the Object "Lead".

  3. Configure the trigger to flow when "A record is created."

  4. Add a flow step corresponding to the record update:

    • Select "Action."

    • Search for and select your previously-named Outbound Message.

    • Provide a label, like "New Lead Callout."

  5. Save, name and activate your new Flow.

Activate Salesforce Flow

Build your automation

Now that you have configured Salesforce to tell Make about record updates, it is time to complete your lead-handling Make automation.

Run the "Custom webhook" trigger to test it and to retrieve initial results by creating a new Lead in Salesforce. Now add three further modules so that your scenario looks like this:

1. Webhook - Custom webhook: This trigger listens for requests sent by your Salesforce. The lightning bolt indicates that this trigger can fire instantly.

2. Webhook - Webhook response: Make must tell Salesforce that it received its message, else Salesforce will assume it got lost and may attempt to re-resend it. The Webhook response must reply with a Status 200 and send the following message Body back to Salesforce:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Body>

<notificationsResponse xmlns="http://soap.sforce.com/2005/09/outbound">

<Ack>true</Ack>

</notificationsResponse>

</soapenv:Body>

</soapenv:Envelope>

Create webhook for Salesforce

3. XML - Parse XML: The message Salesforce sent to Make is XML that arrived as a string. To make this usable within the scenario, parse the trigger module output value field.

4. Slack - Create a Message: Any lead values sent by Salesforce are contained in the parsed trigger output and can be inserted into the Slack message. These field values are contained in the output bundle's nested  notification array.

XML output

Add security and control

If your trigger in Salesforce is configured to run for record updates and your Make scenario updates the record, too, you create an infinite loop. To avoid this happening, consider adding a filter to block repeat executions, either in your Make scenario or in the Salesforce Flow.

To make sure only the Salesforce servers hosting your Salesforce Org can trigger the scenario, you can configure the webhook to only accept connections for whitelisted IP addresses.

In the "Logs" tab for your webhook (found via the "Webhooks" section of your Make dashboard), you can see a successful call from Salesforce, including what IP address was used.

Webhook log entry

On the Salesforce documentation page Salesforce Core Services - IP Addresses and Domains to Allow, there is a table for the different IP ranges Salesforce uses. Copy the address range (CIDR notation) that corresponds to the address you observed and add it to the IP whitelist in the webhook settings.

Webhook IP restrictions

Keep in mind that these IP addresses can change and that you need to make sure to have all possible ranges for your Salesforce organization whitelisted.

Summary

In modern business, speed is of the essence. In sales and marketing, that can mean the difference between acting on latent customer interest - and losing the deal.

But, by triggering automations as soon as a lead hits your CRM, you can strike while the iron is hot.

Make already boasts a host of app integrations with a variety of triggers, both polling and instant. In addition, webhooks give all apps the power of a real-time trigger.

With the added benefit of optimizing operations usage, webhooks are a powerful feature many businesses will seriously consider harnessing.

Webhooks' combination of speed and efficiency can keep your team in the fast lane.

Lorenz Sahlmann

Lorenz Sahlmann

Lead Senior Solutions Engineer

Like the article? Spread the word.

Get monthly automation inspiration

Join 75,000+ Makers and get the freshest content delivered straight to your inbox.