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

Slack API Tester is set off when a message happens in a DM #10

Closed
stalltron opened this issue May 22, 2018 · 13 comments
Closed

Slack API Tester is set off when a message happens in a DM #10

stalltron opened this issue May 22, 2018 · 13 comments

Comments

@stalltron
Copy link

stalltron commented May 22, 2018

This has been happening from time to time and I've no just traced it to the slack-archive-bot. When I type a message in a DM, the Slack API Tester rattles off "No results found." See the screenshots below. What might be going on here?

screen shot 2018-05-22 at 3 30 39 pm
screen shot 2018-05-22 at 3 30 20 pm

@stalltron stalltron changed the title Buggy Slack API Tester Slack API Tester is set off when a message happens in a DM May 22, 2018
@docmarionum1
Copy link
Owner

Odd. Is Slack API Tester the name of your archive bot?
Did you somehow add the bot user to a DM with another user? I didn't think that was possible.

The only path into handle_query which returns that error is if the message is in a DM channel. It only checks if it's a DM, not who the DM is between. But, as far as I understood, a bot wouldn't be listening to messages in a DM between two other users.

I have a fix that I think would ensure it only responds in DMs to itself, but I don't know how I would test it because I don't know how to get it into another DM, if that is indeed the problem.

@stalltron
Copy link
Author

Thought I answered this earlier. Slack API Tester is a Slack tool that I believe is enabled automatically so that apps can call the Slack API. Name of my archive bot is timescale_ab.

Did not add the bot to private DMs.

@docmarionum1
Copy link
Owner

I don't have Slack API Tester and couldn't find any documentation about it. Do you have any docs that I can see about setting it up?

As I said, I think I have the fix but I can't recreate your issue to test it.

@rjbergerud
Copy link
Contributor

I found the issue had to do at least partly with messages being responded too only if the user name wasn't bot, however the user name for my bot seemed to be Slack API Tester, so the bot would start trying to respond to the same messages it just put out and loop.

@docmarionum1
Copy link
Owner

docmarionum1 commented Jun 20, 2018

Oh, how did you create the slack integration? Is it a bot or an app?

@stalltron @rjbergerud

@rjbergerud
Copy link
Contributor

@docmarionum1 I was setting up the bot following this guide
"Setting up your bot users"
https://api.slack.com/bot-users
So its set up as a bot within an app.

But then, I used the Slack PI Legacy token
https://api.slack.com/custom-integrations/legacy-tokens

@docmarionum1
Copy link
Owner

I'm still baffled by how you two got that. I created a bot using an app as you did. But it still shouldn't be active in DMs between two human users. Is there a way to invite a bot to a DM?

@stalltron
Copy link
Author

@docmarionum1 no, I don't think so. It seems the bot is triggering the API Tester somehow...

docmarionum1 added a commit that referenced this issue Sep 1, 2018
@maxkan
Copy link

maxkan commented Nov 4, 2018

the issue is still there and it makes the bot unusable. each time you search for something it first gives you search results and then goes to endless "not found" loop. Bot name is "history", The search response goes under app name: "History", capital 'H'.
Also here is what I see in the log:
image

@alehkot
Copy link

alehkot commented Nov 4, 2018

Bot is trying to reply to its own messages. I suggest trying to resolve the issue by changing this line
to
if event['type'] == 'message' and ('subtype' not in event or event['subtype'] != 'bot_message'):
It works on my local :)

@docmarionum1
Copy link
Owner

@maxkan A recent change, #14 allows you to specify the username of the bot, which, I think, will fix that issue. Have you tried this?

If not, try running with the flag -b History.

I've never actually been able to replicate this issue after setting up the app in a couple of different methods, so I can't verify that it in fact works, but it looks like it should.

@alehkot
Copy link

alehkot commented Nov 4, 2018

@docmarionum1 Thanks, your solution works on my env as well. I think it's a little bit confusing that App name should be used as is instead of using its machine name, i.e. if an app name is "Acme Test Bot", the machine name is "acme_test_bot", but parameter -b should be used with "Acme Test Bot".

@docmarionum1
Copy link
Owner

Seems to be fixed.

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

5 participants