Technical Documentation

Salesforce

35 views 0

This page provides information on the Salesforce plugin for Zephr. The plugin allows to you share user and product information between Zephr and Salesforce.

Enabling the Salesforce Plugin

The Salesforce integration can be turned on by enabling the plugin found under Settings > Plugins in your Zephr Admin Console. If you cannot see the plugin in this list, email support@zephr.com.

In order for Zephr to connect to Salesforce you need to provide the following details from Salesforce:

  • Username
  • Password
  • Client ID
  • Client Secret
  • A token URL
  • Webhook Secret

If you do not have OAuth credentials, you will need to create them in Salesforce. Refer to the Salesforce Help Section for details on how to do this.

Enter the credentials on the Salesforce plugin’s configuration page and click Activate.

Syncing Zephr and Salesforce Data

On the Salesforce Configuration page (Settings > Plugins > Salesforce), you will see a list of check boxes under the Salesforce Integrations menu. These provide details on the different data flows that can take place out-of-the-box between Salesforce and Zephr. Below are details on each of the options:

After a user is created in Zephr, Zephr will:

  • Check Salesforce for a Contact with the Zephr User’s email
  • If found, save the Salesforce ID to the Zephr User’s Extended Profile
  • If not found, create a Salesforce Contact

Push user changes in Zephr to Salesforce contacts

After a user is updated in Zephr, Zephr will:

  • Check for a Salesforce ID in the Zephr User’s Extended Profile
  • If found, update the Salesforce Contact
  • If not found, check Salesforce for the Zephr User’s email address
    • If found, update the Salesforce Contact
    • If not found, create a Salesforce Contact

Delete Contact on Zephr User “Forget Me”

After a user is deleted in Zephr via the “Forget Me” API, Zephr will:
  • Check for a Salesforce ID in the Zephr User’s Extended Profile
  • If found, delete the corresponding Salesforce Contact

Sync Purchases to Zephr

This will allow Purchases added in Salesforce to sync to Zephr Products, in turn granting Zephr Users access to content in line with the access rules you put in place. In order for this to work, you will need to add a mapping, which can be done in the Mapping tab of the Salesforce Configuration page within your Admin Console. See ‘Mappings between Zephr and Salesforce’ below for example mappings.

Allow Salesforce to push changes to Zephr Users

This will allows updates made in Salesforce to Contacts to also be made to the corresponding Zephr User. A mapping will be required for this. See ‘Mappings between Zephr and Salesforce’ for an example.

Create Lead on Zephr User Registration

This will create a Lead within Salesforce at the point that a User is created within Zephr. A mapping will be required for sharing information between the User and the Lead. See ‘Mappings between Zephr and Salesforce’ for an example.

Mappings between Zephr and Salesforce

You will require a series of JSON mappings between Salesforce and Zephr in order to share information between the two systems. This includes mappings for:

  • Zephr Users to Salesforce Contacts
  • Zephr Users to Salesforce Leads
  • Salesforce Contacts to Zephr Users
  • Product ID Mapping

To configure these mappings, go to the ‘Mappings’ tab under Settings > Plugins > Salesforce in your Zephr Admin Console.

Example Zephr User to Salesforce Contact Mapping

{
    "attributes": {
       "FirstName": "first-name",
       "LastName": "last-name"
    },
    "identifiers": {
       "Email": "email_address"
    }
}

Example Zephr User to Salesforce Lead Mapping

{
    "always_include": {
       "Blaize_Registered_User__c": true,
       "LeadSource": "Website Registration"
},
    "attributes": {
       "first-name": "FirstName",
       "last-name": "LastName"
},
    "identifiers": {
       "email_address": "Email"
},
"tracking_id": "Blaize_Tracking_Id__c",
"user_id": "Blaize_User_Id__c"
}

Example Product Mapping

{
    "product-one": "01234ABC",
    "product-two": "56789DEF"
}

Integrating Zephr within Salesforce

Certain aspects of the Zephr and Salesforce integration will require you to set up webhooks and triggers within Salesforce – for example, if you wish to update a User in Zephr when their corresponding Contact is updated in Salesforce.

Below is the url and format that needs to be called when setting these up, along with a list of event names that can be called in order to trigger different events within Zephr. For information on how to add webhooks within Salesforce, consult the Salesforce Help Section.

