-
Notifications
You must be signed in to change notification settings - Fork 171
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
Slack direct messages not working #369
Comments
If I look in
If someone could point me toward where this is built I could perhaps figure out how to get name to be stored as U08FPSYTW |
You want to pass the message content back with
|
@Ashex Thanks! Does this work for initiating dm's too? The event comes in in the #bot channel and I want to then send a dm to the person who sent the message to the bot channel. I'll give it a try! |
It didn't work. |
Ah so you want to take a message from a channel and act on it by sending a direct message, that's a bit different. You're sending a message directly to a user so you want to actually look inside I haven't actually done what you're trying to accomplish but it's on my list of enhancements to make. The message should already include their user ID so you either want to override portions of the message dictionary in the response or add a new function that will send direct messages. |
Right! So I tried that and I get a user ID 'U08FPSYTW' and I try to send a message to that user. channel='U08FPSYTW' and I get
So where should we add this call? Is this something we should cache in slack_people.cache? Or is a better way to have channel try an im.open when it can't find a channel? |
I found a fix that works for me. I can do a PR if the solution is acceptable.
And added "channel" to Person:
I called it channel because that's the first thing I tried. You can now DM anybody using: Is this an acceptable solution? |
Another option would be to put it in the say function where it would catch a slack user ID inputted as a channel and convert it to the IM channel. But I like having all the dm channels in slack_people_cache |
I'm just a contributor so it's ultimately up to @skoczen how this should be integrated. I'm a bit worried about storing the DM channels in the cache as this can become resource intensive on large slack workspaces and potentially cause startup delays while it makes the I like the second option better, perhaps adding an argument to the say function that would explicitly call it a direct user message but the user ID always starts with Edit That argument may actually be necessary since say is used for other services besides slack and we don't know how the user ids are constructed. It'd be best to simply have an argument that is added to the event kwargs dictionary so that it is processed appropriately within Another Edit Forget about the argument and just do a pattern match against the channel and update the value with the direct channel. |
That makes a lot of sense. I'll work it up and make a pull request. @skoczen can take a look at the pr. |
Submitted solution here #375 |
I'm not sure if this is needed anymore. I'm merging in the new slack update and I'll report back. |
I had to do some extra condition checks in the slack backend for channel lookups and also set I opened #429 for that specifically so if you sort it with your PR we can close that out. Edit: My issue was specifically with file uploads but I believe there's overlap. |
I just got contract for another project that will be consuming cycles for a couple weeks. So if you have the time go for it! |
It seems sending to a user ID in slack doesn't work like I used to?
If I try:
self.say("Test message", channel = self.message.data.sender.id)
I get back:
Fri, 20 Jul 2018 23:43:29 [ERROR] I was asked to post to the slack U08FPSYTW channel, but it doesn't exist.
When I send a direct message to the bot and:
print(self.message.data.channel.id)
It prints
DBH45HA59
. I can't figure out how to getDBH45HA59
from the userU08FPSYTW
.@Ashex Any ideas on how to send DM through the slack backend?
The text was updated successfully, but these errors were encountered: