Connecting Salesforce to Zengain
Having installed the Salesforce integration sample, we are now in a position to establish a connection from Salesforce to your Zengain account.
Go to Salesforce Setup. In the quick find box, search for Named Credentials.

Click the Named Credentials link. On the next page, select the Named Credential named ZengainPackageNamedCredential:

Follow this link and click the Edit button that appears at the top right of the new page

which will take you to the Edit page for this named credential.
At this stage, you are required to enter into Salesforce some details about your Zengain account. In a separate browser window, log in to Zengain. On the sidebar, go to Administration>API Credentials. On the API Credentials page, click the Management API tab to view the Management API Details:

Take note of the following information:
Tenant ID
API URL
OAuth URL
Keep this browser window open at the current page, as we shall return to it shortly.
Go back to the Edit page for the named credential in Salesforce.

Ensure that the form is populated as shown above. Set the URL to be the API URL from your Zengain account and click Save.
Back on the named credential edit page, go to the Custom Headers section and click the New button.
Under the Custom Headers section, click Edit to change the N-TenantId, and replace the value with the Tenant ID found in the API Credentials page of your Zengain Account and click Save.
Now create another custom header in the same way with name 'N-Api-Version' and Value '2024-05-01-alpha'.
Go back to the Named Credentials page and click on the External Credential tab. Click on the External Credential named ZengainPackageExternalCredential.

This will take you to the page for the related external credential:

Click the Edit button to go to the edit page:

Set the Identity Provider URL to be the OAuth URL value found on the API Credentials page of your Zengain Account, appended by /protocol/openid-connect/token (i.e., https://sf-demo.keycloak.zentitle.io/realms/sf-demo/protocol/openid-connect/token), and click Save. Also, ensure that the Authentical Flow Type is set as shown and that 'Pass client credentials in request body' is checked.
You will see that there is a Custom Headers section here. Create the same custom headers as you did for the named credential.
Now, return to the API Credentials page of your Zentitle Account and click Add API Client.
Set a name (Client ID) of your choosing and click Save.

You will now be asked to save the Client Secret as shown. Please do so, taking a note of or copying the Client secret.

Back in the Salesforce Principal edit page, please enter the name you used for the Client ID, copy the Client Secret from Zengain, enter it and click Save.
Under the Principals section of the external credential page, click the New button and create a Principal as follows:

Now go to the Permissions Sets page in the quick find box:

and locate the Software Entitlements Admin Permission:

Select the External Credential Principal Access permission

and on the subsequent page, click the Edit button:

Transfer the Principal you have created from the Available to the Enabled box as shown:

Now enable the Software Entitlements Admin permission set on your user.
This completes the setup of our Salesforce Zengain integration sample.
Last updated
Was this helpful?