Receiving Events from Salesforce

With this Salesforce App configuration, your Fusebit Integration will be able to query Salesforce and also make updates to various different Salesforce Objects based on activity in your application. However, for your Integration, you will likely want to respond immediately to additions/changes to any records in your tenant's Salesforce instance. You can do this by easily leveraging Fusebit's Salesforce Webhooks feature!

To set this up you will need to:

  • Configure your Connector with the Salesforce Entities & Actions you want to be notified of
  • Set up your Integration to listen for incoming Webhook Events

📘

Fusebit Webhooks are Secure

With Fusebit Webhooks, Salesforce events are secure by design. Fusebit verifies the authenticity of an incoming Webhook event by verifying a unique generated Webhook secret associated with the Salesforce instance. To prevent data tampering, it also ensures the integrity of the data sent by Salesforce using a cryptographic sha256 HMAC hash.

Configure your Connector

First, you need to set up your Connector Configuration to deploy the Webhooks for the Salesforce Objects that you want to listen for. In the Fusebit Management Portal, head on over to your Connector and navigate to the 'Salesforce Webhooks Configuration' section. You can choose any of the available Entities to set up triggers for and specify the type of action you want to listen for as well.

24562456

Once you're done, hit Save!

❗️

Managed Packages

Some Salesforce Enterprise Accounts will have security limitations that prevent API installation of Webhooks and require a Managed Package to be distributed through Salesforce instead.

You can create a Managed Package after configuring webhooks by running an Installation using your Salesforce Developer Account and create a package from there. See below for detailed steps.

Set up your Integration

Once you have configured your Connector, you can receive events in your Integration. The Connector will route all events from the Salesforce Instance that your Integration was authorized for when it was created.

To do this, add the following endpoint to your Integration:

// Listen to Salesforce Webhook events
 integration.event.on('/:componentName/webhook/:eventType', async (ctx) => { 
  // Tip: Inspect the full body of the request to see associated Installs information
  console.log(`New Webhook event: ${ctx.req.body.eventType}`, ctx.req.body.data);
});

👍

Done!

Once you have set that flow up properly, your Fusebit Integration will start receiving notifications from Salesforce Triggers immediately. You can now call your own application's API with this information and have instant updates ready for your tenants!

Create and Deploy a Salesforce Package

As mentioned earlier, some Salesforce Enterprise Accounts will have security limitations that prevent automatic installation of Webhooks and require a Managed Package to be installed instead.

All the files that you need are available under Apex Classes and Apex Triggers.

24142414

To create a package, navigate to Package Manager and select 'New'.

960960

Next, add your Apex Code to this newly created Package.

800800

Finally, when you're done - hit Upload. This will run the tests and then generate an Install URL that you will need to store. This is the link to the package installation that you will display to your Tenants if loading via API fails.

800800