Best answer

Slack - Invite To Channel action failing

  • 11 January 2021
  • 5 replies
  • 566 views

Userlevel 1

Hi there,

 

I’m having some trouble getting the ‘Invite User To Channel in Slack’ action working. My scenarios is I create a Zapier Web Hook, pass it the name of a channel and a users Slack ID, split these into two fields, and then use the ‘Invite User To Channel in Slack’ action to do the invite.

 

However when I go to test the action I get the following error:

The invite could not be sent to Slack.

Error from Slack: channel_not_found

 

I have confirmed that the user I am authenticating with is a member of the channel, the channel is also public, and the channel name is correct (have tested both with and without # at the front). I’ve also confirmed the user ID is correct (have tested both with and without @ at the front). I’m pretty confident the fields I’ve created are correct, as if I instead change the action to post a message in the channel, and use the same field to determine the channel to post to, it works fine without error, however for some reason just in the Invite action it thinks the channel doesn’t exist even though it’s the same name.

 

Has anyone encountered something like this before or know if there’s something I may have configured incorrectly here? Any suggestions would be greatly appreciated!

 

Thanks!

icon

Best answer by Troy Tessalone 12 January 2021, 00:22

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Userlevel 7
Badge +14

Please provide screenshots of how your Zap step is configured so we can troubleshoot further, thanks.

Userlevel 1

Hi Troy,

 

Here’s what I have so far, I’ve mostly just copied a similar Zap someone else had set up for creating a channel based on a web hook, but changed the last action to adding a user. I’m sure there may be better ways to handle the fields but this is what I have after basing it on the other Zap.

 

So I have the webhook, and then turn the fields passed to the webhook into named fields with Python to access them in actions (this part I’m sure there’s probably better ways to do):

 

And then have the action for inviting a user, using the channel name and user ID:

 

And it gives this error when testing:

 

However if I add this action for sending a message, so using the same field for the channel, this action works:

 

Hope that helps explain things moreclearly.


Thanks!​​​

Userlevel 7
Badge +7

Hi @ZapNet ,

 

As of the slack API you need to use the slack channel ID. You can find this channel ID by browsing your slack in a browser:

 

Let me know if this works or doesn't work.

~Bjorn

Userlevel 7
Badge +14

The Slack Channel needs to be an ID if dynamically mapping a data point, same concept as Member (User) ID.

Example


There’s a subtle difference between the 2 action steps - notice the Send Channel Message has the description underneath it while the Invite User to Channel does not.

 

Also, not sure you need the Python Step 2, but you might need a different step there to transform (try Formatter Utilities Lookup Table) the Channel Name to the Channel ID if that’s not an available data point from the webhook trigger step.

Userlevel 1

Thank you both!

 

It seems so simple now, this worked.

 

I had previously tried to look around the Channel Details to see if there was an ID like there was with Users, but could not see one. I completely missed it - my bad!


Thanks again! And for the additional tips as well, much appreciated.​​​​