Facing issue while integrating bot with web/mobile client channel

Hi @riya.sharan,

Please find the response for this query in Integrating Bot with WebApp developed in Angular

Regards,
Yoga Ramya.

Mitalee,

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:

  1. 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
  2. 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.
  3. Any other error on console - Please deal with the error on a case to case basis.

I hope this answers your question/ concern.

1 Like

Hello,

I am facing the same issue and I’m hoping someone can advise.

I have followed all the steps of the tutorial:

https://developer.kore.ai/docs/bots/advanced-topics/kore-web-sdk/kore-ai-web-sdk-tutorial/

and have the files and folders of the web-core-sdk project in the SDKApp/sdk folder

When i load http://localhost:3000/UI/

I see:

“error verifying the jwt”

and I see this in the browser console:

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)

I am using this value in the index.html:

botOptions.JWTUrl=“http://localhost:3000/api/users/sts”;

but have also tried:

botOptions.JWTUrl=“http://demo.kore.net/users/sts”;

As well as setting isAnonymous to both true and false.

Am i missing a step?

Thanks,
Dan

1 Like

Hello,

I am also facing this issue (the issue of the original post) and I’m hoping you can help.

When loading http://localhost:3000/UI/ I see:

“error verifying the jwt”

and in the web console this:

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)

In my index.html I have this:

botOptions.JWTUrl =“http://localhost:3000/api/users/sts”;

and have also tried

botOptions.JWTUrl =“http://demo.kore.net/users/sts”;

and neither works.

I can see from the server logs that the token is being generated locally (in the SDKApp project)

I’m hoping someone can advise. My bot is published and I’ve double checked the bot info (client id, client secret etc)

Am i missing a step?

Thanks,
Dan

Hi Team ,

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.

JWTerror

Have you started the SDKApp (node.js app)? You will need to have WedSK contents unzipped into SDK App. Start SDK App.

Hope you all have read through this post in the thread above.

Hello,

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)

Thanks,
Dan

@dan.stoddart You need not delete the channel though.Incase, if you want the channel to use another application which uses HS256 instead of RS256, you can create another application by selecting the HS256 alg and then associate the new app with the channel.

Below is the difference between RS256 and HS256 algorithms:
RS256 is an asymmetric algorithm, and it uses a public/private key pair: the identity provider has a private (secret) key used to generate the signature, and the consumer of the JWT gets a public key to validate the signature.
HS256 , on the other hand, is a symmetric algorithm, with only one (secret) key that is shared between the two parties

HI @swathi.vadlamani I am facing the issue while integrating the bot the error which i am facing is :
Error: Failed to lookup view “error” in views directory “C:\SDKApp\sdk”
at Function.render (C:\SDKApp\node_modules\express\lib\application.js:579:17)
at ServerResponse.render (C:\SDKApp\node_modules\express\lib\response.js:961:7)
at C:\SDKApp\app.js:55:7
at Layer.handle_error (C:\SDKApp\node_modules\express\lib\router\layer.js:71:5)
at trim_prefix (C:\SDKApp\node_modules\express\lib\router\index.js:310:13)
at C:\SDKApp\node_modules\express\lib\router\index.js:280:7
at Function.process_params (C:\SDKApp\node_modules\express\lib\router\index.js:330:12)
at IncomingMessage.next (C:\SDKApp\node_modules\express\lib\router\index.js:271:10)
at done (C:\SDKApp\node_modules\express\lib\response.js:956:25)
at Function.render (C:\SDKApp\node_modules\express\lib\application.js:581:14) ’

Hi @siripurapurahul,

We hope you have read the responses from the above thread.
Please go through the following solutions to resolve the error, however, this error shouldn’t be blocking the bot functionality.

And

Kindly implement as mentioned on the above responses and let us know if the issue is still persistent even after making the necessary changes.

Regards,
Yoga ramya.

Heyo!

I was successfully able to follow the tutorial and connect to the sample Travel Application, but when i try to integrate with my Demo bot i am getting 401 errors.

I have triple checked my Bot_name, bot_id, client_id, and client_secret and gets rid of this error :frowning:

Anyone know where else I should look?

