I have heard IT and facility teams complain that users simply do not report minor issues and they cannot address issues they are simply unaware of. Someone said "It would be great if there were small tablets for users to easily raise and issue, or better yet a button."
Image a workplace where you can press a small button if the AV equipment in the conference room isn't working, there is a button at the teapoint to press when supplies are low or maybe a button on the mirror of the restroom if you see that service is required
1. Get your button setup:The easiest thing to do is download the mobile to quickly get your button up and running. It will set the permissions and add the rules and function you need.
You can certainly do this all manually and you'll find instructions online but for the purpose of scenario we'll keep it simple. Select the Lambda blueprint "Send Email (node.js)" - we'll replace this later.
2. Make a node.js package to upload:We need to create a package because the function we will use requires a module to be installed. If you do not have node.js installed and are working on a Mac you can follow these excellent instructions by Dave McFarland
- Make Project Directory
mkdir JIRAButton
cd JIRAButton
- Make this Directory the Root of your project
npm init --yes
- Install the required request module - the function requires the request module
npm install request --save
- Create your index.js file in your directory with the code below and edit "YourSiteHere" in the uri, "username" and "password." You can also add fields or data points you'd like set, like "Priority."
'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);
}
});
};
Your directory should now look like this:
JIRAButton/
- node_modules/
- package.json
- index.js
3. Zipping it upYou have a package, now you need to "zip it up". Be sure to do this from the command line the OS tools will not work properly. On a Mac you'll want to use something like this in terminal
zip -r -X archive_name.zip JIRAButton
4. Now you're all ready to upload:Log into Lambda service and open the function that was automatically created in step 1. It will have a silly name like iotbutton_G03XXXXXXXXXXXXXXXX_iot-button-email-ses-nodejs.
- Click on "Code" and change the code entry type to "Upload a .ZIP file"
If it's successful pressing your button will now create a ticket in your JIRA project.
Comments