Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found a couple of documentation bugs #223

Open
pgoldweic opened this issue Feb 16, 2021 · 1 comment
Open

Found a couple of documentation bugs #223

pgoldweic opened this issue Feb 16, 2021 · 1 comment

Comments

@pgoldweic
Copy link

pgoldweic commented Feb 16, 2021

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
Copy link
Contributor

Please raise pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants