Slack nodes for KNIME

There are now some KNIME nodes that allow sending messages to a slack channel(s) available from http://update.knime.com/community-contributions/trunk. These will likely progress into the 3.5 build shortly.

Details of the nodes can be found here: https://github.com/webbres/knime_slack  

Any problems / feature requests please let me know. Creating an issue in the github repo is most likely to get my attention.

Cheers

Sam

7 Likes

Hi Sam,

Thanks for that! It looks really great, some very useful stuff!

Cheers,

Roland

I second that. Very cool!

Hi Sam,
These nodes don’t seem to work with private channels. I can see the ‘general’ and ‘random’ channel that Slack adds to new users/apps by default, but can’t get it to see any additional channels I add the app/bot to. Any suggestions?
Regards,
–George

Hmm, I can’t recall if I’ve not thought abopte it, purposefully excluded private channels or left it up to the permissions set for the bot.

I would suggest looking at what permissions you have set for your bot and I will try and see whether I need to make any changes to show the private channels and post an update.

Cheers

Sam

1 Like

The api call I make doesn’t support private channels. I will update the nodes to handle these.

Cheers

Sam

3 Likes

@George_Nicola I’ve updated the nodes in the master/nightly branch to work with private channels.

Information on the API call including permissions required can be seen here: conversations.list method | Slack

The nodes are currently building but will hopefully be available shortly. Let me know if you have any issues or are missing anything else you need.

Edit: need to fix the test that broke because there’s now more channels before it will be available in the update site.

Edit 2: The nodes are now available from http://update.knime.com/community-contributions/trunk and you need version 2.0.0 (or greater).

Cheers

Sam

3 Likes

Thanks so much @swebb,
They work great, and are very helpful; I can now alert myself in Slack when my workflows finish running!
Regards,
–George

3 Likes

Awesome! Nice work @swebb.

Hi @swebb ,

would it be possible to have step by step guide how to configure your slack for the version 2.0 to work? I had the version 1.0 sending messages for public channels but I need Knime to send messages for private and I had high hopes that it would work with the version 2.0 but after installing it and trying to configure slack I only get this error in Knime: “ERROR Message Slack channel 0:2 Execute failed: Provided channel name of knime_test is not valid”. knime_test channel is public channel and after installing the version 2.0 I cannot send messages to either public nor private channels. Would be really nice to get this working.

Thank you.

Odd, I don’t recall any tests failing so the recent change to enable private shouldn’t have prevented any old workflows from working.

My first guess would be the permissions that were needed before aren’t the same as now and I happened to have both set. However, when you get a permissions based issue the error message is supposed to report this.

I’ll knock something together on my lunch break and hopefully we can get your workflows working again.

Cheers

Sam

@atolvanen

I’ve created a quick guide here:

Some corrections to my previous comments:

  • The nodes now predominantly expect the OAuth token not the Bot OAuth token - this may be why your workflows stopped working to public channels
  • It would appear if permissions are ok but the token doesn’t have permissions for a channel you will get a channel name not valid error

I think you should find you can get this working if you make sure the scopes are set on your app and than you use the OAuth token instead of the Bot OAuth token.

Please let me know how you get on.

Cheers

Sam

2 Likes

Yes, I was using the bot oAuth but even with oAuth I’m getting this same error. How ever now I think I found the cause, but I do not know why this behavior. If I use the Get Channels or Channel Names node it will only return 57/150+ public channels and this public channel and private channel I have added to the bot user are not in the list.

I also recreated the whole app to make sure everything should be right. As a note, from the setup you are missing the step for adding the bot user which is required for bot scope. Here is the list of scopes I have added for the bot user: bot, channels:history, groups:history, im:history, mpim:history, channels:read, groups:read, im:read, mpim:read, users:read, users:read.email, channels:write, chat:write:user, chat:write:bot, groups:write, im:write, mpim:write, users:write

Sorry there are steps missing.

Are you still unable to post to a public channel or is it just private ones now?

If just private have you invited the Knime app into the channel?

Cheers

Sam

Sorry if I was unclear, same problem with both public and private channel. I think this is somehow related to issue with Get Channels as it does not list those channels I try to use even though it should have permission to them, I have not tried to message on channels it will list successfully as I don’t want to spam on channels other people use.

Hi @atolvanen

I’ve done a bit more digging and just set up a new workspace and configured as follows:

Create the Slack App

  • Navigate to https://api.slack.com/apps

  • Fill in the modal
    image

  • Select OAuth & Permissions on the left

  • Navigate to Scopes and ‘Add an OAuth Scope’

  • Navigate to Bot Users

    • Create a bot
      image
  • Navigate to Install App

  • Click Install App to Workspace

When posting to private channels. If you use the OAuth token the bot user doesn’t need to be invited to the channel. If you use the bot OAuth token the bot must have been vinted.

image

Can you please check if chat:wite:bot scope is set? When posting to a private channel you can do this with the OAuth or if you use the bot OAuth you need to invite the app to the channel first.

If this still doesn’t work I’ll give you a token to try and see if it can post to my workspace. That should let us know if the problems with workspace config or the nodes.

Cheers

Sam

1 Like

I ran some more tests, with the 1.0.1 version I can message to public channel with same same oAuth token that does not work with 2.0.0 version. Also with the 1.0.1 I can list all public channels with Get Channels node, 2.0.0 version Get Channels node only returns 57/291 public channels we have. So it seems like this 2.0.0 version has some limitations somehow on what it can access.

Thanks for the update. I will have to do some testing to find out why you can’t list all the channels.

In terms of posting to the channels though I think this is most likely to be a permissions problem. Version 1 and version 2 use different slack API calls to post and I think they require different permissions.

Let’s see if you can post to my workspace. There tokens are temporarily:

OAuth: ------

Bot OAuth: ------

The private channel is called private-test and the general and random channels are public.

Cheers

Sam

Something like this which should work with both tokens:

image

Both of those channels works with your tokens. I also tested this now with one of the public channels that gets listed with version 2.0.0 and messaging to those channels seems to work as well. So this issue is related to what you can see with the token. But why would it limit the visibility for some of the public channels?

Hrm, we’ve definitely ventured outside of my slack knowledge now.

The package I depend on for the slack interaction is jslack (https://github.com/seratch/jslack). The author of this package says to select all permissions except for the identity based ones. It may be worth trying that and seeing if it works? I’m not sure why the subset posted above works for me and not you though.

If this does work I’d probably still recommend trying to work which permissions can be removed as having a token with permissions you don’t need doesn’t seem like a good idea.

I’ll have a look over the slack docs and see if I can find anything that might be causing your problem. I don’t currently know how to recreate it with my workspace.

Cheers

Sam