Sending Realtime Records To Salesforce

This guide will walk you through how to send records to Valence using the Salesforce APIs, which will allow you to send record events into Salesforce as they happen.

Links are surfaced using the Salesforce Apex REST API. You’ll set up your Salesforce authentication and then start sending messages to the Link using an Apex REST endpoint.

Authentication

Salesforce offers a variety of ways to authenticate to its REST API. There is no special authentication for Valence; just authenticate to the Salesforce stack using standard mechanisms, which will also allow you to access the Valence endpoint.

Read: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_authentication.htm

Tip

Unless you are using a pre-existing application it is likely you will need to set up a Connected App in Salesforce. Instructions for that are part of the link above.

Sending The Message

Once authenticated, sending records to Valence is straightforward. Each Link has a unique endpoint URL that can be used to send records to kick off a Link run. You can find that URL in the top left corner of the Link dashboard:

../_images/push_to_link.png

The base URL is given to you when you authenticate with Salesforce. One of the parameters returned during authentication is your “instance url”, which will look something like this:

So in this case, my full URL for the Link would be:

To submit records, send an HTTPS POST to this endpoint (and don’t forget to include your authentication information in the header!).

The body of your post will be passed to the Link’s Source Adapter for processing. The expected shape of that body is specific to each source Adapter and how it was coded (so check the documentation for the Adapter you’re using). As a best practice we recommend a JSON body format that looks something like this:

Possible Message Shape

[
    {
        "Name" : "First Record",
        "Favorite Color" : "Blue"
    },
    {
        "Name" : "Second Record",
        "Favorite Color" : "You Get the idea..."
    }
]