UNPKG

bugsnag-notification-plugins

Version:

Notification plugins (chat and issue tracking integrations) for Bugsnag.

31 lines (24 loc) 805 B
NotificationPlugin = require "../../notification-plugin" class Bugify extends NotificationPlugin @receiveEvent: (config, event, callback) -> if event?.trigger?.type == "linkExistingIssue" return callback(null, null) return if event?.trigger?.type == "reopened" payload = subject: @title(event) description: @markdownBody(event) project: config.projectId @request .post("#{config.url}/api/issues.json") .timeout(4000) .auth(config.apiKey, "") .type("form") .send(payload) .on "error", (err) -> callback(err) .end (res) -> return callback(res.error) if res.error callback null, id: res.body.issue_id url: "#{config.url}/issues/#{res.body.issue_id}" module.exports = Bugify