-
Notifications
You must be signed in to change notification settings - Fork 635
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
Add support for response.sendPrivate
#442
Comments
thanks for pointing this hole in functionality out @alFReD-NSH! looking through those older issues really underscores how this adapter is really under serving users who want to simply send a DM. although the snippet you posted works, its really not preferred and may break in the future. the slack platform is moving away from any guarantees of uniqueness for user names, ever since the introduction of Shared Channels. you can see the details in this changelog entry. the future is about only operating on user IDs. this means that the internal implementation wouldn't just be calling Web API method i'd love a contribution! let's talk a little about how this should be done. first of all, we should make sure the implementation does not depend on the RTMClient DataStore (see #385) since it is being removed. as i previously mentioned, it should not depend on the user name either, only the ID. one idea (that might not be a good one, but worth considering) is we can keep the functionality decoupled from the Adapter code by implementing it as a response middleware and then registering it on adapter initialization. i'm happy to hear your thoughts on an implementation and even collaborate if you'd like. |
it seems like this unfortunately breaks the reply in private of hubot-help |
what's weird is robot.messageRoom msg.message.user.name works in the old hubot-slack, v 3.4.2, but in v4 it does not, why is that? |
@drdamour the difference is because the old hubot-slack (v3.4.2) purely uses the RTM API to send messages (which also means it cannot handle attachments and other nice things). in the new version, those messages are sent over the Web API (using i still think this would be a good feature to have, so adding the |
ok that makes sense...but it is a shame because a fair amount of hubot scripts rely on |
@drdamour heh, that map is what the data store that we just deprecated contains (amongst other things). i won't go into all the problems with the data store (see: slackapi/node-slack-sdk#330), but since the platform stopped guaranteeing the uniqueness of usernames its design hasn't worked as well. we could probably do better for just the username -> user ID map situation! we could build a cache where if the lookup failed, the web API would be used to find the correct mapping. the tricky part is cache invalidation. i'd have to think more about that. open to any ideas and thoughts! |
yeah makes sense to kill it in core slack...but want to do it in the hubot-slack layer to "polyfill" the hubot contract. |
Description
It'd be nice to have
response.sendPrivate
which basically sends a direct message to the given user that initiated that response. It would be a shortcut for this mainly:This is supported by hubot-irc, hubot-test-helper and hubot-rocketchat. Probably it would be also easier for users to figure out sending private messages quick and easy.(Check #159 and #299)
I'd like to contribute this, but I'm not really sure how to write to test it with the stubs and whatever we have in place.
The text was updated successfully, but these errors were encountered: