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

err-stackstorm plugin unable to work with SlackV3 errbot backend. #42

Open
Niyakiy opened this issue May 18, 2022 · 3 comments
Open

err-stackstorm plugin unable to work with SlackV3 errbot backend. #42

Niyakiy opened this issue May 18, 2022 · 3 comments

Comments

@Niyakiy
Copy link

Niyakiy commented May 18, 2022

Hi, I've configured the latest err-stackstorm + errbot with the latest err-backend-slackv3 and using the Classic Slack application's (with RTM support enabled) slack token only. errbot[slack] v.6.1.8 is used with latest StackStorm.

All connections (errbot to Slack and err-stackstorm to StackStorm) were established well w/o errors.

However, during any message posting from Slack to StackStorm I'm getting this:

errbot-slack-st2-errbot-1  | 2022-05-18 12:24:56,597 INFO     errbot.core               Processing command "st2" with parameters "st2 infra list" from <@U030Z4MDUGY>
errbot-slack-st2-errbot-1  | 2022-05-18 12:24:56,611 WARNING  errbot.plugin.st2.chat_adapters
errbot-slack-st2-errbot-1  |             username = None
errbot-slack-st2-errbot-1  |             user_id = U030Z4MDUGY
errbot-slack-st2-errbot-1  |             channel_name = None
errbot-slack-st2-errbot-1  |             channel_id = None

and later, Slack pack in StackStorm is unable to properly communicate with Slack due to a missing username.

@nzlosh can you suggest something?

@nzlosh
Copy link
Owner

nzlosh commented May 18, 2022

I was able to reproduce the same behaviour as you but only when posting a direct message to the bot.

00:09:55 WARNING  errbot.plugin.st2.chat_ad                                                                                                       
            username = None                                                                                                                       
            user_id = UL6DDE8BS                                                                                                                   
            channel_name = None                                                                                                                   
            channel_id = None   

If I posted to a channel, the username is resolved:

00:05:42 WARNING  errbot.plugin.st2.chat_ad                                                                                                       
            username = nzlosh                                                                                                                     
            user_id = None                                                                                                                        
            channel_name = errbot-dev-test                                                                                                        
            channel_id = None 

The channel information was derived from the message from field

_from [<class '_slack.room.SlackRoomOccupant'>] #errbot-dev-test/nzlosh

In the case of a direct message it is:

_from [<class '_slack.person.SlackPerson'>] <@UL6DDE8BS>

I'll need to investigate further to determine the best way to handle this situation. You might be able to work around the issue of the slack pack being unable to send message to the raw text user_id by wrapping it inside the <@user_id>form. I don't know for sure if the pack will work correctly with that format as I don't use it.

More information about Slack usernames can be found here https://api.slack.com/changelog/2017-09-the-one-about-usernames

@Niyakiy
Copy link
Author

Niyakiy commented May 19, 2022

@nzlosh thanks for the response. Yes - the main way our system works (ChatOps functionality) is direct messaging with Slack bot user so sensitive details (like generated passwords) will not be accessed by other users.

Side question: do you know why errbot's slack backend refuses to consume recently created Slack classic application's token? That situation drove me to use SlavkV3 backend which isn't fully supported by other moving parts of our system.

@nzlosh
Copy link
Owner

nzlosh commented May 19, 2022

I haven't used the slack backend for a few years now, so I don't know what could be going wrong. As far as I know it should work with classic tokens but it uses such an old slackclient, anything could be going wrong.

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

No branches or pull requests

2 participants