I am trying to integrate Watson discovery into my Watson assistant chatbot by following an IBM course on EDX. I followed the course instructions but when I add Watson discovery to my chatbot my web hooks returned this:
{"result":{"err":"Access is denied due to invalid credentials."}
When I expected something like this:
{"result":{["courses":"Data Science", "courses":"Ibm"]}
My serverless.yml
file looks something like this:
custom:
package: lab4
discovery:
username: apikey
password: aaaaaaaaa
environmentId: aaaaaaa
collectionId: aaaaaaa
url: https://gateway-lon.watsonplatform.net/discovery/api
intent: course_recommendation # DO NOT CHANGE
Could anyone please guide me to where I went wrong and please tell me if you need to see any other code. Thank you.
As the error message indicates the API Key that you are using is incorrect for the endpoint that you are using. This normally indicates that either your key is incorrect or that you are using an incorrect url.
I am guessing that you have only recently created a Discovery service instance, in which case I would expect the endpoint to look something like:
https://api.us-south.discovery.watson.cloud.ibm.com
or
https://api.eu-gb.discovery.watson.cloud.ibm.com
depending on where you deployed your instance.
You can determine what your endpoint should be, from the someplace you got your APIKey. If you can't see your endpoint there, then I suspect that you will also have the wrong APIKey.