Establishing a Connection
Authenticating to the Salesforce Marketing Cloud APIs
Set the User and Password to your login credentials, or to the credentials for a sandbox user if you are connecting to a sandbox account.
Connecting to the Salesforce Marketing Cloud APIs
By default, the provider connects to production environments. Set UseSandbox to true to use a Salesforce Marketing Cloud sandbox account.
The default Instance is s7 of the Web Services API; however, if you use a different instance, you can set Instance.
Connecting to the REST API
Create an App
You can follow the procedure below to register an app and obtain the OAuth client credentials, the Client Id and Client Secret:
- Log in to your Salesforce Marketing Cloud Go to Marketing Cloud | Administration | Installed Packages.
- Click New.
- Give the package a name and description.
- Save the package. Once the package is saved, you see important details about the package. See Installed Packages Definitions for more information about each field. You see the Package ID, JWT Signing Secret, and Source Account only for packages created in your account.
- Under Components, click Add Component.
- Select API Integration.
- You must select Server-to-Server or Web App as integration type if the package supports enhanced functionality.
- Assign the appropriate scope for your integration.
- Perform server-to-server requests... is automatically selected for all API Integrations.
- Select Perform requests on behalf of the user... if this package contains a Marketing Cloud app.
- Select the Marketing Cloud scope for your API calls. Assign only the scope your package needs.
- Save the component.
- Under the component details, you can find the Client ID and Client Secret.
Authenticate to Salesforce Marketing Cloud
After setting the following connection properties, you are ready to connect:
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
- OAuthClientId: Set this to the Client ID in your app settings.
- OAuthClientSecret: Set this to the Client Secret in your app settings.
- AccountId: Set this to the specific MID of the target business unit. This is not available for legacy packages.
- Exchanges the OAuthClientId and OAuthClientSecret for the OAuthAccessToken.
- Refreshes the access token when it expires.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
Connecting Through a Firewall or Proxy
To connect through the Windows system proxy, you do not need to set any additional connection properties. To connect to other proxies, set ProxyAutoDetect to false.
In addition, to authenticate to an HTTP proxy, set ProxyAuthScheme, ProxyUser, and ProxyPassword, in addition to ProxyServer and ProxyPort.
Set the following properties:
- To use a proxy-based firewall, set FirewallType, FirewallServer, and FirewallPort.
- To tunnel the connection, set FirewallType to TUNNEL.
- To authenticate, specify FirewallUser and FirewallPassword.
- To authenticate to a SOCKS proxy, additionally set FirewallType to SOCKS5.
Troubleshooting the Connection
To show provider activity from query execution to network traffic, use Logfile and Verbosity. The examples of common connection errors below show how to use these properties to get more context. Contact the support team for help tracing the source of an error or circumventing a performance issue.
- Authentication errors: Typically, recording a Logfile at Verbosity 4 is necessary to get full details on an authentication error.
- Queries time out: A server that takes too long to respond will exceed the provider's client-side timeout. Often, setting the Timeout property to a higher value will avoid a connection error. Another option is to disable the timeout by setting the property to 0. Setting Verbosity to 2 will show where the time is being spent.