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

Channel_not_found in new conversations_list usage #337

Closed
Bartlebyy opened this issue Aug 3, 2020 · 15 comments
Closed

Channel_not_found in new conversations_list usage #337

Bartlebyy opened this issue Aug 3, 2020 · 15 comments
Labels

Comments

@Bartlebyy
Copy link

Problem

On the latest release of 0.15.0 (I upgraded due to the deprecated channels_list to use the new conversations_list) I'm seeing an error when I try to query by a channels name rather than a channel_id. I expect to be able to just client.conversations_setTopic({:channel => '#channel_name', :topic => 'random topic}) <- but the hashtag channel name format no longer works and only the channel_id approach works.

I find that the code is much more readable with channel names than ids, so please help!

image

@dblock
Copy link
Collaborator

dblock commented Aug 3, 2020

That seems odd as https://api.slack.com/methods/conversations.info is a direct replacement for channels.info. What kind of channel is this (public? private DM?).

Try calling conversations_info(channel: '#channel_name'), do you get this error? Try without a #, then try with the ID (that must work), then try again with channels_info for all the same. Let us know what you see?

@dblock dblock added the bug? label Aug 3, 2020
@Bartlebyy
Copy link
Author

I tested with two channel names, both public. I tested with and without the hashtag, didn't work.

conversations_info with channel name
image

without hashtag
image

and I tested again with the channel_id and it works

@dblock
Copy link
Collaborator

dblock commented Aug 3, 2020

You should open a ticket with Slack and see what they say. AFAIK it was never documented that you could supply a channel name, but would be nice to know that they explicitly deprecated this, and I would like to know what users should do to translate a channel name into an ID.

We changed this in #331, cc: @wasabigeek - I presume we did test this IRL?

@wasabigeek
Copy link
Contributor

wasabigeek commented Aug 5, 2020

@dblock 😨 I did not comprehensively test, only tested the conversations_list/channels_info endpoint (to record VCR), will take a look.

EDIT: Hmm.
https://github.com/slack-ruby/slack-ruby-client/pull/331/files#diff-afe79d45c0bcc727ccb0118b0d0a8dfbR31

@wasabigeek
Copy link
Contributor

@Bartlebyy could I trouble you to check the result of conversations_list.channels? Do the results include the names of each channel? Would be great if you could share an example (anonymised is fine) of the result, something like conversations_list.channels.map(&:to_h).

@wasabigeek
Copy link
Contributor

@Bartlebyy any update on this?

@Bartlebyy
Copy link
Author

@wasabigeek yes, it returns a name attribute. Here's a small snippet with anonymized data. I grabbed the first 2 channels.

created=1514966545, creator=CREATOR_ID, id=ID, is_archived=false, is_channel=true, is_ext_shared=false, is_general=true, is_group=false, is_im=false, is_member=false, is_mpim=false, is_org_shared=false, is_pending_ext_shared=false, is_private=false, is_shared=false, name=general, name_normalized=general, num_members=x, parent_conversation=, pending_connected_team_ids=[], pending_shared=[], previous_names=[], purpose=creator=, last_set=0, value=Channel message, shared_team_ids=["TEAM_ID"], topic=creator=ID, last_set=1566994107, value=Value copy, unlinked=0
14:28:45 web.1    | created=1415966621, creator=CREATOR, id=ID, is_archived=true, is_channel=true, is_ext_shared=false, is_general=false, is_group=false, is_im=false, is_member=false, is_mpim=false, is_org_shared=false, is_pending_ext_shared=false, is_private=false, is_shared=false, name=test, name_normalized=test, num_members=0, parent_conversation=, pending_connected_team_ids=[], pending_shared=[], previous_names=[], purpose=creator=ID, last_set=1414966625, value=Channel message, shared_team_ids=["ID"], topic=creator=, last_set=0, value=, unlinked=0

@wasabigeek
Copy link
Contributor

@Bartlebyy, unfortunately I wasn't able to replicate this, using client.conversations_setTopic({ channel: '#slack-ruby-client', topic: 'test' }) works for me.

Could I ask for your help again to:

  • check that the channel name is correctly invoked in #conversations_setTopic
  • check that the desired channel name is returned as part of client.conversations_list.channels.map(&:name)
  • share your Ruby and Gemfile.lock versions (especially for the following:)
slack-ruby-client (0.15.0)
      faraday (>= 1.0)
      faraday_middleware
      gli
      hashie
      websocket-driver

@Bartlebyy
Copy link
Author

I'll check the other stuff later, but we are using the older verification tokens

@wasabigeek
Copy link
Contributor

@Bartlebyy does your team have >100 public channels? I was investigating further and it seems we only search the first page of results for both channels_list (the docs aren't clear what the default limit is) and conversations_list (the default limit is 100) - could you help to confirm this while checking the results of client.conversations_list? I think you can look in client.conversations_list.response_metadata for a cursor, which means there are more results that are not being returned.

Thanks!

@Bartlebyy
Copy link
Author

@wasabigeek we definitely have over 300 public channels

@dblock
Copy link
Collaborator

dblock commented Aug 24, 2020

@Bartlebyy does your team have >100 public channels? I was investigating further and it seems we only search the first page of results for both channels_list (the docs aren't clear what the default limit is) and conversations_list (the default limit is 100) - could you help to confirm this while checking the results of client.conversations_list? I think you can look in client.conversations_list.response_metadata for a cursor, which means there are more results that are not being returned.

That would be a bug ...

@wasabigeek
Copy link
Contributor

wasabigeek commented Aug 24, 2020

Yup, it would be helpful if we can confirm this is the reason why the channels are not found. I'll work on fixing that in the meantime!

dblock added a commit to dblock/slack-ruby-client that referenced this issue Aug 24, 2020
@dblock
Copy link
Collaborator

dblock commented Aug 24, 2020

Fix in #339, @wasabigeek care to CR?

@dblock dblock closed this as completed in 5703385 Aug 24, 2020
dblock added a commit that referenced this issue Aug 24, 2020
Fix #337: channel_not_found error resolving channel IDs with 100+ channels
@dblock
Copy link
Collaborator

dblock commented Aug 24, 2020

@Bartlebyy care to try HEAD now that #339 was merged?

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

No branches or pull requests

3 participants