Skip to Content
Support Hub
Integrations & ActionsConfiguring Salesforce Authentication in Mavenoid Using the Call External API Action

Integrations & Actions

Configuring Salesforce Authentication in Mavenoid Using the Call External API Action

The Call External API action can be used to set up Salesforce authentication within the Mavenoid assistant builder. This allows you to retrieve an access token and interact with Salesforce's REST APIs. While Salesforce offers various authentication methods, it's recommended to use the OAuth 2.0 Refresh Token Flow for Renewed Sessions.

Follow these steps to configure Salesforce authentication in the Mavenoid assistant builder:

  1. Create a Salesforce Integration User
    Ensure you have created a Salesforce Integration User (API-only user) with the necessary permissions. For more information, refer to the Creating a Salesforce Integration User (API-only User) guide.

  2. Configure a Connected App for OAuth 2.0
    Create a Connected App in Salesforce for the OAuth 2.0 Client Credentials Flow. Enable the following OAuth settings:

    • OAuth Scopes:

      • Manage user data via APIs (API)

      • Perform requests at any time (refresh_token, offline_access)

    • Callback URL: https://app.mavenoid.com/integrations/salesforce/oauth

    • Enable Client Credentials Flow

  3. Update OAuth Policies
    Update the OAuth policies as shown in the image.

  4. Retrieve Consumer Key and Secret
    Retrieve the Consumer Key and Consumer Secret for the connected app.

  5. Get an Authorization Code:

    1. Go to the URL: https://YOUR_SALESFORCE_DOMAIN.my.salesforce.com/services/oauth2/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_CALLBACK_URL&response_type=code

    2. Login using your Integration User.

    3. If the login is successful, the authorization code will be at the end of the URL ?code={authorization_code}

  6. Get a Refresh Token:
    Make a POST request to Saleforce API /services/oauth2/token with the following URL-encoded parameters in the body of the request:

    • grant_type: authorization_code

    • redirect_uri: YOUR_CALLBACK_URL

    • client_id: YOUR_CONSUMER_KEY

    • client_secret: YOUR_CONSUMER_SECRET

    • code: YOUR_AUTHORIZATION_CODE

  7. Add a Secret in Mavenoid
    In Mavenoid, add a secret with the value of client_id:client_secret base64 encoded. For detailed instructions, refer to the article Understand secrets in Mavenoid.

  8. Configure the Call External API action
    We're now ready to configure the Call External API action in the assistant builder to get the Salesforce Access Token. Make a POST request to services/oauth2/token with the following URL-encoded parameters in the body of the request:

    • grant_type: refresh_token

    • refresh_token: YOUR_REFRESH_TOKEN

  9. Handle API Response
    Connect the Call External API action node to a Read Data node to verify if the API call successfully retrieved an access token or returned an error.

    • If an error occurs, guide the user to an alternative (such as contacting an agent).

  10. Use the Access Token
    Reference the access token retrieved in Step 8 for any subsequent Call External API actions when interacting with Salesforce REST APIs.

Need more help?

Ask a different questionIntegrations & Actions
Select a different product
© 2024 Mavenoid ABSitemap
Terms of servicePrivacy policyCookie policyData processing agreement