Adding ProfileSync Custom Settings

After creating the new API client, you must add a pair of settings – prs_target_settings and prs_events – to that client. These two settings are described below.

prs_target_settings

prs_target_settings is a JSON object that contains all the information needed to configure the connection between ProfileSync and Salesforce. The prs_target_settings JSON object looks similar to this:

[
    {
         "target": "salescloud",
         "settings": {
             "tokenurl": "https://login.salesforce.com/services/oauth2/token",
             "serviceurl": "/services/data/v41.0/sobjects/Contact",
             "client_id": "LZdRBOskMwLlkHHxkDkHO1Gu9GaTCUEE.eXwLEewVOPtU4y0mZfhuLobON9", 
              "client_secret": "35285136908642478",
             "private_key": "-----BEGIN RSA PRIVATE KEY----- \nMIIEpAIBAAKCAQEAsIxCf2+6RZDKqQ       
              fZn0uJ24Tab6v9Hc09WD+ZNNd0WE95+AMM\nXJ8lX55rhNnluSjReNSgbLaOQGSayp0bAm0NBetMAc6
              b3T1HXnzk9tXF6wwPUU7x\n8SM3yTWK6hfXYUN/V4OEeVL9SZjRo4GcWtKhOQxDBNwVsjCUMJ703vDH
              EvlOrr2K\nigxYqNYyi3HgrFDGWnT3dKFhcxdXZovNKjzvCyLGYIczCeNDR9ModUEU6GDOlfk6\nocN
              rWiG63+g1nKNKTCDeLpWLqGeQMnRVSjbH4Z3AMHZrSmdbxlD84GvmB3Q6Yp0M\n7MWU+YhOO1boovVj
              1l+bmc/vedLRlzkzIH+odwIDAQABAoIBAQCrBSPBiPybONho\nhzczjRwc7wQemy+Vt+RN4UXLH08P4
              OVY77MA4hV1G+QxjFZxV+4aq3Y/+VOxYwNj\ndG7emb681iMJuRfZZ+wDxt6RkaGowETyUZQjMCdxHR
              HVFIVKLfVkU/12/YJo0cV6\nKyrH/DO7LHqbcYr+0voqY0D32awuXn9bfe+jN6isg3PMp71zKa5/Pqa
              2Uo+cLeGu\nhtMu6jlJ2InJOwxLX4Yq1fTG5dQupcRKnuE0xxm2m6ooFlF0y8WW7NRcrjIAhncP\njE
              G/atziF9oElIC3bl3AOCNp+OtOdnynaJuc+5uTrvgCWzqID3VX9wisuJgn8SlD\nq8bWFBGhAoGBAOj
              FC0fhotMYsvp9W6Y8XjhyPehiQb/GHCb/R1KH8TxFvDb6Ehui\n1UBKboPDvtvkESYZKgVk/4I1TwJX
              nm7wTjzxNyJKuCwvoaj1HFFwsr15exHTgFDe\niZy1h/Fcf3xUGG97gRXLT6m/vS5hrTNHyY9YKSGqm
              nwa9ntNmMvwE4mnAoGBAMIq\n0r7JwVxqTPQbmv8IGnPm8bqqJ2EQmMox/y69hGGyzLUlFolUYp5LSZ
              ZQdAlHXvlA\ne7iJB50Rn4SLAyAYpqSnYO+dxT1xbI7YIdFXLTBFistg/uekGCXHGdEAAS7TSMd0\nm
              D7OGuBBnkTJQgnlL5MWyoNSrA200bHRGb3PjiSxAoGAGeunX+/Oc/dyJtbC1/Ys\n/9go8LHQZIypIe
              aXiKc+w9l4Jh8e2Rj+6lPfjqjDnjT9e+KdfVBL67IIBFjBedUk\nwUCTRSxQ6gq709bHuoH0RYk7nTa
              SOW8un9bPNp94St4Kgo+cRlMHof2KEZoq8WTz\nGxVULz2SSnOuMvjnJP6tDk0CgYBYwcaQXB29pwIC
              XFQf3I5rCNjbIUjbAAE3/F7P\n+OX42wjkjU2d/SsPfQ7oXWKNk0iA288ybcFDNXkb14fYNiyG+9Q99
              HrjOWQMcBQV\nY6pOdJubmH0tWj+HlVnhxgTEaOTN+ChYHVL/zD8S5oT/jPqQXEy6dyIbKdrpU9JW\n
              h/hMIQKBgQCpBAmT9pioYHBpF86qzpkCHAdZqj4Ve09YRNsG/UAnnluWP8iY/xS0\nJkdeRXN6JIbr+
              vGbPMwE8sDlkq0mxT4UTTqD5E/QByDJNVic3Yg46qj98wV5rgZk\ndvPkeMqLWLg1FV+EpWZzeewfjm
              0gysvqpqKXnijd8QBMcpFnBPpNAQ==\n -----END RSA PRIVATE KEY-----",
             "private_key_alternate": "",
             "retry_sequence": "[30, 60, 120, 300, 900]",
             "retry_count": 8,
             "notification_email": "alert@example.com",
             "mappings": [
                 { "src": "uuid", "trg": "Uuid"},
                 { "src": "email", "trg": "Email"},
                 { "src": "givenName", "trg": "FirstName"},
                 { "src": "familyName", "trg": "LastName"},
                 { "src": "birthday", "trg": "Birthdate"},
                 { "src": "primaryAddress.address1", "trg": "Mailing Address.Street"},      
                 { "src": "primaryAddress.zip", "trg": "Mailing Address.PostalCode"},
                 { "src": "primaryAddress.city", "trg": "Mailing Address.City"},     
                 { "src": "primaryAddress.country", "trg": "Mailing Address.CountryCode"},   
                 { "src": "primaryAddress.phone", "trg": "Home Phone"},
                 { "src": "primaryAddress.mobile", "trg": "Mobile"}
             ]
           }
       }
 ] 

