Issue Setting Up Slack Integration

Afer pasting my OAuth Token and creating the slack channel, clicking 'save changes' does not take. After a few seconds, the fields blank out.

{
"browser-info": {
"language": "en-US",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:103.0) Gecko/20100101 Firefox/103.0",
"vendor": ""
},
"system-info": {
"file.encoding": "Cp1252",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.11+9",
"java.vendor": "AdoptOpenJDK",
"java.vendor.url": "https://adoptopenjdk.net/",
"java.version": "11.0.11",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.11+9",
"os.name": "Windows Server 2016",
"os.version": "10.0",
"user.language": "en",
"user.timezone": "America/Los_Angeles"
},
"metabase-info": {
"databases": [
"sqlserver",
"postgres",
"h2",
"db2"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "13.2"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.3.5"
}
},
"run-mode": "prod",
"version": {
"date": "2022-08-04",
"tag": "v0.44.0",
"branch": "release-x.44.x",
"hash": "d3700f5"
},
"settings": {
"report-timezone": "America/Los_Angeles"
}
}
}

Hi @brian
I'm guessing that you're using multiple instances behind load-balancer or have a reverse-proxy that is sending cached results.
Try looking in the log to see what is happening, when you submit. Admin > Troubleshooting > Logs.

Hi @flamber
Actually I am running a single instance. In logs, the only messages related to Slack:

BUG metabase.server.middleware.log
DEBUG metabase.server.middleware.log PUT /api/slack/settings 400 10.0 s (0 DB calls)
{:url "https://slack.com/api/conversations.list",

:request

{:headers {:authorization "Bearer\nxoxb-redacted"},

:as :stream,

:conn-timeout 10000,

:socket-timeout 10000,

:query-params {:limit 1}}}

@brian You got a firewall blocking. Make sure that the Metabase process can access the Slack URL.
Not sure why you're not seeing an error message.

Thanks @flamber, it was indeed a firewall / DNS issue. That is resolved and I have successfully enabled integration however, the metabase_files channel does not appear in the channel list. Is there a delay due to propagation?

Bot added to channel:

@brian I think you've skipped a step, so it didn't complete adding the app the system channel (metabase_files), which should be public and not used by humans. In other works, you should not post to that channel.
Delete the Slack setup in Metabase and do it again. Check the logs for progress.
https://www.metabase.com/docs/latest/administration-guide/09-setting-up-slack.html

@flamber - I don't believe I am missing any steps. Upon saving, a 400 error is observed in the Network logs. Subsequently, the app is unable to find the new channel name. Navigating away from the Slack page and back shows the channel setup to the default "metabase_files".

Logs:

XHRPUThttp:///api/slack/settings
[HTTP/1.1 400 Bad Request 16220ms]

PUT
http://api/slack/settings
Status
400
Bad Request
VersionHTTP/1.1
Transferred1.23 KB (54 B size)
Referrer Policystrict-origin-when-cross-origin
Request PriorityHighest

Form submission error:
Object { status: 400, data: {…}, isCancelled: false }
Form.jsx:216:14
e Form.jsx:216
u runtime.js:63
_invoke runtime.js:293
x runtime.js:118
ct StandardForm.tsx:32
l StandardForm.tsx:32
(Async: promise callback)
ct StandardForm.tsx:32
a StandardForm.tsx:32
st StandardForm.tsx:32
st StandardForm.tsx:32
a Form.jsx:64
Redux 3
e Form.jsx:44
u runtime.js:63
_invoke runtime.js:293
x runtime.js:118
ct StandardForm.tsx:32
a StandardForm.tsx:32
st StandardForm.tsx:32
st StandardForm.tsx:32
C ActionButton.jsx:67
React 12
unstable_runWithPriority scheduler.production.min.js:19
React 3
Object { status: 400, data: {…}, isCancelled: false }
ActionButton.jsx:80:18
C ActionButton.jsx:80
(Async: promise callback)
C ActionButton.jsx:68
React 12
unstable_runWithPriority scheduler.production.min.js:19
React 3

XHRPUTht000/api/slack/settings
[HTTP/1.1 400 Bad Request 16220ms]

PUT
http://api/slack/settings
Status
400
Bad Request
VersionHTTP/1.1
Transferred1.23 KB (54 B size)
Referrer Policystrict-origin-when-cross-origin
Request PriorityHighest

