kaji-bikash / rocketchat-newrelic

Incoming NewRelic integration for RocketChat
GNU General Public License v3.0
3 stars 2 forks source link

Bad request using this script #1

Open fabioperrella opened 6 years ago

fabioperrella commented 6 years ago

Hi, I've tried to use the script to receive newrelic requests, but I've got a bad request error.

I think this version was build based in a older version of newrelic payload

There is an example of the current payload in https://docs.newrelic.com/docs/alerts/new-relic-alerts/managing-notification-channels/customize-your-webhook-payload#webhook-format-examples

Am I wrong?

fabioperrella commented 6 years ago

I'm using this VERY simple script for now:

class Script {
  process_incoming_request({ request }) {
    var payload = request.content;
    var appName = payload.targets[0].name;
    var severity = payload.severity;
    var state = payload.current_state;
    var details = payload.details;
    var incident_url = payload.incident_url;

    return {
      content: {
        username: 'fabio.perrella',
        text: `[${appName}] [${severity}] [${state}] ${details} - ${incident_url}`,
        icon_url: null,
        attachments:[]
      }
    };
  }
}