Facing issue while integrating bot with web/mobile client channel


(Ankit Saini) #1

I am following this tutorial to integrate a bot with sdkApp provided in the same tutorial, but I am getting the following error

And after updating path (19th point), chat window disappears.

Please help me with editing the index.html file inside “/SDKApp/sdk/UI” folder.


(swathi vadlamani) #2

Hi @ankitsaini345 please try the steps given below and check once again.

  1. To download and install node.js on your computer, go to https://nodejs.org/en/download/, and then select your OS as .pkg for Mac, and .msi for Windows. In a Terminal window, run the node -v command to verify installation and version, for example, v6.10.2

  2. Make sure you have all packages form node installed on your system. Use the following commands for installing the required packages after installing node.js
    npm install express
    npm install body-parser
    npm install jwt-simple

  3. For hosting the bot on your web application, you should have a web app running along with a JWT service. So please open generateJWT.js file and define the clientSecret value as shown below and save:
    var clientSecret = req.body.clientSecret;

  4. Download your web applications web-sdk folder, unzip it, go to UI folder and EDIT index.html file and enter the following details and save. Sample attached.

“clientSecret”: “{client secret}”
$.ajax({
url: “http://localhost:3000/api/ /users/getJWT”, //this is sample url of my localhost. This should include the url where you are hosting the bot.
botOptions.userIdentity = ‘ ‘;// Provide users email id here
botOptions.clientId= "{client id} "; // secure client-id
_botOptions.botInfo= {name:"{bot name}","id":"{bot id"}; // bot name is case sensitive

You find all these values in Apps and Agents - Web/Mobile SDK in your bot.
Once you save the index.html, run it .

Keep me posted.


(Ankit Saini) #4

Hi Swathi,

I did all the steps but still getting the same error.

Error: Failed to lookup view “error” in views directory “C:\Users\sainankc\Downloads\Kore.ai\SDKApp\sdk”
at Function.render (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\application.js:579:17)
at ServerResponse.render (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\response.js:961:7)
at C:\Users\sainankc\Downloads\Kore.ai\SDKApp\app.js:55:7
at Layer.handle_error (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\router\layer.js:71:5)
at trim_prefix (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\router\index.js:310:13)
at C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\router\index.js:280:7
at Function.process_params (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\router\index.js:330:12)
at IncomingMessage.next (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\router\index.js:271:10)
at done (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\response.js:956:25)
at Function.render (C:\Users\sainankc\Downloads\Kore.ai\SDKApp\node_modules\express\lib\application.js:581:14)

Thanks,
Ankit Saini


(swathi vadlamani) #5

@ankitsaini345 Can u share your index.html? I am sharing a screencap of sample index.html for your reference. The url is see is pointing to my local host.

If you are using Kore’s web chnanel then the URL should be “[http://demo.kore.net/users/sts”]


(Ankit Saini) #6

The problem was with the localhost URL. Now its working.

Thanks
Ankit


(swathi vadlamani) #7

Glad we could help you!
Thanks
Swathi


(Riya Sharan) #8

Hi Swathi,
I have developed an angular UI application and need to integrate the bot with the same.

How can I open the chat bot with a button in my index file?


(Juan Alejandro Perez) #9

@swathi.vadlamani Do you help me with JWT configuration? I don´t know how do it.