Hi @yogaramya.mendu I am still not able to see chat window in the browser even after following the above steps can you please refer to my index.html and tell me if anything needs to be changed so that i could modify it accordingly i have tried different urls for each different url it is throwing different error

screenshot1 screenshot2 screenshot3 screesnhot4

for url: http://localhost:3000/api/users/sts
The response in browser : respond with a resource.
The error in command prompt is :
Error: Failed to lookup view “error” in views directory “D:\dev\SDKApp\sdk”
at Function.render (D:\dev\SDKApp\node_modules\express\lib\application.js:579:17)
at ServerResponse.render (D:\dev\SDKApp\node_modules\express\lib\response.js:961:7)
at D:\dev\SDKApp\app.js:55:7
at Layer.handle_error (D:\dev\SDKApp\node_modules\express\lib\router\layer.js:71:5)
at trim_prefix (D:\dev\SDKApp\node_modules\express\lib\router\index.js:310:13)
at D:\dev\SDKApp\node_modules\express\lib\router\index.js:280:7
at Function.process_params (D:\dev\SDKApp\node_modules\express\lib\router\index.js:330:12)
at IncomingMessage.next (D:\dev\SDKApp\node_modules\express\lib\router\index.js:271:10)
at done (D:\dev\SDKApp\node_modules\express\lib\response.js:956:25)
at Function.render (D:\dev\SDKApp\node_modules\express\lib\application.js:581:14)


and for the url : http://demo.kore.net:3000/users/sts

I am not seeing any error in my command prompt

Output in the browser:

at /var/www/html/scripts/jwtservice/app.js:30:13
at Layer.handle [as handle_request] (/var/www/html/scripts/jwtservice/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:312:13)
at /var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:330:12)
at next (/var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:271:10)
at /var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:618:15
at next (/var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:256:14)
at Function.handle (/var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:176:3)
at router (/var/www/html/scripts/jwtservice/node_modules/express/lib/router/index.js:46:12)

@swathi.vadlamani
We are using travel planning sample bot for practicing the chatbot implementation with sdkApp.
we chose HS256 algorithm and jwtURL as “http://localhost:3000/api/users/sts”. we are getting following error in node console. browser is displaying “respond with a resource” message.

Failed to lookup view “error” in views directory “D:\dev\SDKApp\sdk”.

Even we tried with “http://demo.kore.net/users/sts” but no luck. This time browser is displaying follwoing message “Cannot GET /users/sts”

Can you please help me in resolving this issue.

Thanks in advance

Hi @siripurapurahul,

Your query has been answered in the following post:

Regards,
Yoga Ramya.

Hi @yogaramya.mendu @swagata.sengupta Thanks a lot for helping integrating the chat bot in the web /client channel Now i am trying to integrate the chat bot with online REST service as a Action Task .
The API Request Url is : http://dummy.restapiexample.com/api/v1/employee/16332,
Please find the screenshots how i have tried to integrate the Service:
1 2 3

While coming to the Authorization I have given it as none and i didnt define any parameters for the service as they are not required even if everything is fine I am getting this particular error in the output. Please find the screenshot of the error:
4

Can you guys please help me in that I am really struck with it .

Thanks in advance

I’ve checked the response of this endpoint and see the content-type coming in text/html; charset=UTF-8 format.

Could you please use a Dialog Task instead of the Action task to achieve this requirement?

Please refer to the below snips which could guide you on building a dialog task to achieve the same.

image

image

image

image

image

1 Like

@Subrahmanyam Thanks a lot for the immediate reponse It helped me a lot.

@Subrahmanyam Hi Is there any possibility in Kore.AI that the bot returns a word document based on a Task If possible can you please help me in that through the steps.

Thanks in advance

Please refer to the below topic

Hello
I have followed all the steps including starting startServer.js and I could load the chat window through http://localhost:3000/UI/ successfully. However I am not able to load it through clicking on index.html. I want to add index.html to another application and execute.
Issue in browser on inspecting is:
issue
Access to XMLHttpRequest at ‘http://localhost:3000/api/users/sts’ from origin ‘null’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource

Please help me resoliving this issue. Thanks!