John Colburn
Published © GPL3+

JIRA Button - Create A Ticket With A Press

A problem IT and facilities teams face is folks not reporting problems. It would be great if there was a simple button to raise a ticket.

BeginnerFull instructions provided1 hour2,374
JIRA Button - Create A Ticket With A Press

Things used in this project

Story

Read more

Code

Simple Lambda Function to create a JIRA ticket

JavaScript
This is a simple function to post the JSON to your JIRA API
'use strict';
exports.handler = (event, context, callback) => {
    console.log('Received event:', event.clickType);
    
var request = require('request');
var options = {
  uri: 'https://YourSiteHere/rest/api/latest/issue/',
  method: 'POST',
  auth: {
        username: 'YourUserName',
        password: 'YourPassword'
    },
  json: {"fields": {"project":{"key": "TEST"},"summary": "ALERT from IOT Buttom","description": "There is an emergency... somewhere.","issuetype": {"name": "BUG"}}}
};
request(options, function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body.id); // Print the shortened url.
   }
  });
};

Credits

John Colburn

John Colburn

1 project • 1 follower
Productivity Expert, Agile Advocate and Atlassian Pro

Comments