Slack integration problem

Hi

I’m getting problems when I’m trying to interact with the Slack Bot.
I created a bot on the Slack Panel and I copy the token to Slack’ configuration in Metabase.
I can talk with Metabot but when I request a card an error appears in the log.

I don’t know what hapend. Does the bot need more permissions?

My Metabase version is v0.19.3

Thank you very much.

Ugh. Note sure … let me try to reproduce this.

seems to work with a token I just created.

do pulses work? can you give me any more info about any settings you used to create the bot token/user?

Hi
Pulses does not work either when I click over “Send to Slack now”.

These are the steps I follow to configure the bot.

  • I go to https://{organization}.slack.com/apps/manage/custom-integrations
  • Click bots link
  • Add configuration
  • Set a name for the bot and click “Add bot integration”.
  • Configure images and name, copy the token and save the integration.
  • I paste the token in Metabase/AdminPanel/SlackCredentials and I save the configuration. Then the bots gets a green light in Slack.

Talking with the bot I get the user bot error:

Console Output:
10-01 08:43:48 WARN integrations.slack :: {:message "Slack API error: user_is_bot", :response {:ok false, :error "user_is_bot"}} 10-01 08:43:48 ERROR metabase.metabot :: ["integrations.slack$handle_response.invokeStatic(slack.clj:29)" "integrations.slack$handle_response.invoke(slack.clj:21)" "integrations.slack$do_slack_request.invokeStatic(slack.clj:33)" "integrations.slack$do_slack_request.doInvoke(slack.clj:31)" "integrations.slack$create_files_channel_BANG_.invokeStatic(slack.clj:59)" "integrations.slack$create_files_channel_BANG_.invoke(slack.clj:56)" "integrations.slack$get_or_create_files_channel_BANG_.invokeStatic(slack.clj:78)" "integrations.slack$get_or_create_files_channel_BANG_.invoke(slack.clj:74)" "pulse$create_and_upload_slack_attachments_BANG_.invokeStatic(pulse.clj:47)" "pulse$create_and_upload_slack_attachments_BANG_.invoke(pulse.clj:44)" "metabot$show$fn__30066.invoke(metabot.clj:100)"]

If I create a new pulse and when I click in “Send to Slack now” button I get the following error:
10-01 09:02:28 WARN integrations.slack :: {:message "Slack API error: user_is_bot", :response {:ok false, :error "user_is_bot"}} 10-01 09:02:28 ERROR metabase.middleware :: POST /api/pulse/test 500 (1 s) (0 DB calls) {:message "Slack API error: user_is_bot", :response {:ok false, :error "user_is_bot"}, :stacktrace ["integrations.slack$handle_response.invokeStatic(slack.clj:29)" "integrations.slack$handle_response.invoke(slack.clj:21)" "integrations.slack$do_slack_request.invokeStatic(slack.clj:33)" "integrations.slack$do_slack_request.doInvoke(slack.clj:31)" "integrations.slack$create_files_channel_BANG_.invokeStatic(slack.clj:59)" "integrations.slack$create_files_channel_BANG_.invoke(slack.clj:56)" "integrations.slack$get_or_create_files_channel_BANG_.invokeStatic(slack.clj:78)" "integrations.slack$get_or_create_files_channel_BANG_.invoke(slack.clj:74)" "pulse$create_and_upload_slack_attachments_BANG_.invokeStatic(pulse.clj:47)" "pulse$create_and_upload_slack_attachments_BANG_.invoke(pulse.clj:44)" "pulse$send_slack_pulse_BANG_.invokeStatic(pulse.clj:61)" "pulse$send_slack_pulse_BANG_.invoke(pulse.clj:56)" "pulse$send_pulse_BANG_.invokeStatic(pulse.clj:83)" "pulse$send_pulse_BANG_.doInvoke(pulse.clj:66)" "api.pulse$fn__24271$fn__24274.invoke(pulse.clj:125)" "api.common.internal$wrap_catch_api_exceptions.invokeStatic(internal.clj:220)" "api.common.internal$wrap_catch_api_exceptions.invoke(internal.clj:217)" "api.pulse$fn__24271.invokeStatic(pulse.clj:119)" "api.pulse$fn__24271.invoke(pulse.clj:119)" "middleware$enforce_authentication$fn__24945.invoke(middleware.clj:79)" "api.routes$fn__25061.invokeStatic(routes.clj:51)" "api.routes$fn__25061.invoke(routes.clj:51)" "routes$fn__30135.invokeStatic(routes.clj:24)" "routes$fn__30135.invoke(routes.clj:24)" "middleware$log_api_call$fn__25030$fn__25031.invoke(middleware.clj:264)" "db$do_with_call_counting.invokeStatic(db.clj:337)" "db$do_with_call_counting.invoke(db.clj:331)" "middleware$log_api_call$fn__25030.invoke(middleware.clj:263)" "middleware$add_security_headers$fn__24990.invoke(middleware.clj:200)" "middleware$bind_current_user$fn__24949.invoke(middleware.clj:94)" "middleware$wrap_current_user_id$fn__24936.invoke(middleware.clj:62)" "middleware$wrap_api_key$fn__24956.invoke(middleware.clj:105)" "middleware$wrap_session_id$fn__24929.invoke(middleware.clj:53)"]}

I am facing the same problem on V0.20

The root cause of this was the lack of the presence of #metabase_files channel.

See: https://github.com/metabase/metabase/blob/master/src/metabase/integrations/slack.clj#L75

This is not documented nor mentioned on /admin/settings/slack during setup.

The bot user is not authorised to call the channel.create endpoint as per https://api.slack.com/methods/channels.create

2 Likes

Ugh. That’s a good catch. We’re working around the inability of the slack api to accept an image with a posting to a channel and had to do that. This leaves us in a bit of a bind. We’ll add documentation to that affect and then try to find a different way to post.