-
Notifications
You must be signed in to change notification settings - Fork 2.3k
User ID in send middleware with the Web adapter #2030
Comments
Can you please send these in as a pull request? And can you include some test cases when you do? |
Hi @benbrown! I have just submitted the related tiny PR. Finally I did not add user to the activity object in So, with this fix, a send middleware like this can be done: (bot, message, next) => {
if (message && message.type === 'message') {
const user =
message.user ||
(message.recipient && message.recipient.id);
// => Store here the bot message for the given user
}
next();
} |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hey! I have just added a comment to the related PR (#2043) in order to remove the The code is working nicely in my chatbots powered by Botkit 🚀 I hope the next release of Botkit will integrate this PR. Cheers, |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
🆙 I still hope the next release of Botkit will integrate the related PR (#2043)... |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
When using a send middleware with the Web adapter, the user ID is not available in the message object during a conversation (i.e. Dialog).
For instance, the middleware
(bot, message, next) => { console.log(message); next(); }
displays these data for a bot message:A possible solution consists in extracting the user ID for the convo vars in the function
makeOutgoing(dc, line, vars)
of
conversation.ts
:Then the message user can be leverage in the send middleware 🎉
Moreover, when a message is sent with
bot.reply
orbot.say
, the user ID is not present in the traditional (legacy?)messager.user
.It could be great to add it in the function
ensureMessageFormat(message)
ofbotworker.ts
:Can these points be integrated in a future release of Botkit?
How can i make myself useful to the code?
Thanks,
Chris
Context:
The text was updated successfully, but these errors were encountered: