RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.62k stars 10.63k forks source link

Allow bots to send discreet notification to user in channel #9177

Closed mrsimpson closed 5 years ago

mrsimpson commented 6 years ago

Description:

Currently, all messages are public to all users who can view the channel. When implementing a bot, this bot has to be able to interact with a particular user inside the channel: It needs to e. g. ask him to provide further information or guide him through a process. All this interaction (which happens only between the bot and one user) needs to be hidden from other user's eyes in order to make the channel readable. This is particularly important with respect to the Rocket.Chat apps (#6890) which might also want to provide interaction with one user.

Server Setup Information:

Expected behavior:

As a user, I want to be able to interact with a bot without the rest of the channel noticing it.

Actual behavior:

All messages are visible to everybody

Proposal:

graywolf336 commented 6 years ago

For future reference, we kind of already have something in place which is used via RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', {}). That message is only shown on the web client and doesn't persist through a refresh.

timkinnane commented 6 years ago

I will add this to the new SDK and next release of the Hubot adapter. Adding a sendNotifcation method that is similar to sendMessage, but only sends the private non-persistent update as suggested by @graywolf336. In Hubot that would be invoked something like res.sendNotification - would be very handy for some instances such as an unauthorized or unrecognized command response. Instead of flooding the channel with "I'm sorry..." messages from the bot, the user could just keep editing their message until they got it right.

graywolf336 commented 6 years ago

This has been added to the Rocket.Chat Apps project as well and the pull request adding it has been merged into develop branch.

timkinnane commented 6 years ago

Thanks for the update @graywolf336 - The ability to send notifications is still a core server method though right? So a bot adapter could still send notifications the way they currently send standard messages (i.e. through Asteroid DDP method call)? If that's not the case and they need to operate via a Rocket.Chat app for this functionality, can you explain that architecture.

graywolf336 commented 6 years ago

@timkinnane No. There is no "meteor method" which is defined for the send notifications, it's a function inside the server code.

As for whether a bot should work inside an App, that was something we discussed at our Summit. The answer decided was that right now, no it won't but as soon as we start working on the market place for the Apps we will readdress the topic and proceed to figure out how bots can be Apps.

timkinnane commented 6 years ago

OK thanks @graywolf336. I actually just caught up on the context a couple days ago. As I understand it though, the new apps-as-bots architecture will still live alongside other external hosted bots, as it would have to in order to allow bots with other frameworks and bot platform providers. I need to start another discussion on that issue to work out a clear vision because it will help clarify lots of issues about the "internal Hubot". So let's continue this there. I do think the notification functionality is a really important piece for improving conversational UI and should be available to external bots also.

jrobeano commented 5 years ago

@timkinnane - Hi Tim, my sincere apologies if this is very obvious... but were you able to implement the notification in the SDK as you mentioned that you might?

NickSpirakus commented 2 years ago

@mrsimpson Was this ever resolved for you? I don't see the functionality or code changes.