Cache-Control
	max-age=0, no-cache, must-revalidate, proxy-revalidate
Content-Length
	54
Content-Security-Policy
	default-src 'none'; script-src 'self' 'unsafe-eval' https://maps.google.com https://accounts.google.com 'sha256-K2AkR/jTLsGV8PyzWha7/ey1iaD9c5jWRYwa++ZlMZc=' 'sha256-ib2/2v5zC6gGM6Ety7iYgBUvpy/caRX9xV/pzzV7hf0=' 'sha256-isH538cVBUY8IMlGYGbWtBwr+cGqkc4mN6nLcA7lUjE='; child-src 'self' https://accounts.google.com; style-src 'self' 'unsafe-inline' https://accounts.google.com; font-src *; img-src * 'self' data:; connect-src 'self' https://accounts.google.com metabase.us10.list-manage.com ; manifest-src 'self'; frame-ancestors 'none';
Content-Type
	application/json;charset=utf-8
Date
	Sun, 07 Aug 2022 18:41:14 GMT
Expires
	Tue, 03 Jul 2001 06:00:00 GMT
Last-Modified
	Sun, 7 Aug 2022 11:41:30 -0700
Server
	Jetty(9.4.48.v20220622)
Set-Cookie
	metabase.TIMEOUT=alive;SameSite=Lax;Path=/
Set-Cookie
	metabase.SESSION=bcb5eae5-eeee-4b44-97b0-6e5009c9589f;SameSite=Lax;Path=/;HttpOnly
Strict-Transport-Security
	max-age=31536000
X-Content-Type-Options
	nosniff
X-Frame-Options
	DENY
X-Permitted-Cross-Domain-Policies
	none
X-XSS-Protection
	1; mode=block
	
Accept
	application/json
Accept-Encoding
	gzip, deflate
Accept-Language
	en-US,en;q=0.5
Connection
	keep-alive
Content-Length
	112
Content-Type
	application/json
Cookie
	metabase.DEVICE=f5bd0dc2-ae6e-47bb-bd04-4e1e99148fe9; metabase.TIMEOUT=alive; metabase.SESSION=bcb5eae5-eeee-4b44-97b0-6e5009c9589f
Host
	
Origin
	http://a

@brian How many channels do you have? From the time it takes to run the query, I'm guess more than 10k, which is currently the hardcoded limit:
https://github.com/metabase/metabase/blob/master/src/metabase/integrations/slack.clj#L142-L145

@flamber Ah, I'd guess it is more than that. Workaround?

perhaps mitigation, ignoring archived channels?

@brian Not besides creating a custom build. It would be great if Slack allowed some type of way of asking the channel in a different way. We have to use this way, since there's not other API endpoints available.
Anyway, manually add the App to the system files channel:
https://github.com/metabase/metabase/issues/23229#issuecomment-1151210508

@flamber appreciate all the timely replies. I have seen all of these postings i searching for a solution and have been manually adding the bot to various channels in that way in trying to set up. Are you saying I should use the "metabase_files" channel, or any channel of my choosing?

@brian Perhaps this describes better what the metabase_files channel is used for:
https://github.com/metabase/metabase/issues/20936

But you're the first one with so many channels, so I don't know if you're hitting other issues.

Still clear as mud :slight_smile: I still haven't been able to get a response from the bot yet...I'll keep trying.

@flamber Progress made. I was able to successfully set up integration leveraging one of the channels that I'm guessing is in the first 10k. Metabase now shows the app / bot setup with this customized channel name (not metabase_files). I am able to send pulses to this channel. New question, are we still supposed to be able to interact with the MetaBot with commands that worked in the past, such as metabot help, metabot list, metabot show? If so, that is not working yet.

@brian MetaBot has been completely removed, when the Slack API integration had to be hastily upgraded in January after they deprecated our old integration with just a few days notice.

Ahhh bummer

@flamber Why not increase the 10k hardcoded limit or at least call the API in a way that ignores archived channels / users?

@brian The API ignores archived and only asks for channels:
https://github.com/metabase/metabase/blob/f25b61154b5cf90a91d895ecbf459775827cee5e/src/metabase/integrations/slack.clj#L179

Anyways: https://github.com/metabase/metabase/issues/24673 - upvote by clicking :+1: on the first post

@flamber Upvoted! Thanks