import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
salesforce_rest_api: {
type: "app",
app: "salesforce_rest_api",
}
},
async run({steps, $}) {
return await axios($, {
url: `${this.salesforce_rest_api.$auth.instancetype}/services/oauth2/userinfo`,
headers: {
Authorization: `Bearer ${this.salesforce_rest_api.$auth.oauth_access_token}`,
},
})
},
})
You can install the Pipedream Salesforce app in the Accounts section of your Pipedream account, or directly in a workflow.
In order to use this application, you must be on a Salesforce Edition that has API Access, and API Access must be enabled. See here for more details.
Salesforce Editions with API Access
Your Salesforce user needs a System Administrator profile in order to enable API access. If you don't have this on your Salesforce Profile, ask your System Administrator to enable API Access for your user.
The most straightforward way to add these permissions is to create a new Permission Set in Salesforce, and to add it to the user once created.
Here is a step-by-step on how to do this:
Create New Permission Set
Add Permissions
Now that the permission set is created, navigate to System Permissions.
From System Permissions, click Edit.
Select the following permission, and click Save.
If you'd like to utilize Pipedream's webhook triggers, you will need to add the following permissions to the permissions set as well:
Add Permission Set to User
From the newly created Permission Set, click Manage Assignments, then Add Assignment.
Select the user you'd like to assign this permission set to, and click Assign. The user should now show up under Current Assignments.
You should now be able to use the Salesforce integration along with the webhook triggers if you configured the required permissions above.
Emit new event immediately after a record of arbitrary object type (selected as an input parameter by the user) is deleted
Emit new event (at regular intervals) when a record of arbitrary object type (selected as an input parameter by the user) is deleted. See the docs for more information.
Emit new event when a new outbound message is received in Salesforce. See Salesforce's guide on setting up Outbound Messaging. Set the Outbound Message's Endpoint URL to the endpoint of the created source. The "Send Session ID" option must be enabled for validating outbound messages from Salesforce.
Emit new event immediately after a record of arbitrary object type (selected as an input parameter by the user) is created
Adds an existing contact to an existing campaign. See Event SObject and Create Record
Adds an existing lead to an existing campaign. See Event SObject and Create Record
Converts a SOAP XML Object received from Salesforce to JSON
Creates a Salesforce account, representing an individual account, which is an organization or person involved with your business (such as customers, competitors, and partners). See Account SObject and Create Record
Creates an attachment, which represents a file that a User has uploaded and attached to a parent object. See Attachment SObject and Create Record
If you're having issues connecting your Salesforce account on Pipedream, please ensure that IP Restrictions are not enabled for Pipedream. To learn more about what this means, please see the Salesforce documentation here.
To modify these settings:
If you happen to stumble on the error: UNKNOWN_EXCEPTION: admin operation already in progress
when creating an Instant trigger, you can follow the steps below to use the Salesforce Flow Builder to be able to use webhooks with Pipedream. This is a known error in Salesforce.
{{steps.trigger.event.body}}
.Salesforce (REST API) uses OAuth authentication. When you connect your Salesforce (REST API) account, Pipedream will open a popup window where you can sign into Salesforce (REST API) and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Salesforce (REST API) API.
Pipedream requests the following authorization scopes when you connect your account:
GET
{{custom_fields.instancetype}}/services/oauth2/authorize
?
client_id={{oauth.client_id}}
&
redirect_uri={{oauth.redirect_uri}}
&
state={{oauth.state}}
&
response_type=code
&
scope={{oauth.space_separated_scopes}}
POST
{{custom_fields.instancetype}}/services/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
redirect_uri={{oauth.redirect_uri}}
&
grant_type=authorization_code
&
code={{oauth.code}}
POST
{{custom_fields.instancetype}}/services/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
grant_type=refresh_token
&
refresh_token={{oauth.refresh_token}}