Can't manage Listeners

Marcel Batista July 22, 2012

Hi,

I am not able to manage listeners in my system. When I go system -> Advanced there's no Listeners tab available for me to add a custom one.

Here's the screenshot: http://s18.postimage.org/xhyl766a1/jira_help.jpg

4 answers

2 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2012
Marcel Batista July 22, 2012

Ok I understand. I was told I need to raise a ticket if I want to ask for Jira Adms to create a listener for my project. The thing is I can't do it!! When I'm trying to validate my account I am told "Couldn't validate the URL: 'https://[.......].atlassian.net' you have entered.". I wonder if that's because I'm on a evaluation account. Anyways, I need to make everything work the way I was asked to before being able to convince my company of buying the license. What to do?

JohnA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2012

Hi Marcel,

I suspect the reason you haven't been able to log a support ticket is that our system was having problems, but it's back up and running again now. Although it seems there's some confusion because I'm sorry to say that listeners can't be configured for OnDemand instances, as stated by Jobin, but you are correct that you can request Atlassian Support to assist you with configurations that are permitted in the OnDemand environment, but that require System-Administrator privileges to perform.

However, in your case, if listeners are a specific requirement for your organisation then you should investigate a 'Behind The Firewall', (downloaded), version of JIRA because they are a restricted function in the OnDemand environment.

All the best,
John

Marcel Batista July 22, 2012

Actually I'm all down now. I get a maintenence message when I try to access my url...

0 votes
Fabrizio Galletti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 3, 2013

ok so my webhook reference will be something like http://mydomian.com/script.php

My need is slight different, i need to modify data in linked issue of the one closed, dunno how but it's what we need :)

0 votes
EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2013

Just thought I would share my approach.

Using a simple web service (use the term lightly in this case) hosted on another server you can set web-hooks to mimic the actions of listeners.

For example one of my needs was auto-transitions based on comments if issues are in a particular state. If that is your need just update the commentTransitions array, or see the bottom if statement to see how you could handle other cases.

<?php

class aodListener{
		//change me
	public	$TARGET="https://subdomain.atlassian.net";
	public	$USER="username";
	public	$PASS="password";
	public	$LOG="notice.log";

		//array or statusId => actionId for transitions to make on comments, use true or false to limit to assignee or anyone else.
	public	$commentTransitions = array(
			10001=>array(false,"711") //waiting on customer --> investigating if NOT assignee
			//,"10000"=>array(true,"721") //investigating --> waiting is IS assignee
			);

		
		// dont cjhange anything else

		
		function info($message){
			error_log(date("Y-m-d H:i:s") . " " . $message . "\n", 3, $this->LOG);
		}

		function post($url, $body){
			$authHeader="Basic " . base64_encode($this->USER.":".$this->PASS);

			
			$curl_handle = curl_init();
			
			curl_setopt($curl_handle, CURLOPT_URL,$url);
			curl_setopt($curl_handle, CURLOPT_HEADER, 0);
			curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array(
				  'Authorization: ' . $authHeader,
				  'User-Agent: ' . "EddiesActionHelper",
				  "Content-type: application/json"
				));
				
			curl_setopt($curl_handle, CURLOPT_POSTFIELDS,  $body);
			curl_setopt($curl_handle, CURLOPT_POST, 1);
			
			$json_response = curl_exec($curl_handle);
			$request_info = curl_getinfo($curl_handle,CURLINFO_HTTP_CODE);

			$this->info("Request code: " . $request_info);
			if($request_info == "204"){
				$this->info("Success!");
			}

			
			curl_close($curl_handle);
			$curl_handle = null;
		}
		
		function transition($issueId,$actionId){
			$this->info("creating post");
		    $url=$this->TARGET . "/rest/api/latest/issue/" . $issueId . "/transitions";
			//$url="http://requestb.in/plli6fpl";
			$body='{"transition":{"id":"' . $actionId . '"} }';
			
			$this->info("sending post to: " . $url . " with " . $body . " ");
			$this->post($url,$body);
			
		}
}
	
$helper = new aodListener();	

	$helper->info("request recieved");
	//get request from atlassian web hook.
	$body = @file_get_contents('php://input');

	
	//inspect to determin action
	$message = json_decode($body);
	//$helper->info($body);
	//$helper->info(print_r($message));
	
	if(!isset($message->webhookEvent)){
		$helper->info("Not a valid Atlassian Webhook");
		die();
	}
	
	
	if(isset($message->comment)){
		$helper->info("comment submitted");
		//use map to auto transition		
		$currentStatus=$message->issue->fields->status->id;
		$helper->info("issue status:" . $currentStatus);
		if( isset($helper->commentTransitions[$currentStatus]) ){
			$isAssignee = $message->comment->author->name == $message->issue->fields->assignee->name;
			$helper->info("Is Assignee: " . $isAssignee);
			if($helper->commentTransitions[$currentStatus][0] == $isAssignee){
				$actionId = $helper->commentTransitions[$currentStatus][1];
				$helper->info("Requesting transition with action id " . $actionId);		
				$helper->transition($message->issue->id,$actionId);
			}else{
				$helper->info("Comment being ignored");
			}
		}else{
			$helper->info("Current status not one to transition, ignoring");
		}
	}else if(isset($message->changelog)){
		//handle status change
	}else{
		//unammped action
	}
		
	
?>

Fabrizio Galletti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 2, 2013

i've to make some action when my issue is closed to linked issue (linked by a particular link type) and i don't know if i can

Fabrizio Galletti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 2, 2013

Hy eddie, just some question:

- This page that u have created runs on apache or similar?

- Is a php page? Probably i'm new on webhook, but where can i configure where to send the "webhook call" ? in the url section i can specify a single host, have u created this page as "index.php?" or i'm probably missing something

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 3, 2013

The script is PHP, so you'll need a webhost that runs PHP (apache will work with mod_php), any standard webhost offers this. You will need to specify the webhook URL depending on the name of the file that you save (couldbeanything.php)

I don't see why you couldn't act on a closed issue ( you may want to modify the script to ignore the current status, and ony inspect the action. )

Fabrizio Galletti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2013

ok so my webhook reference will be something like http://mydomian.com/script.php

My need is slight different, i need to modify data in linked issue of the one closed, dunno how but it's what we need :)

0 votes
JohnA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2012

Hi Marcel,

I'm sorry to say that it is expected that you cannot access the listeners in your instance because you do not have the JIRA System-Administrators permission for your OnDemand instance, but this is to be expected because this is one of the restricted functions in OnDemand: https://confluence.atlassian.com/display/AOD/Restricted+Functions+in+Atlassian+OnDemand

Therefore, you will need to open a support ticket for any task that requires System-Administrator permissions and request that an Atlassian Engineer performs the required tasks on your behalf.

All the best,
John

Suggest an answer

Log in or Sign up to answer