Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack like integrations #1175

Closed
satyapramodh opened this issue Oct 20, 2015 · 11 comments
Closed

Slack like integrations #1175

satyapramodh opened this issue Oct 20, 2015 · 11 comments

Comments

@satyapramodh
Copy link
Contributor

Features:

  1. Ability to add/edit and delete events for a service (like github, trello) to be integrated like slack.
  2. Custom templates for different events
  3. integration to add messages to channels, direct messages

Integrations to start with?

  1. Github
  2. Trello

I will attach separate issues for each of the integrations. But i believe the integration setup and other details should be discussed here, while they can be service specific.

Thanks.

This was referenced Oct 20, 2015
@gmsecrieru
Copy link
Contributor

@whiteBeatle Is this a possible duplicate for #202?

@marceloschmidt
Copy link
Member

Yes, duplicate!

@Sing-Li
Copy link
Member

Sing-Li commented Oct 22, 2015

@marceloschmidt @gmsecrieru - from my understanding, @whiteBeatle already has an implementation that he wants us to comment on.

@whiteBeatle - please let us know if this is the case, and where the branch might be (GitHub URL) ... we can definitely assign the task #202 to you (for now) - and start the discussion!

@satyapramodh
Copy link
Contributor Author

@marceloschmidt @gmsecrieru @Sing-Li
Sorry i was busy at work. I will share the github url over the weekend as i need to make some changes (the whole implementation is on js not coffee-script, internationalization flow needs to be followed). Till then i will layout the details of my implementation.
Sadly i dont think my implementation will be compatible with other slack integrations as (#202) suggested. But i will be happy to re implement them the proper way.

@satyapramodh
Copy link
Contributor Author

Implementation

Services
rocketchat_service
These hold the services currently implemented by the app. The tokens and secrets can be set via the administration> accounts.

Attributes:
name, caption, desc, icon, slug, createdAt

Integration
rocketchat_integration
These hold the integrations for the above services

Attributes:
service: { _id, name, slug }
room: {_id, name}
addedBy: {_id, name} //user
enabled: boolean
createdAt,
desc, // bot details
name: bot //name

Integration options
rocketchat_integration_options
These hold the settings/options of an integration.

Attributes:
integrationId,
Trello
board: {id}
events: { list of event names that the bot should listen to }
hook_id // to do crud operations on the webhook

Github
repo {owner, name}
events { list of event names that the bot should listen to } // eg: {push: true, pull_request: true}
hook_id //crud operations on the web hook

Handling integrations and webhooks:
On update or delete of an integration, i update(enable/disable webhook) or delete the integration_options with the help of matb33:collection-hooks
To capture webhooks i used meteorhacks:picker

Generating messages for a room:
I listen to the webhooks and add the relevant ones to messages based on what options were selected in the integration settings.

Messages
I have added a t: 'bot' to messages to identify them.
I also additionally have
bot { id, name slug } and
remote { // this stores the relevant details needed for the message template }

I have added new widgets to rocketchat-oembed for github and trello. These templates are appended to a message on view render.

Note: After speaking with @Sing-Li i realize that using rocket.chat.ops to do the implementation would be better. I have tried to implement it with hubot at first and came across a few issues. These doubts regarding the implementation are below

Doubts:
Although I used hubot with rocketchat adapter and was successful in sending messages as bot,

  1. Hubot needs a username and password and posts it on its behalf. Is this a right implementation? Slack provides you options to select a bot name, image etc. I dont think creating a user behind the scenes to achieve this is the right way, correct me if i am wrong.
  2. How do i access the database of rocketchat via hubot and customize my options for posting a message.

P.S Although this implementation works for now for my current need, i know this is not the right way to go about this. I am a newbie to meteor ( and nodejs too) and i am still going through rocketchat's code to see how its implemented. Any help for proper implementation will be great!

Thanks!

@engelgabriel
Copy link
Member

@whiteBeatle that all sounds awesome. Do you have a working version that we can see?

@ninja-
Copy link

ninja- commented Oct 29, 2015

  1. Hubot needs a username and password and posts it on its behalf. Is this a right implementation? Slack provides you options to select a bot name, image etc. I dont think creating a user behind the scenes to achieve this is the right way, correct me if i am wrong.

what we want here is an option to choose bot name and image per message so it will look like from a normal user but then add a tag like "BOT". this should be clearly inside the chatops package

@engelgabriel
Copy link
Member

Creating a user behind the scenes is the right way. That's the perfect way to give bots their own access levels, usernames, avatar, etc. Bots are like other users, so they need a users. Would be a disaster otherwize. I agree that they deserve a badge to show that they are a special kind of user, but nevertheless users. On that note, creating a single "bot" badge is a waste of resources. We must make something generic, so admins can create many types of badges. Maybe moderators would like a badge too, as admin may also have a badge.

One of the big changes we did a while ago, was replace all arrays of strings for users lists for arrays of objects, so we could add some more details about each user. Now we have to finish that job (there are still some places with arrays of strings) and add this extra information when necessary.

@ninja-
Copy link

ninja- commented Oct 29, 2015

hm but isn't that designed already in slack api? I really don't think adding users for every unique name bot gives is a good idea.
Regarding the badge I'd make the badge configurable by the bot so the bot can choose it's badge or fallback to BOT. But can't have no badge

@engelgabriel
Copy link
Member

You absolutely need a user. Trust me on this one. You want to be able to open a direct room with that bot, or invite a specific bot to a particular room.. so every bot (not every bot script, this is vey important) that has a different username will get its own user. There is no other way.

@xshadow
Copy link

xshadow commented Oct 26, 2016

I would love to see those integrations in RocketChat.

@engelgabriel I totally agree that you nee a user for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants