# Gitter: Post notifications to chat, post transcripts to forum

**URL:** https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247
**Category:** Feature
**Created:** [2016 年 10 月 7 日午後 7:41 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247 "2016-10-07T19:41:48Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [2016 年 10 月 7 日午後 7:41 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/1 "2016-10-07T19:41:48Z")

</div>

### Alternative service to:

[https://github.com/discourse/discourse-slack-official](https://github.com/discourse/discourse-slack-official)

and

> [@Slack: Post chat snapshot to Discourse](https://meta.discourse.org/t/slack-post-chat-snapshot-to-discourse/51085/):
>
> Continuation of [GitHub - discourse/discourse-slack-official: DEPRECATED: Official Slack integration for Discourse · GitHub](https://github.com/discourse/discourse-slack-official)Summary Take a snapshot of a discussion in Slack and post it as a topic in Discourse. The output should be a cleanly formatted chat transcript. The average snapshot would be between 5-100 messages long. Also see [“Wisemonk - a Slack bot to move discussions from Slack to Discourse”](https://medium.dgraph.io/wisemonk-a-slackbot-to-move-discussions-from-slack-to-discourse-22a53ddce78f). Use Discourse as your “long term memory” for Slack conversations worth remembering. Core fun…

---

<div class="post-metadata">

### Author: ![jafeth.diazc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jafeth.diazc/32/101197_2.png) [@jafeth.diazc](https://meta.discourse.org/u/jafeth.diazc)
#### Post date: [2017 年 3 月 7 日午前 6:58 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/2 "2017-03-07T06:58:38Z")

</div>

Hi!

I’ve been working on my GSoC proposal for this project and I wanted to share some notes about my progress. I’d really appreciate some feedback.

## Post notifications to a room in Gitter

I’ve come to two ways to notify posts and topics creation in a Gitter room:

**To the activity feed**

This could be considered the “natural” way to do it since it’s here where all the other integrations’ activities are. To accomplish this, it’s necessary to post the data to a webhook URL, which Gitter provides per each integration in a given room (unlike Slack where an only webhook is enough to post to different channels). In this case, the user should enter the webhook URLs of the rooms he wants Discourse to post notifications to in the admin interface.

An advantage of this approach is that the [Gitter services library](https://github.com/gitterHQ/services) permits the developers to send a pull request to integrate some code to process the incoming data (to give a nicer format or add a custom icon for example) before it’s displayed in the activity feed.

In my opinion, separating messages and external services events is cleaner. Also, as mentioned in the [gitterHQ/services](https://gitter.im/gitterHQ/services) room, the integrations events used to go to the messages pane, but given that many users complained claiming that their rooms got too noisy, they changed to the current activity feed.

**To the messages pane**

For this purpose, as the only webhooks Gitter support allow to post to the activity feed, a bot user would be necessary to send messages to the room. Gitter doesn’t support custom bot users, so the user would have to create a user and provide the API key. In addition, the user would have to set in the admin interface the rooms URIs (i.e. gitterHQ/services) he wants to post to (as long as the user he created has enough permissions to access them).

* * *

In both cases, the admin interface will include a filter rules table, similar to the one Discourse Slack plugin currently has. It will allow specifying the category (or all the categories), the type of filter and the rooms to send the notifications. In case the notifications are sent to the activity feed, it will also be necessary to include the webhook URLs. All this data would be stored using the `PluginStore`.

## Post transcripts to forum

Given that Gitter doesn’t support outgoing webhooks yet, a solution would be to build a bot to be continuously listening (on its own thread) to a given room messages, waiting for commands. For this, the [streaming API](https://developer.gitter.im/docs/streaming-api) and the [Faye endpoint] ([https://developer.gitter.im/docs/faye-endpoint](https://developer.gitter.im/docs/faye-endpoint)) are available, both of them allow real-time access to room messages (I still need to figure out which one to use).

After the bot receives a command like `/topic last:50 category:staff`, he will consult the Gitter REST API, get the 50 last messages and then create a new topic in the specified category with those 50 messages as posts. Additionally, I was thinking in merging continuous messages from the same user with a minimum time gap (probably seconds) to create an only post.

Regarding some stretch goals:

- If the command includes a parameter like `from:15:35-16:10`, this is a different way to specify which messages to post to the forum, right? Instead of `last:50`

- If the command includes a parameter like ‘ignore:bob,sara’, the messages belonging to those users (in Gitter) would be filtered out before creating the posts.

- “Post as the user who issues the command”. If the user’s username is the same in Discourse and in Gitter, I think it’s a simple task. However, if that’s not the scenario, it would be needed a way to match the two usernames. For now, I’ve come to a workaround that includes a feature I’ve been considering to add: only forum admins are allowed to post transcripts. This is because I think of this feature as a way to make backups of Gitter conversations, and making backups is a task usually performed by admins. In that sense, when the bot receives the command, he would try to find an admin user with the provided username and if he doesn’t get any result, he will look for in a list of “username equivalences” (set in the admin interface).

- “Open a pre-filled topic in the browser instead of posting directly”. I don’t fully understand this one. I read [this post about pre-filled topics](https://meta.discourse.org/t/compose-a-new-pre-filled-topic-via-url/28074) and I don’t think there is a way to pre-fill many posts. Please, let me know If I misunderstood this.

I hope I explained myself well enough. Please, let me know what sections I should go in more details, what sections I should be more clear, whether I missed an important aspect, if I misunderstood some spec or key concept or some feedback in general. I’d appreciate it.

Greetings!

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [2017 年 3 月 7 日午後 10:02 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/3 "2017-03-07T22:02:47Z")

</div>

Hey Jafeth,

This looks good! Just a couple of things that need to be cleared up.

> [@jafeth.diazc](#):
>
> In my opinion, separating messages and external services events is cleaner.

This method does sound preferable. I wasn’t aware of this feature though. Could you please share a screenshot of it in action?

> [@jafeth.diazc](#):
>
> After the bot receives a command like /topic last:50 category:staff, he will consult the Gitter REST API, get the 50 last messages and then create a new topic in the specified category with those 50 messages as posts.

I think we’ve had a misunderstanding here. The idea is to post it all as _one topic_, not as individual posts. The idea is that you’d want to edit the transcript of that conversation into a single cohesive post that sums up the entire conversation.

> [@jafeth.diazc](#):
>
> If the command includes a parameter like from:15:35-16:10, this is a different way to specify which messages to post to the forum, right? Instead of last:50

Yes, they are mutually exclusive. Trying to execute both at the same time should result in an error.

> [@jafeth.diazc](#):
>
> If the command includes a parameter like ‘ignore:bob,sara’, the messages belonging to those users (in Gitter) would be filtered out before creating the posts.

As mentioned above, there would only be one single post made. But yes, those message would be excluded from the transcript that gets exported to Discourse.

> [@jafeth.diazc](#):
>
> only forum admins are allowed to post transcripts.

That’d be a fair restriction to start out with, sure.

> [@jafeth.diazc](#):
>
> “Open a pre-filled topic in the browser instead of posting directly”. I don’t fully understand this one. I read this post about pre-filled topics and I don’t think there is a way to pre-fill many posts. Please, let me know If I misunderstood this.

This one should make more sense when you think about it in terms of just a single post 😉

---

<div class="post-metadata">

### Author: ![jafeth.diazc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jafeth.diazc/32/101197_2.png) [@jafeth.diazc](https://meta.discourse.org/u/jafeth.diazc)
#### Post date: [2017 年 3 月 8 日午後 5:09 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/4 "2017-03-08T17:09:59Z")

</div>

Thanks for the feedback and the clarification 🙂 I will make some corresponding changes to my proposal.

Here is a screenshot of a room in Gitter with the activity feed on the right side. There would go the forum’s notifications in markdown and probably some color (depending on the type of event) and the forum logo as icon.

 ![](https://global.discourse-cdn.com/meta/original/3X/7/4/74755db1f689bfe84e9cd3afa2ccd68c8ef19127.png)

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [2017 年 3 月 15 日午後 9:23 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/5 "2017-03-15T21:23:53Z")

</div>

Dedinitely keep a close eye on this development:

[http://venturebeat.com/2017/03/15/gitlab-acquires-software-chat-startup-gitter-will-open-source-the-code/](http://venturebeat.com/2017/03/15/gitlab-acquires-software-chat-startup-gitter-will-open-source-the-code/)

**Edit:** Sounds like they’re planning to keep it running for the foreseeable future. The default chat application for GitLab is Mattermost though, so something’s bound to happen in this space eventually. I’d say that’s probably a year++ off, so this is still worth pursuing.

---

<div class="post-metadata">

### Author: ![jafeth.diazc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jafeth.diazc/32/101197_2.png) [@jafeth.diazc](https://meta.discourse.org/u/jafeth.diazc)
#### Post date: [2017 年 3 月 16 日午前 1:13 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/6 "2017-03-16T01:13:20Z")

</div>

Glad to know this is still worth to pursue. And yes, as also explained in their blog, I see Gitter has several plans for the future.

> **[Gitter + GitLab = win](https://blog.gitter.im/2017/03/15/gitter-gitlab-acquisition/)**
>
> Hello everyone, amazing news today, Gitter \[https://gitter.im\] has been acquired
> by GitLab \[https://gitlab.com\]. Wow!
> 
> Before getting into the details, we’d like to thank the 800,000+ people who make
> up the Gitter community for your enthusiasm and...

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [2017 年 8 月 21 日午後 1:25 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/7 "2017-08-21T13:25:19Z")

</div>

In progress:

> [@Gitter integration for Discourse](https://meta.discourse.org/t/gitter-integration-for-discourse/65881):
>
> Hi all! I have been working on a Gitter integration for Discourse as an alternative service to the [Slack plugin](https://meta.discourse.org/t/the-official-discourse-slack-plugin/51412) and I’d like to share the current state of it. It’s necessary to [create a custom integration](https://gitter.zendesk.com/hc/en-us/articles/200176722-Integrations) in each room in which we want Discourse notifications. Once created, go to /admin/plugins/gitter to register a new integration with the room name (e.g. gitterhq/meta) and the integration webhook url. As you can see below, the admin interface is pretty similar to the Slack plugin’s, allowing …

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [2017 年 8 月 21 日午後 1:25 UTC](https://meta.discourse.org/t/gitter-post-notifications-to-chat-post-transcripts-to-forum/51247/8 "2017-08-21T13:25:22Z")

</div>