Each of these JSON settings – target, tokenurl, serviceurl, etc. – are described in the following table.

Setting

Type

Description

target

string

Unique identifier used by ProfileSync to differentiate target APIs. The target value for Salesforce is salescloud.

tokenurl

string

URL for the Salesforce token endpoint. ProfileSync contacts the token endpoint to request an OAuth 2.0 access token. For more information, see the article OAuth 2.0 JWT Bearer Token Flow.

serviceurl

string

Salesforce service URL used to update the Salesforce Contact object. Although subject to change, the current Salesforce service URL is /services/data/v41.0/sobjects/Contact.

client_id

string

Consumer key for your Salesforce connected app. The consumer key is found on the app's home page:

client_secret

string

Consumer secret for your Salesforce connected app. The consumer secret can also be retrieved from the app's home page; click Click to reveal to display the secret:

json_claims

json

JSON object used to construct the JSON Claim Set for the JWT token. At a minimum, the json_claims setting should contain the iss, sub and aud claims. The exp claim is automatically added by ProfileSync.

private_key

string

PEM (Privately-Enhanced Mail)-formatted private key used to sign the JSON web tokens used in the ProfileSync-to-Salesforce workflow. See Appendix C: Private Keys for more information.

retry_count

integer

Number of times that ProfileSync attempts to make a data transfer before giving up and writing the event in the dead letter queue. The default value is 20.

retry_sequence

json array of integers

Amount of time (in seconds) that ProfileSync waits before retrying a failed data transfer. The retry sequence is specified as an array of integers; for example:

[30, 60, 900]

In this example, after a failed transfer ProfileSync waits 30 seconds before trying again. If the operation fails a second time, ProfileSync waits 60 seconds before making the next attempt. If a third attempt (or fourth or fifth or ….) ProfileSync waits 900 seconds (15 minutes) between tries. 

You can specify up to 20 values in the retry_sequence, one for each potential retry. You can also specify a single value:

[30]

In the preceding example, ProfileSync always pauses for 30 seconds between delivery attempts.

The maximum allowed wait time is 9000 seconds (2.5 hours).

notification_email

string

Email address where dead letter queue notifications are sent. Every Monday an automated program checks the dead letter queue for events that could not be written to the target API. An email notification is then sent to this address; if you do not respond to that notice within 5 days the corresponding event is permanently deleted from the dead letter queue.

mappings

json array of objects

Maps Janrain attributes (the source, or src, attributes) to their corresponding Salesforce attributes (the target, or trg, attributes). For example, suppose Janrain refers to a user's last name as the familyName, and Salesforce refers to this same attribute as the FamilyName field. In that case, the mapping would look like this:

{ "src": "familyName", "trg": "LastName"}

A list of the more-common data mappings can be found in the Updating the Salesforce Schema section of this document.

The prs_target_settings setting must be assigned to the application (global) scope: you cannot add this setting to individual API client. To add the prs_events global setting:

  1. In the Janrain Console, on the Manage Application page, click Edit Settings:
  2. On the Edit Settings page, click the Add Setting icon:
  3. In the Select setting key field, type prs_target_settings and then click the Create prs_target_settings button:
  4. In the Value field, paste the JSON object containing the target settings. Note that, as long as this is properly-formatted JSON, you can paste it into the field even though the object contains multiple lines:
  5. Click the Save Changes icon to save the new setting:

prs_events

The prs_events setting maps Janrain events to your target API. Different versions of this setting can be applied to different API clients; this provides flexibility in determining which client is responsible for which events. For example, you could have an API client that is responsible for handling user profile creations, and a separate API client that only handles profile deletions. You will work with your Janrain representative to determine your event/client mappings.

By default, ProfileSync monitors for the following Janrain user profile events, then replicates the updated profile information to Salesforce:

Janrain Event Description Salesforce Event

add_user

A new user profile is created.

A new Contact is created.

update_user

An existing user profile is updated. Note that this event is only triggered if an attribute mapped to ProfileSync is updated. If you are monitoring email addresses and an email address is changed, this event is fired. If you are not monitoring user first names, however, this event will not be fired if a user changes his or her first name.

The appropriate Contact fields for the user (identified by his or her Janrain UUID) are updated.

forget_user

A user deactivates his or her account. This event is based on changes to the deactivateAccount attribute.

The Salesforce field mapped to the deactivateAccount attribute is updated to indicate that the Contact (identified by Janrain ID) no longer has a Janrain profile.

For Salesforce, the prs_events JSON object will look similar to this:

[
    {
        "event": "add_user",
        "target": "salescloud"
    },
    {
        "event": "update_user",
        "target": "salescloud"
    },
    {
        "event": "forget_user",
        "target": "salescloud"
    }
]

In the preceding example, three events – add_user, update_user, and forget_user – are targeted to salescloud (Salesforce).

The prs_events setting can be added at the global scope or at the local (individual API client) scope. In this example, we'll add the setting to the API client we just created.

To add the prs_events client setting:

  1. In the Janrain Console, on the Search Properties page, click the name of your API client:
  2. On the Edit page, scroll to the bottom then click Edit Settings:
  3. On the Edit Settings page, click the Add Setting icon:
  4. In the Select setting key field, type prs_events and then click the Create prs_events button:
  5. In the Value field, paste the JSON object containing the event settings. Note that, as long as this is properly-formatted JSON, you can paste it into the field even though the object contains multiple lines:
  6. Click the Save Changes icon to save the new setting: