Friday, 1 February 2019

Need help with my JIRA webhook written in NodeJS

I have figured out how to use express to get the server.js to listen for specific url's. My issue is being able to do something with the callback that JIRA does, I see the post body being outputted do the console I am running my server from but that is about it.Once it gets the data it is suppose to call out the the google calendar API to create a calendar entry based on data in the JIRA ticket:function insertEvents(auth) { console.log('In the InsertEvents function!'); const calendar = google.calendar({ version: 'v3', auth }); var event = { summary: entry.issue.fields.summary, description: entry.issue.fields.description, start: { dateTime: entry.issue.fields.customfield_11378, timeZone: 'America/Los_Angeles' }, end:{ dateTime: entry.issue.fields.customfield_11378, timeZone: 'America/Los_Angeles' } }; calendar.events.insert({ auth: auth, calendarId: 'primary', resource: event, }, function(err, event) { if (err) { console.log('There was an error contacting the Calendar service: ' + err); return; } console.log('Event created: %s', item.summary); }); } I am trying to take the values returned by request.body and put them into a variable that this insert function can use for summary ,description, start date/time etc. I not sure where I am going wrong.Any help would be appreciated :)

Submitted February 01, 2019 at 04:39PM by Limeman36

No comments:

Post a Comment