watson-developer-cloud botkit-middleware Resource not found

415 views Asked by At

I am new to the bot world. I am trying to integrate a Conversation service create on IBM Watson with a Slack Bot using the botkit middleware. I have simply obtained the code from Git (Botkit Slack Integration and am trying to use that to answer queries on Slack from my Watson Conversation service. But, upon receiving the slack messages, the API returns following errors. There is not much documentation on how to handle these errors on Internet. Could someone please help me out?

`> node simple-bot-slack.js

info: ** No persistent storage method specified! Data may be lost when process shuts down. info: ** Setting up custom handlers for processing Slack messages info: ** API CALL: https://slack.com/api/rtm.start Client server listening on port 5000 notice: ** BOT ID: jarvis ...attempting to connect to RTM! notice: RTM websocket opened info: Slack message received { type: 'message', channel: 'C72GK14JD',
user: 'U72VDTC2F', text: 'Hi', ts: '1505453454.000117',
source_team: 'T733VG8DS', team: 'T733VG8DS', event: 'direct_mention', match: [ 'Hi', index: 0, input: 'Hi' ],
watsonError: { Error: Resource not found at Request._callback (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\watson-developer-cloud\lib\requestwrapper.js:88:1 5) at Request.self.callback (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\request\request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request. (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\request\request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at Gunzip. (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\request\request.js:1091:12) at Gunzip.g (events.js:292:16) at emitNone (events.js:91:20) at Gunzip.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) cause: { Error: Resource not found at Request._callback (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\watson-developer-cloud\lib\requestwrapper.js:8 8:15) at Request.self.callback (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\request\request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request. (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\request\request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at Gunzip. (D:\node\wrath\botkit-middleware-master\examples\simple-bot\node_modules\request\request.js:1091:12) at Gunzip.g (events.js:292:16) at emitNone (events.js:91:20) at Gunzip.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) code: undefined, error: 'Resource not found' }, isOperational: true, code: undefined, error: 'Resource not found' } }

`

1

There are 1 answers

1
Yash On BEST ANSWER

Alright! The resource not found was coming from the botkit because it was unable to reach the Conversation API. The mistake I was doing was that I was providing the URL of my own conversation service Workspace instead of the conversation URL that was supposed to be mentioned as

CONVERSATION_URL=https://gateway.watsonplatform.net/conversation/api

I just corrected it and the thing works like butter. :) If anyone else is facing the same problem, my advice will be to check the other credentials as well. Although it seems pretty straightforward, mistakes can always happen.

Happy coding!