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

Next() function for receive function #218

Closed NxP4Code closed 3 years ago

NxP4Code commented 3 years ago

It seems next() is not called in the receive function. Per botKit documentation Next() should be called at the end of receive function to process all middleware stack.

https://botkit.ai/docs/v0/middleware.html#hear-middleware

Send and Receive middleware functions are added to Botkit using an Express-style "use" syntax. Each function receives a bot parameter, a message parameter, and a next function which must be called to continue processing the middleware stack.

Naktibalda commented 3 years ago

@NxP4Code You are reading documentation of Botkit V0, but comparing it to the latest version of this library. Watson Botkit middleware 1.* was compatible with Botkit V0 and it called next() in https://github.com/watson-developer-cloud/botkit-middleware/blob/v1/lib/middleware/index.js#L69-L91

Naktibalda commented 3 years ago

Up to date documentation is at https://botkit.ai/docs/v4/core.html#middlewares

NxP4Code commented 3 years ago

Yes, I noticed V1 of middleware had next() support. It was my mistake that I pasted the link of the BotKit V0 link. Even in V4 BotKit suggest that the signature of middleware should be in the following form

image