-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Jira support #637
Comments
+1 |
@dennis-f , @nwsheppard - There is no Jira expertise in the current team. Can you please see if any Jira community members may be able to help out? There is no need to understand the Rocket.Chat code, they just need to contribute a 'hubot' adapter over in the Rocket.Chat Chat Ops Edition project. Thanks. |
@Sing-Li - How is the Rocket.Chat Chat Ops Edition different from the hubot-rocketchat integration? |
@nwsheppard It is 100% hubot / hubot-rocketchat powered! It will have ALL the features of the core Rocket.Chat plus it will have some dedicated user interface that is specific to the bot(s) that is(are) integrated. Essentially turning a chat into a chat-app. And it will be, by design, massively scalable. BTW ... it is post 1.0 - just starting up there. Before that is ready, the very same hubot that you create will be compatible - and can be used - with the current core Rocket.Chat. |
@Sing-Li - Thanks. |
Raised hand (for someone who knows JIRA) |
Awesome! @gabriellezbautista would you be interested in checking out Rocket.Chat.Ops and do for JIRA something like we did for GitHub? |
I'm looking at it right now 👍 I'll try to put some time to it. |
Upon searching npm registry, I found this https://github.com/ndaversa/hubot-jira-bot. Maybe we can hookup with the developer and see if we can re-use it. |
Anything new on this Topic? |
Maybe the easiest way would be to use the Jira Webhooks (https://developer.atlassian.com/jiradev/jira-apis/webhooks) and make a Mapper from Jira Json to RC Json. |
I also think that using the native JIRA WebHooks may be a good option. The only thing missing here is some way to translate application specific hook payloads (JIRA in this case) into something Rocket.Chat understands. I could imagine that if there is some API support for such transformations in Rocket.Chat, adding integrations for all kind of services would be easy (see #638 and others) |
Rather than providing API by rocket chat or JIRA to transform data, i think it is nice to have hubot script that will transform the data from any source lets say gitlab or jira to a format that is understand by the Rocket chat. |
@pavankumarkatakam Sure, that would work. But it looks like the rocketchat hubot doesn't provide the full feature set of the web hooks. Especially it doesn't allow to change the display name and the avatar for individual integrations. Or am I missing something here? |
@chkal , yes you are right. hubot is not usefull in this scenario. |
So I wonder what the primary way of integrating which 3rd party application should be in the long run. Of cause hubot will work in most cases (and with existing hubot plugins + the hubot-rocketchat) adapter. But I think this way of integrating doesn't allow the level of flexibility that users want. Like having different avatars/usernames for each system which is integrated. That's something that Slack brings out of the box. |
Actually, that has very little to do with the means of integration. There has been talks on giving "system bot users" privilege to create new 'powerless' alien-system users (complete with avatar), and once that's in place - what you mentioned will be possible. The very same 'feature' is needed in many other scenarios - including better federation support. Didn't look like there is an existing issue - added #2349 . |
Depends on #2426 |
Please, the Jira web hook is a really perfect starting point. You just have to parse the JSON which rocketchat is receiving from the hook. That's all. |
Please see initial documentation at https://github.com/RocketChat/Rocket.Chat/wiki/WebHook-Scripting---GitHub |
has anybody a working script? |
anything new on this Topic? |
not yet, but maybe this weekend I'll dive into this. I'll keep you updated |
I hope this topic is still activ, i loved to see jira integration in Rocket.Chat |
It is, just need to renew JIRA plan, then I'm getting back on this |
This would be a major selling point in convincing the rest of the team to go for rolling this out to the rest of the company |
Here's a script I created to parse the Jira webhook JSON in a manner similar to what the Slack integration service does: class Script {
process_incoming_request({ request }) {
if (!(request["content"] && request.content["webhookEvent"])) {
return {
error: {
success: false,
message: 'Unsupported request'
}
};
}
const ref_url = request.content.issue.self;
const url_parts = /^(\w+\:\/\/)?([^\/]+)(.*)$/.exec(ref_url);
const url_origin = url_parts[1] + url_parts[2];
const user_login = request.content.user.name;
const user_name = request.content.user.displayName;
const avatar_url = request.content.user.avatarUrls["16x16"];
const issue_type = request.content.issue.fields.issuetype.name;
const issue_icon = request.content.issue.fields.issuetype.iconUrl;
const issue_number = request.content.issue.key;
const issue_title = request.content.issue.fields.summary;
const issue_url = url_origin + '/browse/' + issue_number;
const issue_link = '[' + issue_number + '](' + issue_url + ')';
let text = user_name;
let emoji = '';
switch (request.content.webhookEvent) {
case 'jira:issue_created':
emoji = ':triangular_flag_on_post: ';
text += ' created ' + issue_type + ' ' + issue_link;
break;
case 'jira:issue_updated':
emoji = '';
text += ' changed ' + issue_type + ' ' + issue_link;
const actions = {
'jira:resolution': function(item, items) {
emoji = item.to === null ? ':triangular_flag_on_post: ' : ':white_check_mark: ';
item = items['jira:status'];
return ' from "' + item.fromString + '" to "' + item.toString + '"';
}
}
let items = request.content.changelog.items;
let actions_items = {};
for (let i = 0; i < items.length; ++i) {
let item = items[i];
let action = item.fieldtype + ':' + item.field;
actions_items[action] = item;
}
let result;
for (let action in actions_items) {
let item = actions_items[action];
if (actions[action]) {
result = actions[action](item, actions_items);
text += result;
break;
}
}
if (result === undefined) {
return {
error: {
success: false,
message: 'Unsupported action'
}
};
}
break;
default:
return {
error: {
success: false,
message: 'Unsupported event'
}
};
}
const attachment = {
author_icon: issue_icon,
author_name: issue_title,
author_link: issue_url,
fields: []
};
if (request.content.issue.fields.assignee) {
attachment.fields.push({
title: 'Assignee',
value: request.content.issue.fields.assignee.displayName,
short: true
});
}
if (request.content.issue.fields.creator) {
attachment.fields.push({
title: 'Creator',
value: request.content.issue.fields.creator.displayName,
short: true
});
}
// attachment.fields.push({
// title: 'Request',
// value: JSON.stringify(request.content),
// short: false
// });
return {
content: {
icon_url: avatar_url,
alias: user_login,
text: emoji + text,
attachments: [attachment]
}
};
}
} |
This Script Works fine!!! But it seems that Rocket.Chat ignores the Alias and the avatar of the bot. It keeps posting it under my credentials. Thank you for this nice script |
@lkraider is this script parsing all possible payloads from JIRA? In other words, is it complete? If not, I'll start working on this intergration on monday, may I use your Script as a base? |
After a littlebit of Scripting i finaly managed to overwrite the credentials under wich the bot posts your Jira Tickets. You need to modify the following entrys:
Notice that the Name and the Url must be written in apostrophe (' ') With these changes the Webhook bot has a diffrent name and avatar :) |
Make sure to include version/feature compatibility checks |
@manuelbachl The script is a start, I tried to replicate what Slack provides for Jira Issue updates. This could definitely be expanded to have all types of events handled and maybe have some form of configuration options. |
Here are some anonymized Jira webhook JSON data so people can identify other fields to extract: They are the output for issue updates only, including Resolved, Reopened, Worklog and Assignee change. |
@Angl0r You can remove return {
content: {
text: emoji + text,
attachments: [attachment]
}
}; This will make the message use the Bot details configured in the Rocket integration webhook settings. |
with the script above (including lkraider's modification to the return content) I get the following error in the chat server logs:
There are no docs (that I can find) explaining how scripts are supposed to work.. has something changed in a recent version perhaps? I'm using 0.27 |
Not sure about the error, I am on 0.27 also. Try increasing the log level and copy all output here. Some Script examples can be found in the docs: Would be great to have the full API though. |
yes, those integrations mentioned by @lkraider are just examples. But those are quite easy to expand to full functionality if the payloads are documented good enough. We switched from Jira and Bitbucket to Gitlab a few days agow and also want to have the full integration. So if no1 is faster than us, Gitlab will be the next Integration right after completing JIRA which is already in progress ;-) |
strange, I simplified the script down to a hardcoded returned content block and still got the same error, then it suddenly started working, then after re-instating the original script it worked. Do scripts get cached quite aggressively maybe? Whatever, it seems to be OK for now, so thanks for the efforts on this - looks like it will be really useful for us. :) |
If anyone's interested, I've created a JIRA integration that responds with a summary of a JIRA issue whenever it's mentioned. Feel free to try it out and provide any feedback/help you can. |
@gustavkarlsson Do you intend to extend this integration to incoming i.e. connecting a given JIRA project to a RocketChat room? Also a question for everyone involved, is there a desire to get this integrated in some way, or do we think we'll all be rolling our own for the foreseeable future? :) |
@antgel No plans for that. This is for outgoing messages only. |
Due the Snap installation will create a read-only directory the Jira Webhook script runs into problems. Not sure if this also causes some problems with other Integrations. |
I found this integration Rocket.chat -> Jira - https://hub.docker.com/r/gustavkarlsson/rocketchat-jira-trigger/ based on Java. It is use Outgoing webhook. Or you can try this integration Jira -> Rocket.chat - https://blog.zemna.net/web/how-to-integrate-jira-and-bitbucket-application-with-rocket-chat/ based on Incoming webhook. |
I tried, jira received a 400 response... |
Sorry not sure what the status of this is, but just going to quickly pop some stuff here. There isnt any work as far as i am aware that needs to be done on this. The current integration script utilising the incoming webhooks with JIRA posting to it work perfect and can be customised to your liking. This is what our 'helpdesk feed' looks like in Rocket.Chat: The incoming intergration is done with this gist here https://gist.github.com/malko/7b46696aa92d07736cc8ea9ed4041c68 To interact with JIRA you can use some great hubot plugins that are around https://www.npmjs.com/search?q=hubot+jira This can be done with the internal/built in Rocket.Chat hubot or your own instance. This is the one I use https://www.npmjs.com/package/hubot-jira-bot We use it to search for JIRA tickets, open them, transition them thru different states, comment on them, rank them up or down, start or stop watching them or change who is assigned to a ticket. |
@JSzaszvari I'd like to close this as I've been doing with other bot suggestions and you've done to a few too, because they're out of scope. But this one seems to have a lot of history. If you think it's OK to handle from here as part of the collection of proposals for discussion / voting under #10174, please go ahead and close. |
@rocket-cat close @timkinnane 100% agree. This is already handled with incoming integrations, existing Hubot functionality and when released Rocket.Chat Apps will allow a much more intergrated if needed. I'm saying that, I'll now close this issue. |
i'd love to see Atlassin Jira integration
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: