This tutorial is an end-to-end walkthrough for setting up and running an instance of the SearchAssist Web SDK, which is a collection of libraries that you can use to integrate SearchAssist apps with your own web applications.
Prerequisites
The following list describes the general steps you will take to install and configure the Web SDK.
- Build an App to be integrated – To get started, you need to develop a search assist app through the SearchAssist business user portal, and then configure the app to run in the Web/Mobile Client channel. Refer here for how.
- Create a new Credential – As a prerequisite, you need to create a credential that would be referred to while configuring the Web/Mobile client channel. Refer here for how.
- Configure Web/Mobile Client channel – To use the SearchAssist app with the Web SDK, you must configure the App for the Web/Mobile Client channel using the credentials created in the above step. Refer here for how.
- From the Web/Mobile client detail page and copy the below details from the Web/Mobile client details page
- App Name
- App ID
- Client ID
- Client secret ID
- Search ID
Configuring web SDK
Now it is time to download, uncompress the file required for the Web SDK and a test application to run the SearchAssist App on your local host server.
- To download the SearchAssist Web SDK, go to https://github.com/SearchAssistdotcom/web-SearchAssist-sdk, and then click Download.
- Extract all files to your local folder
- From the SearchAssist Business Portal -> Manage -> Web/Mobile Client Channel page on the Channels menu, copy the following : (These values needs to updated in the ‘SearchAssist-config.js’ file)
- App Name
- App ID
- Client ID
- Client secret ID
- Search ID
- Open the extracted folder, locate and navigate to /web-kore-sdk-private/findly/demo/ folder
- Open ‘SearchAssist-config.js’ file in any of the editors(Ex:- Notepad++, Visual studio)
- Update the botOptions parameters botInfo, clientId and clientSecret, and your email id as userIdentity.
botOptionsFindly.koreAPIUrl = "Host URL"; (Ex: ‘https://qa.kore.ai/searchassistapi/’) botOptionsFindly.baseAPIServer = “”; (Ex: ‘https://qa.kore.ai/’) botOptionsFindly.botInfo = { chatBot: "", "taskBotId": ""}; botOptionsFindly.clientId = ""; botOptionsFindly.clientSecret = ""; botOptionsFindly.searchIndexID = ""; botOptionsFindly.reWriteSocketURL = { protocol: 'wss', hostname: '' (Ex: ‘qa.kore.ai’) };
- Save the changes done in the ‘SearchAssist-config.js’ file
- Locate and navigate to /web-kore-sdk-private/demo/ folder
- Right-click “index.html” file and open with any one of the browsers
- End User SDK will be opened with the changes done in the configured app
- Start the searches in the SDK and relevant results will be displayed.
- Data searched in the End User SDK (“searches”,”Users”,”Clicks” and “Appearance of Sources data”) will be displayed in the Business user portal.
Note: If the app is running in a local box, in order to validate it below steps are mandatory
- We need to run SDK in chromium or chrome browser with security disability mode to allow the Cross-Origin Resource Sharing (CORS)
- For that open windows run command and paste chrome.exe –disable-web-security –user-data-dir=c:\my-chrome-data\data
- Hit enter chrome will be opened in disabled security disabled mode paste the index.html path here to run the sdk
Passing data via webSDK
You can pass additional information of the user accessing the channel by adding the custom data at botInfo inside the SearchAssist-config.js file.
botOptionsFindly.botInfo = { chatBot: "<App Name>", "taskBotId": "<App ID>", "customData":{ } };
Example:
botOptionsFindly.botInfo = {chatBot: "<App Name>", "taskBotId": "<App ID>", "customData":{"test":"s"} };
Commonly Encountered Errors
- A wrong URL is given in index.html, users see a 404 error. Double-check the URL. URL changes depending on whether you are hosting the bot on your own web SDK or on SearchAssist’s web SDK.
- Not found: User sees this error when either wrong clientID or no clientID is given. Check the correct ClientID from Business Portal -> Manage -> Web/Mobile Client Channel page on the Channels menu
botOptions.clientId = “{clientID}”; // secure client-id
- error verifying the jwt: the Wrong clientSecret is given in index.html: Check the correct clientSecret you get from Business Portal -> Manage -> Web/Mobile Client Channel page on the Channels menu
“clientSecret”: "{clientSecret}” //provide clientSecret here