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

Found a couple of documentation bugs #223

Open pgoldweic opened 3 years ago

pgoldweic commented 3 years ago

Hi, as I'm migrating from an older version of this middleware to 2.0.1, I've noticed what appear to be a couple of documentation bugs to me (in the readme file), as follows:

1- Everywhere where 'message_received' is used, should become 'message' (this is a Botkit change)
2- The middleware :before and :after signatures appear to be incorrect. I have only tested the 'after' method and not the 
'before', but I suspect that the same problem might apply to both. Specifically, instead of being:
 middleware.after = (message, assistantResponse) => async () => {
       // Code here gets executed after the call to Assistant.
       return assistantResponse;
  });
  we really want it to be: 
 middleware.after = async (message, assistantResponse) => {
       // Code here gets executed after the call to Assistant.
       return assistantResponse;
  });

(note the difference in signatures above for item #2). Following the signature used in the docs, my bot would be essentially mute, and 'watsonData' in a message ended up having as value the async function itself (odd), while the second signature (more in line with the one used in earlier versions) produces bot responses as expected.

Naktibalda commented 3 years ago

Please raise pull request