Slack threads and chat integration plugin transcripts

I’ve added basic support for threads to my other pending PR (changes the same bits of code):

https://github.com/discourse/discourse-chat-integration/pull/20/commits/0ed634387479947da6bedf402aab95594a21c5da

Either syntax can be used:

/discourse post thread https://<slackname>.slack.com/archives/C6029G78F/p1522952993000017

or

/discourse post https://foo.slack.com/archives/G49KKS6AX/p1523062012000911?thread_ts=1523091738.000088&cid=G49KKS6AC

In both cases the “first/last message” UI is skipped - the entire thread is included in the transcript.

4 Likes

I think one option we would be open to is a pr that allows you to set which TL has particular blocked words, cause blocking thread from tl0 and 1 is pretty much our intent here, plus we want to make the feature better, and there are tons of missing refinements here that are missing, like teaching people why a word is blocked (optionally) vs just saying sorry, not allowed

4 Likes

3 Likes

Anything holding back this PR in particular? Or is it just the normal other things have been higher priority situation?

Eager to try it out!

1 Like

Sorry for the huge delay here. We stopped using Slack internally so testing changes like this is hard. PR is merged.

4 Likes

Hey @david - Just got a chance to try out the new feature to post threads… looks like it’s not quite working or us.

I tried each syntax or a couple different threads, but just get this in response:

Loading the transcript…

Using the normal command continues to work as it did before, though.


Also, when I tried posting a transcript from a private channel, I got this:

Darn - that slash command didn’t work (error message: 422_client_error). Manage the command at Discourse

I looked at the diff from the PR and thought perhaps it’d be necessary to add the conversations:history scope to the app on Slack, but I didn’t see that as an option. I tried adding the groups:history scope instead, but that did not seem to work.

Let me know if there’s anything else you’d like me to try for either of these issues. Thanks!

For ‘Private Channels’ you need to add the groups:history scope. For “Direct Messages” you need to add the im:history scope. You will need to ‘reinstall’ the app for changes to scopes to take effect (Slack’s UI should have prompted you to do this).

Are you seeing anything at /logs when the errors occur?

2 Likes

I tried adding these scopes, and reinstalling:

groups:history
im:history
mpim:history

Still getting that 422, but don’t see anything obvious in the Discourse logs in the admin panel (this is a hosted instance, so I don’t have direct access to other logs).

1 Like

I used the /discourse post command from a public channel to great effect… but threads are now more common in many channels than main channel conversations, so still hopeful that some day this will work in a thread…

Update: w00t! just tried it again and it worked!

/discourse post https://ourdomain.slack.com/archives/C0591LA4X/p1529529151000359?thread_ts=1529528304.000177&cid=C0592LA4X

as did:

/discourse post thread https://ourdomain.slack.com/archives/C0592LA4X/p1529528304000177

Another update: I was also able to post a thread from a private channel. :tada:

9 Likes

I got an error when using post transcript in a public channel:

{
	"message": "Job exception: undefined method `[]' for nil:NilClass\n",
	"progname": null,
	"severity": 3,
	"backtrace": "/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_message.rb:38:in `block in text'\n/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_message.rb:30:in `gsub'\n/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_message.rb:30:in `text'\n/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_message.rb:62:in `processed_text_with_attachments'\n/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_transcript.rb:155:in `block in build_slack_ui'\n/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_transcript.rb:155:in `map'\n/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_transcript.rb:155:in `build_slack_ui'\n/var/www/discourse/plugins/discourse-chat-integration/lib/discourse_chat/provider/slack/slack_command_controller.rb:95:in `block in process_post_request'\n/var/www/discourse/lib/scheduler/defer.rb:70:in `block in do_work'\n/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rails_multisite-2.0.4/lib/rails_multisite/connection_management.rb:63:in `with_connection'\n/var/www/discourse/lib/scheduler/defer.rb:68:in `do_work'\n/var/www/discourse/lib/scheduler/defer.rb:59:in `block (2 levels) in start_thread'",
	"count": 9,
	"env": {
		"message": "Running deferred code 'Processing slack transcript request'"
	},
	"protected": false
}
1 Like

Hello, did you managed to fix this? I have the same one.

To close the loop here - @mbugowski kindly contributed a pull request to fix the issue:

https://github.com/discourse/discourse-chat-integration/commit/1a08d647857b356bdd39810bde76bc90de978337

@tony612 if you update to the latest version it should now work.

5 Likes

Slash commands now work in Slack Threads! See :point_down:t3:

Any chance we could see support for a slash command within a thread that posts a transcript? :crossed_fingers:t3:

6 Likes

I really want this to be true because it would make my life so much easier, but I don’t see anything about it in the Slack API documentation. I wonder if they gave giphy special alpha-testing access? Do you see documentation that I don’t?

More information, possibly: Today at work, one person in a thread complained about slack not allowing /giphy in threads and posted an image of slack telling them that it wasn’t supported in threads, and another person used /giphy successfully, in the same thread. Seems like there might be some A/B testing going on here.

1 Like

Good news! I just merged a change to the plugin which adds support for Slack’s “Shortcuts” API. Now you can hit the on a thread, click “Post to Discourse”, and you’ll be given a button which takes you straight to Discourse. No more fussing with slash commands or thread permalinks!

https://github.com/discourse/discourse-chat-integration/commit/610364ff6d9adbd642c9d201415bbd6da795a036

To get this working, you’ll need the latest version of the chat-integration, and you’ll need to modify your Slack app using this new step of the setup

As always, let us know if you have any feedback :slight_smile:

cc @mcwumbly @galligan @mcdanlj

9 Likes

:star_struck::star_struck::star_struck:

Incredible!

I tried to add this functionality just now and unfortunately got an

Error: unable to fetch channel history from Slack

I tried this on our newest Slack message.

Have you followed all the setup instructions in this topic. In particular, have you given the bot all the necessary scopes?

I found the problem! Our Chat Integration App wasn’t in the channel I was trying to post from. After inviting the app to the channel, I was able to post a transcript. Thank you.

  • Is it possible to automatically add the Chat Integration App in every Slack channel automatically, now and in the case of any new channel created in the future?

  • Changing the “Continue on Discourse” button text to something more like “Create Transcript” or the Name of the shortcut (default “Post to Discourse” but changeable) would make sense from a UX perspective, given that not all Discourse sites call themselves Discourse

2 Likes

Unfortunately I don’t think so, but I’d love to be wrong on that. I will look into whether we can improve the error message here so it gives you instructions on how to add the bot to the channel.

:+1: good point. We can certainly update the default to remove the word ‘Discourse’. But in the meantime, you should be able to search for “Continue on Discourse” in the admin panel and change it to whatever you like: Customize all text in Discourse

Edit: default button text is now Continue on Forum

4 Likes

I followed all steps described in the Slack thread. I added all scopes described there (even added extra ones) and I invited the app to the relevant channels.

The problem is that for 1% of cases it seems to work, see here:

But 99% in public channels I’m getting the error: “Error: unable to fetch users from Slack”
image

And in DMs: “Error: unable to fetch channel history from Slack”

1 Like