Slack nodes for KNIME

No, but you get different functionality depending on whether using the bit token or the oauth token.

I think the node descriptions should say which scope is needed and if you haven’t got it set the error message should report what scope was required.

However, as they’ve changed the permissions/scopes this is likely no longer correct. I will try to provide further details of which node needs which new scope soon.

Thank you.

Is it necessary to add both Bot Token and User Token scopes?

Oh I see what you mean now, I am about to set up a new bot and see if that is sufficient.

I suspect that only 1 is required.

Ok here is what I did to set up a new set of permissions:

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

  2. Select Create New App

  3. Select OAuth and Permissions

  4. Under the bot section add:

  5. Install or reinstall depending on whether this is the first configure

Use the bot token in the KNIME nodes:

image

This seems to work, I didn’t need to add any user scopes.

If your intention is to have a generic ‘knime’ user post to a user or channel then I think the bot permissions are sufficient. It appears the user scopes are to allow KNIME to post on behalf of a specific user and this sin’t something I’ve tried myself.

To post into a private channel the bot must have been invited.

Cheers

Sam

If your intention is to have a generic ‘knime’ user post to a user or channel then I think the bot permissions are sufficient. It appears the user scopes are to allow KNIME to post on behalf of a specific user and this sin’t something I’ve tried myself.

It would appear this is incorrect. Bots are not able to read public and private channel history and this must be done with a user token.

To use the shortly to be released version 2 of the Channel History node the following user scopes must be set up:

If you do not wish to use this node you do not need to set up user scopes.

Cheers

Sam

@raghum were you able to get this working?

Not yet Sam.

It is showing slack-base application is allowed in the traffic. I am not sure what other applications to allow as part of this. Any idea?

One more thing is, the V2.x file is not able to access. Could you provide the latest link if it is moved to different location?
http://update.knime.com/community-contributions/trunk/CommunityContributions_trunk_202003270647.zip

Sorry you are still having trouble.

I’m not sure what else to allow through the proxy I’m afraid.

I belive the zips of the update sites are date stamped so the latest looks to http://update.knime.com/community-contributions/trunk/CommunityContributions_trunk_202004070602.zip with the live version being http://update.knime.com/community-contributions/trunk

I have added above mentioned scopes but I am still getting Missing scope error.

2020-04-07 14:01:46,655 : ERROR : KNIME-Worker-29-Message Slack channel 0:5 : : Node : Message Slack channel : 0:5 : Execute failed: API call failed: missing_scope
java.lang.Exception: API call failed: missing_scope
at com.sjwebb.knime.slack.api.SlackBotApi.getChannelNamesViaConversations(SlackBotApi.java:134)
at com.sjwebb.knime.slack.api.SlackBotApi.channelExists(SlackBotApi.java:342)
at com.sjwebb.knime.slack.nodes.messages.send.SendMessageNodeModel.execute(SendMessageNodeModel.java:48)
at org.knime.core.node.NodeModel.execute(NodeModel.java:740)
at org.knime.core.node.NodeModel.executeModel(NodeModel.java:574)
at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1229)
at org.knime.core.node.Node.execute(Node.java:1016)
at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:557)
at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:218)
at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:124)
at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:334)
at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:210)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)

I am also getting Invalid auth error when I use Slack User node.

ERROR Message Slack User (beta) 0:9 Execute failed: Failed to post message: invalid_auth

Ok lets try identify if the issues with the nodes or with the workspace config. I’ve set up a new slack workspace: https://knimeslacknodes.slack.com/

Invite link:

https://join.slack.com/t/knimeslacknodes/shared_invite/zt-ddd75qtf-7yG13v3Ny3XVsbLWwqvvng

I’ve set up the permissions as described in the most recent posts with intrusctions.

The bot token is: xoxb-1056175597284-1050207073526-eU6gUb8scQ0NSPxp9XwimW3X
The user token is: xoxp-1056175597284-1056175597428-1050207068598-ca146920f53c9c2f41d358f7144f5953

