Give your website visitors, clients, partners, and service agents the ultimate support tool. Create and manage a knowledge base in Salesforce with your company information, and securely share it when and where it's needed.
With Meya's Salesforce Knowledge integration you can:
- Search for articles using SOQL queries
- Find a specific article by ID
- Filter and sort the results so users see the most relevant information first
- Trigger a flow when an article is found
Keep reading to learn how to set up the integration.
If you've already set up the Salesforce Cases or Salesforce CRM integrations you can skip ahead to the Find your Knowledge site URL section, since this integration uses mostly the same credentials.
Your instance base URL will look like this:
The instance base URL is not necessarily the URL you see in the address bar. The domain in the address bar can be affected by things like a custom My Domain. Keep reading to learn how to find your instance base URL.
To find your instance base URL, open Setup. In the search bar, type
company information. Select Company Information from the search results.
In the Organization Detail section, find Instance and make a note of the value. It will start with two letters and end with a few numbers.
Once you have your instance, insert it into the URL like this:
http://INSTANCE.salesforce.com. Keep this URL handy since you'll be adding it to the vault at a later step.
A connected app allows external systems to authenticate against, and interact with, your Salesforce instance in a secure way. In this section, you'll create a connected app that your Meya app can use.
In Salesforce, click the gear icon in the top corner, then click Setup. In the search bar, type
app manager. Select App Manager from the search results.
Click the New Connected App button in the top right corner.
Enter a meaningful name for your app, such as
Meya. The API name will fill in automatically once you move to another input.
Add an email to the Contact Email field. You can use your own, a support address, or your Salesforce admin's address.
In the API (Enable OAuth Settings) check the Enable OAuth Settings checkbox. In the list of available OAuth scopes, choose:
- Access and manage your data (api)
- Perform requests on your behalf at any time (refresh_token, offline_access)
Leave the other settings as-is. Your page will look something like this:
Click Save to create the app. You'll be redirected to the connected app's detail page.
If you have login IP ranges enabled for your app, you will also need to change the IP Relaxation setting of the connected app to "Relax IP restrictions":
In Salesforce, connected apps with OAuth enabled will have a consumer key and consumer secret. These are also sometimes referred to as a client key and client secret.
In the API (Enable OAuth Settings) section of your connected app, copy the Consumer Key and Consumer Secret since you'll need those in a later step.
You likely already know your Knowledge site URL. This is the site where your users can read your knowledge base articles.
You can also find the URL within Salesforce by going to the Setup page, then searching for
sites in the top search bar. Select Sites from the search results.
In the Sites section near the bottom of the page, look for your knowledge base site and copy the Site URL.
Now that we have all of our secrets, it's time to add them to your app's vault.
In your app's root folder, open
vault.yaml and add this code to the bottom:
salesforce.instance_base_url: https://your_salesforce_instance.salesforce.com salesforce.client_id: xxx salesforce.client_secret: xxx salesforce.username: xxx salesforce.password: xxx salesforce.knowledge_base_url: xxx
Remember not put actual secrets in
vault.yaml, since it's committed to version control. The actual values should go in
vault.secret.yaml, as described below, since it is not committed to version control.
vault.secret.yaml and add this code to the bottom:
salesforce.instance_base_url: https://your_salesforce_instance.salesforce.com salesforce.client_id: CLIENT_ID salesforce.client_secret: CLIENT_SECRET salesforce.username: USERNAME salesforce.password: PASSWORD salesforce.knowledge_base_url: URL
Replace the values to the actual values.
You may want to create a dedicated Salesforce user whose credentials will be used here. Alternatively, you can use the credentials of an existing user as long as they're okay with your developers potentially seeing them (depending on their Meya Team permissions).
Save the files and upload the secrets to your remote vault using this command in your terminal:
meya vault upload --file vault.secret.yaml
Now that your secrets are in the vault, you can reference them in the integration file.
In your app's
integration folder, create a subfolder called
salesforce. Inside that folder, create a file called
salesforce.yaml and copy this code into it:
type: meya.salesforce.knowledge.integration instance_base_url: (@ vault.salesforce.instance_base_url) client_id: (@ vault.salesforce.client_id) client_secret: (@ vault.salesforce.client_secret) username: (@ vault.salesforce.username) password: (@ vault.salesforce.password) knowledge_base_url: (@ vault.salesforce.knowledge_base_url)
Save the file.
The Salesforce Cases integration comes with components that allow your app to create a case, update a case, and add a comment to a case. There are also a few non-case-specific components like
query you can use as well. Let's add some flows to your app to demonstrate how they work.
In your app's
flow folder, create a folder called
salesforce. Inside, create a file called
query.yaml and copy this code into it:
triggers: - keyword: salesforce_knowledge_search_articles steps: - ask: Please tell me how can I help you (e.g. Help)? regex: ^[a-zA-Z0-9]+$ - flow_set: search_query - type: meya.salesforce.knowledge.component.search soql_query: (@ flow.search_query) article_body_field_name: Summary integration: integration.salesforce.knowledge - flow_set: search_result - if: (@ flow.search_result.articles) then: jump: render else: next - say: No results found for '(@ flow.search_query)' - end - (render) - type: meya.salesforce.knowledge.component.display search_response: (@ flow.search_result.articles) integration: integration.salesforce.knowledge - ask: Articles for '(@ flow.search_query)' button_style: text tiles: (@ flow.result)
triggers: - expect: salesforce_knowledge integration: integration.salesforce.knowledge article_body_field_name: Answer__c steps: - type: meya.salesforce.knowledge.component.display search_response: (@ flow.salesforce_knowledge_response.articles) integration: integration.salesforce.knowledge - ask: Articles for '(@ flow.search_query)' button_style: text tiles: (@ flow.result)
search.yaml:11: You can specify what Knowledge Article field to perform the search on. In this example, we're using the Summary field.
trigger.yaml:4: You can also specify a field to base the search on with the Salesforce Knowledge trigger. In this example, we're using the Answer__c field.
Save the files and upload them to the Grid by running these commands in your terminal:
meya format meya push
We're ready to test the flow!
Open your app's simulator and type
salesforce_knowledge_search_articles. Enter a topic you know your knowledge base has an article about. Confirm that at least one article is displayed to the user.
Test out the Knowledge trigger, too, by entering a search term. Make sure you're not still in the
search flow when you do this.
Great! You've successfully added the Salesforce Knowledge integration to your app. Your app can now help people find the right information right when they need it.
Updated over 2 years ago