`/discourse post` command hangs on "Loading the transcript..."

Discourse post command only works in one channel

Now, this is likely my fault, but I can’t figure it out, I’ve been through all the threads on the topic, and I’d love some help. I’ve checked and doubled checked the permissions of my Slack app and I can confirm that it totally 100% works… in only one of my channels!

/discourse post 20

So I know the access token is set up and working fine. However, in all of the other channels in my Slack team, the command above simply outputs

Loading the transcript...

and that’s all. These are all public channels and I’ve tried every manner of combination of settings. The one channel that works was created newly today, but when I created another new channel to test, it didn’t work. I don’t even know where to begin troubleshooting this. The only logs I’m aware of in Discourse are

./launcher logs app

but there doesn’t seem to be anything at all there. What setting may I have overlooked that would only allow posting to work in one channel, and where would I look to debug this?

This topic broken out from

1 Like

Check to see if you can publish from Discourse to the channels that you are trying to post to Discourse from. My guess is that the issue is that you need to add the app you’ve created to the channel before you can post to or from it.

2 Likes

@simon I think that may have been it! I’ll be honest, I’m a little confused by how the Slack app works. Since I was able to run /discourse ... commands in any Slack channel and the “App” seemed to be installed at a global level, it seemed I had “added” the app in every way necessary. However, when I explicitly /invite my discourse app user into another channel, it starts working!

/invite @Discourse 
/discourse post 20

What’s very annoying about this is that Slack doesn’t even show me that my @discourse user is in my channel after I add it. The number of users in the Slack UI does not change, and if I view all the members of the channel, my app user is not listed there. I suppose this is a deficiency of Slack itself, not Discourse.

It would be nice to not need to invite the discourse user into every Slack channel in my team (goodness knows, we have a ton of channels) but I assume this must be a Slack limitation for apps? Also, is there an enhancement we can add to the Discourse chat plugin to detect this issue and display a more useful error message?

3 Likes

The first time I tried setting this up, I was surprised to have to add the Discourse app to every channel. I’ll keep a look out for any way of working around this requirement.

Possibly an error message is returned from Slack to Discourse when an action fails due to the app not having permissions to post to/from the channel. If that’s the case, using the error to add a notice to the Channel’s entry on Discourse would be helpful for debugging this type of issue. I’m not sure if this will be possible, but I’ll have a look to see if Slack returns any useful information to Discourse for this case.

3 Likes

This seems to be correct. I’ve only tested it with Slack. When Discourse attempts to post to a Slack channel that the app hasn’t been added to, a warning is displayed on the Chat Integrations page and an error message is displayed above the channel that has the issue:

Clicking the error icon for a channel that the app hasn’t been added to reveals the issue:

{
  "error_key": null,
  "request": "",
  "response_code": "200",
  "response_body": "{\"ok\":false,\"error\":\"not_in_channel\"}"
}

Possibly Discourse could be parsing that error message to give the user details about what needs to be done to fix the issue.

When I attempt to post to Discourse with a slash command from a channel that the app hasn’t been added to, a Job exception: break from proc-closure error is thrown on Discourse from slack_command_controller.rb:86. I’m not sure if there is enough information returned from Slack to create a meaningful error message for this case.

2 Likes

We could also be responding to that error with attempting to join the channel, by requesting channels.join permission.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.