Hi @ankitsaini345 please try the steps given below and check once again.
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
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
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;
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 .
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)
@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.
I am still not clear with the JWT url that we need to mention. Which URL we need to mention in botOptions.JWTUrl. I think the problem is with URL only. Please guide me.
Note: SDKApp and WebSDK are different.
Please ensure that you have unzipped the content of WebSDK into SDKApp/sdk (example: Under C:\KoreWDSK\SDKApp\sdk you should be able to see libs, UI, UI-JavaScript directories etc.)
If all the mentioned steps are correctly implemented, you should not have any issue in the command node startServer.js.
On the error that you are getting on console, it does not stop any connectivity to bot.
In your case, you are probably serving the index.html as https://localhost:3000. You can try opening the index.html as a file (right click --> open with chrome etc.) and you will not see any error on console.
Reasons for console error while serving a page could be (not limited to) the following:
If you get error on line 2830 of chatWindow.js for initGapi() function, this is only google speech related. You can get rid of this error by making
isSpeechEnabled: false,
allowGoogleSpeech: false,
in index.html
You may get error for missing resources - favicon.ico and libs/img/emojione.sprites.png You can feel free to add these resources at the mentioned path and it should work.
Any other error on console - Please deal with the error on a case to case basis.
bots.kore.ai/api/oAuth/token/jwtgrant:1 POST https://bots.kore.ai/api/oAuth/token/jwtgrant 401
kore-bot-sdk-client.js:324 Error: Unable to process request, received bad 401 error
at handleTransportResponse (kore-bot-sdk-client.js:840)
at Object.handleRequestTranportRes (kore-bot-sdk-client.js:1392)
at Object.wrapper [as callback] (kore-bot-sdk-client.js:7401)
at on_end (kore-bot-sdk-client.js:3212)
at XMLHttpRequest.on_state_change (kore-bot-sdk-client.js:3162)
POST https://bots.kore.ai/api/oAuth/token/jwtgrant 401
kore-bot-sdk-client.js:324 Error: Unable to process request, received bad 401 error
at handleTransportResponse (kore-bot-sdk-client.js:840)
at Object.handleRequestTranportRes (kore-bot-sdk-client.js:1392)
at Object.wrapper [as callback] (kore-bot-sdk-client.js:7401)
at on_end (kore-bot-sdk-client.js:3212)
at XMLHttpRequest.on_state_change (kore-bot-sdk-client.js:3162)
Even i am facing the same issue. I have done all the steps which are mentioned in the document. In my case i am using enterprise bot.
Could you please help me to solve this issue.
I resolved my issue by deleting the “Web/Mobile Client” Channel and recreating it with the H256 algo selected (maybe I had originally selected the other algo I’m not sure)