Faraday can integrate with Salesforce as both a Source and Destination, meaning that it can be used to pull customer data from, and also be where your predictions are pushed to. This article covers both Source and Destination creation, as well as a step-by-step guide on how to utilize the Faraday API integration with Salesforce.

Table of Contents:

  1. Creating Salesforce as a Source in Faraday

  2. Getting data back into Salesforce from Faraday

  3. Faraday API integration

    1. API FAQs

      1. When installing in my Sandbox / Production Org, the Faraday_Test suite fails with a validation error.

      2. We want to use Other Address, not Mailing Address on Contacts to feed the Faraday API. Is this possible?

      3. We use PersonAccounts for our B2C business. Will this work?

      4. We want to have the same functionality on a Custom Object (or on Account). How would we add it?


Creating Salesforce as a Source in Faraday

Go to the Faraday app’s Sources console, click Create source at the top.

  1. Search for Salesforce as a Source location, enter a descriptive name, and click Next.

  2. Enter your Salesforce details, and click Next.

    Faraday source setup
  3. Under Finalize, click Create source. Faraday can now begin the integration process. Once you finalize this source integration, our Customer Success team will be able to finish the configuration and we can begin utilizing your Salesforce data!

    Note:

    Common roadblocks we may run into when setting up Salesforce:

    1. 2FA: If you have two-factor authentication set up, a Customer Success Engineer at Faraday may reach out for that code in order for us to get initial access.

    2. Custom domain: If your company uses a custom Salesforce domain, like faraday.salesforce.com, we'll need to know what that is.

    3. IP Whitelist: Salesforce may be set up to block outside access. In that case, we need the following IPs whitelisted in your Salesforce account:

      35.221.58.159
      34.233.255.242
      52.204.223.208
      52.204.228.32
      52.204.230.227
      52.22.91.248
      52.23.137.21
      54.174.177.114

Getting data back into Salesforce from Faraday

Faraday will be able to produce files in .csv format, coupled with your records' unique identifiers.

If you utilize an ETL to connect data/integrate external sources back into Salesforce, this would be the most efficient way to get FIG attributes, personas and propsensity scores back into your Salesforce instance. A couple known examples of applications used are:

  • MuleSoft

  • Informatica

From here, its a matter of knowing where you want any particular .csv pushed to. We have a couple options:

  • Push to the app (secure) and you retrieve and manage by hand with your ETL/integration software of choice.

  • Push to a designated Amazon s3 bucket in the cloud, where you can design a script to pick up files as frequently as daily.

In the case of this setup, Faraday's CS Team can help advise on how each of these will work and what data would be available in the system (from your data or our data).


Faraday API integration

Faraday persona, percentile, and score values can be available directly on Salesforce Lead and Contact records. The integration performs a near-real-time lookup of these values based on email and/or address information contained on Lead and/or Contact records. Every time email or address information is changed, the Faraday API will be called again to update persona, percentile, and score fields automatically.

  1. Install the following AppExchange package in a Sandbox first. If the Sandbox installation requires no enhancements, then the package can be installed directly into a Production org. The current version is 1.5.

    Sandbox Link

    Production Link

    Install for administrators only to control access to the persona, score, and percentile fields by profile or Permission Set.

  2. Create the Org-Wide value for “Faraday Settings” in SetupDevelop Custom Settings.

    All the default values can be used for simple testing. To activate the full integration, contact the Faraday Customer Success team and obtain unique values to be entered into the Custom Settings fields API Key and Outcome ID.

  3. Add the New Fields (Persona, Percentile, and Score - it's best to use Quick Find's search bar to find these) onto whatever Page Layouts are in use for Lead and/or Contact. Alternatively, you can assign the “Faraday Contact” or “Faraday Lead” Page Layouts which already have the fields added in a section.

    Add the Update Persona checkbox to enable manually triggering an API callout refresh of the New Fields.

    IMPORTANT: until the New Fields are available to users on the Page Layout, you will not be able to edit them in List Views.

  4. If the package was installed for Administrators only (as recommended), then apply the “Faraday Persona User” Permission Set (Manage Users Permission Sets) to any users who should see the values. System Administrators (or anyone with Modify All Data) will be able to edit these New Fields, but normal users experience them as Read Only.

  5. Two new List Views are included in the Package, “Faraday Leads” and “Faraday Contacts”. These List Views are based on “All” and show the New Fields. Switch to the “Contacts” tab and select “Faraday Contacts” List View. Your screen should like the sample below, notice the New Fields are blank.

  6. Update several records by editing the contact and checking the Update Persona box to trigger an API update. After saving changes, the API call process takes a second or two - so you may need to hit the refresh icon in the upper right of the List View. If you are using the default (test) configuration, it should show as follows.

    Faraday predictions in Salesforce

    Note: changes are detected by comparing old and new values, so editing a field but not changing it will not trigger the integration.

API: Frequently Asked Questions

Q: When installing in my Sandbox / Production Org, the Faraday_Test suite fails with a validation error.

A: This happens when the test code can’t create test records because of missing/bad data. Either disable the offending validations or update the test data factory code in Faraday_Test.cls. The two methods used to create Contacts and Leads are Faraday_Test.makeContact() and Faraday_Test.makeLead(). See below.

Q: We want to use Other Address, not Mailing Address on Contacts to feed the Faraday API. Is this possible?

A: Using a different address requires updates in 2 places. The relevant Trigger is updated to use the different Address fields passed into fApi.somethingThere(...) and fApi.somethingNew(...). This is how the trigger determines an Address value has changed and therefore the API should be called again.

if (fApi.somethingThere(c.Email, c.MailingStreet, c.MailingCity, c.MailingState, c.MailingPostalCode)) {
c.Update_Persona__c = true;
}
...
if (fApi.somethingNew(c.Email, old.Email,
c.MailingStreet, c.MailingCity, c.MailingState, c.MailingPostalCode,
old.MailingStreet, old.MailingCity, old.MailingState,
old.MailingPostalCode)) {
c.Update_Persona__c = true;
}

The second place that a change is required is in FaradayFuture.cls, basically the same change to the SOQL Query and fields passed into the fApi.makeCallout(...) method.

Q: We use PersonAccounts for our B2C business. Will this work?

A: Sort of. It will work fine for Leads and Contacts, but not for PersonAccounts. In order to enable it for PersonAccounts, follow the instructions below to enable it for Accounts and use Email__pc as the email field.

Q: We want to have the same functionality on a Custom Object (or on Account). How would we add it?

A: Adding a new object to this solution is straightforward:

  1. Add a Bypass field to the Custom Setting so you can disable the new object if necessary.

  2. Create a trigger on the new object and follow the pattern from Contact, use the new Custom Setting for bypass.

  3. Update FaradayFuture.cls to have another if block to handle the new object. Follow the pattern for Contact.

  4. Updating test code in Faraday_Test.cls is probably the trickiest part. You’ll need a new makeObject() factory method and then the 4 testMethods covering your object.

Did this answer your question?