watson-developer-cloud / botkit-middleware

A middleware to connect Watson Conversation Service to different chat channels using Botkit
https://www.npmjs.com/package/botkit-middleware-watson
Apache License 2.0
207 stars 257 forks source link

Error: 404 Resource not Found #243

Open Mattw11486 opened 2 years ago

Mattw11486 commented 2 years ago

image image image

I am getting this error when trying to integrate the Watson Assistant to the botkit. It boots up fine but when trying to send a message to trigger the response from Watson I get this error.

Naktibalda commented 2 years ago

According to https://github.com/ibm-cloud-docs/watson/blob/master/endpoints-change.md

The watsonplatform.net endpoint URLs were retired on 26 May 2021. Update your API calls to use new URLs.

You can find instructions how to find correct endpoint at https://cloud.ibm.com/apidocs/assistant-v1#endpoint-cloud

Mattw11486 commented 2 years ago

Maybe I am not looking in the right spot for the endpoints as well as API credentials When I open up Watson Assistance and then click on settings I do not see a URL that links to a workspace nor can I find a workspace ID that matches what it requests in the middleware's .env files ASSISTANT_URL=https://api.us-south.assistant.watson.cloud.ibm.com/instances/Imyinstanceid}/v2/assistants/(environmentid)/sessions ASSISTANT_IAM_APIKEY=theapikey I am getting from the screenshot WORKSPACE_ID=assistant id image

Mattw11486 commented 2 years ago

I think the main issue from what I can gather is that the middleware was written with Watson Assistant version 1 and I see no way of reverting the Assistant from version 2 back to version 1. I can switch to classic experience in the IBM Cloud Manager however the Get API Details that used to be in skills is no longer there so I see no way of getting a workspace_ID that is being required for the middleware authentication.

Naktibalda commented 2 years ago

Sorry, I can't help with that, I haven't used this library or Watson Assistant since April 2021.

pgoldweic commented 2 years ago

@Mattw11486 and @Naktibalda , while I'm not sure this will answer your question, I thought I should mention a few details I'm aware of:

Mattw11486 commented 2 years ago

@pgoldweic I suspected this might be the issue as when I go into the source files for the middleware it only lists V1. When I go to the IBM Watson Assistant dashboard, I converted the bot to 'Classic Experience' Which seems to convert the bot to v1. However I still do not see a workspace ID listed when I click on a skill and select API details.

Do you currently have Watson working for botkit? Are you able to provide a guide?

pgoldweic commented 2 years ago

Hi @Mattw11486 , while I still have Watson working for botkit, I am still using a Watson Assistant instance created a long time ago (when 'standard' was an option at the time of instance creation, which it has not been for a while now). Having said that, I plan to create a new instance in the next weeks for testing purposes. I'm not sure how soon I'll get to this though, but it's definitely in my plans. Then I'd be able to confirm (or hopefully not), what you're saying about the 'classic' experience and not being able to see the workspace id. However, in the meantime, I suggest you post in the Watson Community forum and try to get IBM to answer this. Since they claim that you should be able to use apis V1 and V2 side by side to each other, there has to be a way to obtain the workspace id that you need. If not, they would have to do something about it (which is why I think you should definitely post). There might be a simple answer to your question there actually (let's all hope so). Another thing: the kind of 'experience' you use in Watson should be independent of whether you can access APIs v1 or v2.

Mattw11486 commented 2 years ago

Yeah I submitted a post on the Watson Community a few days ago but unfortunately no response back yet.

pgoldweic commented 2 years ago

@Mattw11486 , I'm wondering if the response you got yesterday worked for you (from the community forum). Would be good to know. BTW, I also wanted to mention that I was able to create a new skill in the new classic experience (new Watson Assistant instance, lite plan) to which I imported a json file for a skill that I had working in my old instance - reduced to 100 intents-, and I was able to see the regular 'View Details' with the workspace id information once it was uploaded. I believe that I had not been able to see the API details - just like you reported- for new skills that I created before successfully importing the old skill. Then, after this successful import, all the skills I create appear to display the 'View Details'.

Mattw11486 commented 2 years ago

I will try the steps tonight or whenever I get a chance to look at it. Been swamped at work this week. I might try downloading the json file and see if it provides what I need

Mattw11486 commented 2 years ago

Looks like its going to be a no go even with downloading the .json file I don't see a workspace ID and in skills view api details I just see a skill ID nothing of which works when trying to integrate it with the botkit middleware

pgoldweic commented 2 years ago

skill id is what you need for integration @Mattw11486

Mattw11486 commented 2 years ago

When I use the skill ID it gives me the 404 error still image

image

pgoldweic commented 2 years ago

Hi @Mattw11486 , it's hard for me to understand the nature of the error you are describing. Perhaps if you share more of the stack trace that might help. BTW, I see that you are using Slack and I'm not familiar with using the Slack adapter (I've used the web adapter). I wonder if the error might be related to this adapter in particular? (I'm not seeing any mention of such adapter in the code you shared though).

Mattw11486 commented 1 year ago

Here is the stack trace not sure if this provides any more clarity I also have the web adapter hooked up to this bot as well image

pgoldweic commented 1 year ago

Just to clarify, you said you have the web adapter working for it too. Does it work? If so, this would be clearly a slack-adapter related problem then (which I'm afraid I can't say much about - hopefully others that work with it can help!). Also for my own understanding, you are now using the V1 API for Watson, and NOT using a Watson assistant instance, correct? (as you know by know, this middleware only works with V1, and this pretty much forces one not to use an actual Assistant instance but the skills directly to communicate with botkit)

Mattw11486 commented 1 year ago

Strangely enough, I started completely from scratch and now it seems to be working! I don't know where exactly I went wrong as I tried so many different things. It may have been an issue with the URL even though I was using the same exact URL from the .env file in the example included within this repo. It of course still will not work for V2 and only works for the classic experience (V1) but that is okay.