Configure inbound authentication
This section describes how to authorize AppDirect to connect to Salesforce APIs.
Prerequisites
- Create a dedicated integration user in Salesforce. For more information, see Create an integration user in Salesforce.
- Generate a security token for the integration user.
Caution Resetting the security token revokes previously issued tokens and will break any integrations that are configured to use them. If you are using an existing integration user instead of creating a new one dedicated to theAppDirect integration, do not perform the following steps. Reference the existing token.
- Log in to Salesforce as the integration user.
- Click the profile icon and then select Settings.
- From the My Personal Information menu, select Reset My Security Token and then click Reset Security Token.
- Copy the security token for the webhook setup.
Prerequisites for scratch organizations
- Identify a Salesforce instance URL. For more information, see View instance information for your Salesforce organization.
- Log in to Salesforce and copy the URL in the browser. It could be in one of the following two formats:
- https://business-force-7164-dev-ed.lightning.force.com/
- https://business-force-7164-dev-ed.my.salesforce.com/
- Click the gear icon and then select Setup.
- Go to Settings > Company Settings > Company Information.
- In the Instance field, note the web instance. For example, CS95.
If your URL is https://business-force-7164-dev-ed.my.salesforce.com/ and the instance is CS95, your instance URL is https://business-force-7164-dev-ed.cs95.my.salesforce.com/. - Save your instance URL (the server the Salesforce scratch organization is running on) for your webhook access token URL.
Configure create a new authentication provider in Salesforce
While the following authentication configurations are packable, do not include them in the AppDirect managed package.
Each installation is configured as follows:
- Connected applications are defined in each Salesforce organization. Each connected application has a unique consumer key and secret.
- An integration user is specific to the Salesforce organization.
- In Salesforce, click the gear icon and then select Setup.
- Go to Platform Tools > Apps > App Manager.
- Click New Connected App.
- Add the following values to the New Connected App dialog:
Field Value Connected App Name AppDirect Inbound Auth API Name AppDirect_Inbound_Auth Contact Email <Salesforce admin user or support department email> Contact Phone <Salesforce admin user or support department phone> Description Authentication for AppDirect webhook integration. Enable OAuth Settings enable
Enabling this field adds more fields (listed below) to the dialog.Enable for Device Flow disable Callback URL Production Org: https://login.salesforce.com/services/oauth2/callback
Sandbox Og: https://test.salesforce.com/services/oauth2/callbackUse digital signatures disable Selected OAuth Scopes Access and manage your data (api)
Perform requests on behalf at any time (refresh_token, offline access)Require Secret for Web Server Flow enable Require Secret for Refresh Token Flow enable Introspect All Tokens disable Configure ID Token disable Enable Asset Tokens disable Enable Single Logout disable - Click Save.
- Copy the consumer key and secret. You will need both to configure the webhooks in AppDirect.
Create a new webhook in AppDirect
- In AppDirect, go to Manage > Marketplace > Settings > Integrations | Webhooks.
- Click Add Webhook.
- Add the following values to the Add Webhook dialog:
Field Value URL Scratch Org:
https://<domain>.<instance>.my.salesforce.com/services/apexrest/webhook
Partner Developer Edition Org: https://<domain>.my.salesforce.com/services/apexrest/webhook
Installed Package (add namespace to path): https://<domain>.my.salesforce.com/services/apexrest/AppDirect/webhookEvents Resource COMPANY, PRODUCTS, LEADS Actions COMPANY - COMPANY/ADDED, COMPANY/CHANGED
PRODUCTS - PRODUCTS/ADDED, PRODUCTS/CHANGED, PRODUCT/DELETED
LEADS - LEADS/ADDED, LEADS/CHANGED, LEADS/DELETEDAuth Type OAuth2 (Resource Owner Password) Access Token URI Scratch org: https://<domain>.<instance>.my.salesforce.com/services/oauth2/token
Partner Developer Edition Org: https://<domain>.my.salesforce.com/services/oauth2/tokenClient ID (client ID created in the connected app setup) Client Secret (client secret created in connected app setup) Username Salesforce integration user name Password Salesforce integration user password + security token. For example, if the password is "123" and the security token is "ABC", then enter 123ABC.
Validate the connection
Validate the inbound authentication by creating data in AppDirect
- From Salesforce, click the gear icon and then click Setup.
- Go to Platform Tools | Environments > Logs > Debug Logs.
- From the User Trace Flags table, click New.
- Enter the following values in the New Trace Flag dialog.
Field Value Traced Entity Type User Traced Entity Name Search for corresponding user. Webhooks will run as an integration user. Start Date Now Expiration Date Whenever you expect to finish validation testing. For example, an hour from now. Debug level Search for SFDC_DevConsole, or configure a new debug level if you would like a more granular view. - Click Save.
- Test the webhook resource/action in the corresponding AppDirect marketplace. For example, if you are testing a company, edit a company in the marketplace.
- Refresh the debug log in Salesforce to view the results.
What's next?
References
Was this page helpful?
Tell us more…
Help us improve our content. Responses are anonymous.
Thanks
We appreciate your feedback!