bugsnag-notification-plugins
Version:
Notification plugins (chat and issue tracking integrations) for Bugsnag.
45 lines (37 loc) • 1.35 kB
text/coffeescript
NotificationPlugin = require "../../notification-plugin"
qs = require 'qs'
class Sprintly extends NotificationPlugin
@receiveEvent: (config, event, callback) ->
if event?.trigger?.type == "linkExistingIssue"
return callback(null, null)
return if event?.trigger?.type == "reopened"
user_email = config.sprintlyEmail
api_key = config.apiKey
project_id = config.projectId
sprintly_status = config.sprintlyStatus
# Build the Sprint.ly API request
# API documentation: https://sprintly.uservoice.com/knowledgebase/articles/98412-items
description =
"""
*#{event.error.exceptionClass}* in *#{event.error.context}*
#{event.error.message if event.error.message}
#{event.error.url}
"""
query_object =
"type": "defect"
"title": "#{event.error.exceptionClass} in #{event.error.context}"
"tags": "bugsnag"
"description": description
"status": sprintly_status
@request
.post("https://sprint.ly/api/products/#{project_id}/items.json")
.auth(user_email, api_key)
.send(qs.stringify(query_object))
.on "error", (err) ->
callback(err)
.end (res) ->
return callback(res.error) if res.error
callback null,
number: res.body.number
url: res.body.short_url
module.exports = Sprintly