Can you try using my tokens? Follow the invite link if you want to check the messages went through.

EDIT: It would appear I can’t get history of private channels or send messages to users with this config. So my previous instructions must not have been correct.

Cheers

Sam

I spotted a couple of issues

  1. The build didn’t work properly so not all of the fixes made it through. It’s re-running now - when the nightly zip as been updated you can find the link here: https://www.knime.com/community

The fixes should be available in the nightly live site shortly.

  1. I was missing a scope from the bot token It needs im:write to message a user

Cheers

Sam

This workflow uses the above tokens. If you download and execute this workflow it should work (if using the nodes that built this morning) - if so the issue is with your workspace app setup.

Either way knowing if this workflow runs for you should help us continue diagnosing.

Cheers

Sam

1 Like

Thanks for the inputs, Swebb. I am getting following errors by using provided tokens. Look like something wrong with my workspace.

ERROR Message Slack User (beta) 0:9 Execute failed: Failed to post message: user_not_found
ERROR Message Slack channel 0:5 Execute failed: Provided channel name of rmylavaram is not valid

I have recreated the workspace and I am getting user not found error using Slack user node and missing scope error using Slack channel node.

I have added below mentioned scopes.

2020-04-08 09:21:44,020 : ERROR : KNIME-Worker-42-Message Slack User (beta) 0:9 : : Node : Message Slack User (beta) : 0:9 : Execute failed: Failed to post message: user_not_found
java.io.IOException: Failed to post message: user_not_found
at com.sjwebb.knime.slack.api.SlackBotApi.directMessage(SlackBotApi.java:362)
at com.sjwebb.knime.slack.nodes.user.messages.send.MessageSlackUserNodeModel.execute(MessageSlackUserNodeModel.java:46)
at org.knime.core.node.NodeModel.execute(NodeModel.java:740)
at org.knime.core.node.NodeModel.executeModel(NodeModel.java:574)
at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1229)
at org.knime.core.node.Node.execute(Node.java:1016)
at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:557)
at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:218)
at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:124)
at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:334)
at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:210)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)

Can I just check that you downloaded my workflow, reset the nodes and tried to execute them? Did this work but you still have issued when interacting with your own Slack workspace with your own tokens?

If not can we do the following test:

  • Download my workflow
  • Reset the nodes
  • Execute the nodes

We hopefully won’t get an error message here as I have successfully executed this workflow on the latest build of the nodes.

When trying to message a user in your Slack workspace can I also check you are using the user ID and not the username. If I message the user @swebb I need to enter that users ID. You can find this using the Get User node.

image

So for user swebb this would be U011N55HKCL.

Please see this section of the Message Slack User node description for more details:

Unfortunately the display name in Slack is not unique. So the @{username} value you may use is not directly usable within this node as the username. Instead you must find the user’s ID (e.g. looking it up int he Get Users node) and provide this.

Do any of the nodes work? Such as Get Users, Channel names, Channel History?

Cheers

Sam

Well, I see results with your workflow but I see missing scope error when I have my token.

Following are the scopes that added to the workspace.

https://forum.knime.com/uploads/default/original/2X/3/31474faec23cd9fdea7d7f242fddf06259f8d3a4.png

Those are the scopes I have set for my bot token. Can you try setting the ones I’ve got set that you don’t?

I should be able to see and send messages to private channels with latest version right?

Should we use Channel ID/Name to send message for channels?

I am using User ID to send message after adding these scopes but I am still getting missing_scope error. Howerever, I am able to get list of Users using Get Users node and Get Channels (but not private channels).

How to get private channels? Following are the scopes that I have in my workspace.

Have you invited the Knime bot/app into the channels you want to send messages to?

Channel names are unique so you should be able to use the channel name and don’t need the ID.

Are you using the bot or user token to try to send messages? If you are using the bot token it looks like you should no longer get a missing_scope error.