URL and Format to Call:

/plugins/salesforce/webhooks?event={eventName}&code={secretCode}

Note: secretCode references the Webhook Secret set in your configuration of the Salesforce plugin above.

createUser

This is used to create a user within Zephr when a Contact is registered within Salesforce. This will:

  • Check Zephr for a Salesforce Contact’s Email
    • If found this will:
      • Update the Zephr User
      • Save the Salesforce ID to the Zephr User’s Extended Profile
    • If not found this will:
      • Create a Zephr User
      • Save the Salesforce ID to the Zephr User’s Extended Profile

Example:

Content-Type: application/json
Authorization: Basic Auth
POST: https://admin.staging.demo.blaize.io/plugins/salesforce/webhooks?event=cancelProduct&code=bf6414ce-1221-4a90-a9f2-975c67288abe

Note: The body must include the productId, email and contactId.

{
"productId":"701240000009JyLAAU",
"email":"email@world.com",
"contactId":"0031q00000925cVAAQ"
}

updateUser

This is used to update a User within Zephr when the corresponding Contact is updated within Salesforce. This will:

  • Map the Salesforce Product ID to a Zephr Product ID
  • Check Zephr for the Salesforce Contact’s email
    • If found this will:
      • Purchase the Zephr Product
      • Update the Zephr User’s Extended Profile with Product Grants
    • If not found this will:
      • Create a Zephr User
      • Purchase the Zephr Product
      • Update the Zephr User’s Extended Profile with Product Grants

Example:

Content-Type: application/json
Authorization: Basic Auth
POST: https://admin.staging.demo.blaize.io/plugins/salesforce/webhooks?event=updateUser&code=bf6414ce-1221-4a90-a9f2-975c67288abe

Note: The body must include email and contactId

{
"Email": "frank@blaize.io",
"contactId": "384975982743985234"
}

Or

{
    "Id": "384975982743985234",
    "Email": "frank@blaize.io",
    "FirstName": "Frank",
    "LastName": "Blaize",
    "MailingStreet": "1 Frank Street",
    "MailingCity": "London",
    "MailingState": "",
    "MailingPostalCode": "EC4A 2DQ",
    "MailingCountry": "United Kingdom",
    "Phone": "+441234567891",
    "JobTitle": "Blaize",
    "contactId": "384975982743985234"

  }

buyProduct

This is used to add a product grant to a Zephr User when a product or subscription is added to the corresponding Salesforce Contact – for example if an in-house sales teams makes a sale over the phone, and adds the customer’s subscription manually. This will:

  • Map the Salesforce Product ID to a Zephr Product ID
  • Check Zephr for the Salesforce Contact’s Email
    • If found this will:
      • Purchase the Zephr Product
      • Update the Zephr User’s Extended Profile with Product Grants
    • If not found this will:
      • Create a Zephr User
      • Purchase the Zephr Product
      • Update the Zephr User’s Extended Profile with Product Grants

Example:

Content-Type: application/json
Authorization: Basic Auth
POST: https://admin.staging.demo.blaize.io/plugins/salesforce/webhooks?event=buyProduct&code=bf6414ce-1221-4a90-a9f2-975c67288abe

Note: The body must include the productId, email and contactId

{
"productId":"7011o0000011UsOAAU",
"email":"emaill@email.com",
"contactId":"0031q00000EC3YNAA1"
}

cancelProduct

This is used to remove a product grant from a Zephr User when a product or subscription is removed from the corresponding Salesforce Contact – for example if a user has phoned the customer service team asking to put a hold on their subscription. This will:

  • Check Zephr for the Salesforce Contact’s Email
    • If found this will:
      • Check for Product Grants in Zephr User’s Extended Profile
      • Revoke the matching Product ID
      • Update the Zephr User’s Extended Profile with remaining Product Grants

Example:

Content-Type: application/json
Authorization: Basic Auth
POST: https://admin.staging.demo.blaize.io/plugins/salesforce/webhooks?event=cancelProduct&code=bf6414ce-1221-4a90-a9f2-975c67288abe

Note: the body must include the productId, email and contactId

{
"productId":"701240000009JyLAAU",
"email":"email@world.com",
"contactId":"0031q00000925cVAAQ"
}