Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

New Relic alerts not working with Microsoft Teams

new-alerts

#1

Please share your question/describe your issue below. Include any screenshots that may help us understand your question:

I have set up Microsoft Teams New Relic Connector, but i am not getting any new alerts.
On sending test-notification, I am getting the following error:
{
response:200,
Unable to invoke Webhook. Webhook responded with HTTP status code 400.
}

If i configure Incoming Webhook Connector in Microsoft Teams to configure New Relic Alerts instead, I get the this error:
{
response:200,
Notification request ignored - NewRelic unknown event
}

Would appreciate some assistance here! Thanks :slight_smile:


#2

I am having the exact same issue with the same codes above.

The MS Teams documentation mentions that the webhook should be compatible with the Office 365 connector format https://dev.outlook.com/actions/reference

Any ideas please?


#3

Hi, @ammkh and @daniel.jackson: I don’t have Microsoft Teams to test with, but according to this article, Teams expects fields named title and text.

In the New Relic Alerts webhook channel definition, select Add custom payload:

Edit the JSON payload to map text and title fields to the alert data provided by New Relic:

Save your changes and send a test notification to see it works. Hope that helps!


Feature Idea: Make a new New Relic connector for MS Teams that's compatible with the new Alert system
NewRelic Alert setup with Teams
Who uses Teams?
#4

Hi @philweber : It is now working as you suggested. Thanks for the help :smiley:


#5

Thanks @philweber for the speedy response - all working now - much appreciated :slight_smile:


#6

Hi, this makes the webhook connector in Teams work with NR, but what about the NR connector? I know it’s an MS thing but could you contact them to find out why their ready made NR connector doesn’t actually work with NR?

This is likely an MS issue but they may take longer to respond to little people.


#7

HI All

I am facing the same issue. I do not have WebHook Connector in MS Team. While using the WebHook Channel Type in New Relic the above script shows an error

{
“title”: “New Relic Alert: $CONDITION_NAME in $POLICY_NAME”,
“text”: “$EVENT_DETAILS”
}

{

response: 200,

Unable to invoke Webhook: Unrecognized character escape ‘:’ (code 58) at [Source: (String)"{ “title”: “New Relic Alert: $CONDITION_NAME in $POLICY_NAME”, “text”: “$EVENT_DETAILS” } "; line: 2, column: 30]

}

One more question, in basic URL do we need to use MS Team Folder link or MS Team Share-point Folder link

Any help would be highly appreciated

Thanks!!


#8

Hi, @deepanshu.chamoli: The payload you posted contains typographic quotes (“ ”) rather than straight double-quote characters. The following works for me:

{
  "title": "New Relic Alert: $CONDITION_NAME in $POLICY_NAME",
  "text": "$EVENT_DETAILS"
}

#9

Thanks a lot for quick response.

Please find the image of error.

One more question what we need to put in Basic URL

Thanks


#10

so i get that error too, but if you close the channel and open it back up then click Send a test notification you should get a full success.


#11

I spent some time getting a more detailed card working, based on the templated variables that are made available. It shows the information neatly, and it’s better than sending an email to the channel.

There are a couple of caveats:

  • the notifications all look the same regardless of the event type – acknowledgement is a full notification. It would be better to be able to say “incident was acknowledged by John West”, but you can’t.
  • heroImage doesn’t render for me in my channel, but the images section does. If the hero images starts working, the other could be removed. Something is better than nothing for now however.
  • There is no capability to conditionally include segments based on the availability of different items. You might be able to do this with Flow, but I haven’t looked into this.
  • Items like the incident start time and duration are not included as they are just integers, not formatted dates or durations.

There is enough scope here that a really functional integration could be built into NR (like the Slack integration) that would end up being pretty useful. Below seemed to me to be a reasonable stopping point given the current capabilities.

Helpful links:

  • MessageCard playground: use this to test alterations to the format. (https://messagecardplayground.azurewebsites.net/)
  • RequestBin (or similar): if you use this as your destination URL you can get the JSON being sent for the test or real notifications. This helps to get real data to test in the playground, and also helps if you’re getting an error response from the Teams webhook.
{
    "@type": "MessageCard",
    "@context": "https://schema.org/extensions",
    "summary": "Incident $INCIDENT_ID $EVENT_STATE",
    "themeColor": "B286BC",
    "sections": [
        {
            "startGroup": true,
            "title": "**$CONDITION_NAME incident $EVENT_STATE**",
            "activityImage": "https://static.intercomassets.com/avatars/792690/square_128/newrelic_logo-1476726027.png?1476726027",
            "activityTitle": "$EVENT_DETAILS",
            "activitySubtitle": "$SEVERITY $EVENT_TYPE ([$INCIDENT_ID]($INCIDENT_URL))",
            "facts": [
                {
                    "name": "Open violations:",
                    "value": "critical $OPEN_VIOLATIONS_COUNT_CRITICAL / warning $OPEN_VIOLATIONS_COUNT_WARNING"
                },
                {
                    "name": "Closed violations:",
                    "value": "critical $CLOSED_VIOLATIONS_COUNT_CRITICAL / warning $CLOSED_VIOLATIONS_COUNT_WARNING"
                },
                {
                    "name": "Current owner:",
                    "value": "$EVENT_OWNER"
                }
            ]
        },
        {
            "text": "See the [triggering query in Insights]($VIOLATION_CALLBACK_URL)",
            "images": [
                {
                    "image": "$VIOLATION_CHART_URL"
                }
            ],
            "heroImage": {
                "image": "$VIOLATION_CHART_URL"
            }
        },
        {
            "potentialAction": [
                {
                    "@type": "OpenUri",
                    "name": "Details",
                    "targets": [
                        {
                            "os": "default",
                            "uri": "$INCIDENT_URL"
                        }
                    ]
                },
                {
                    "@type": "OpenUri",
                    "name": "Acknowledge",
                    "targets": [
                        {
                            "os": "default",
                            "uri": "$INCIDENT_ACKNOWLEDGE_URL"
                        }
                    ]
                },
                {
                    "@type": "OpenUri",
                    "name": "Runbook",
                    "targets": [
                        {
                            "os": "default",
                            "uri": "$RUNBOOK_URL"
                        }
                    ]
                }
            ]
        },
        {
            "startGroup": true,
            "activitySubtitle": "Alert sent by NewRelic for the account "$ACCOUNT_NAME" according to the [$POLICY_NAME]($POLICY_URL) event policy."
        }
    ]
}

Who uses Teams?
Feature Idea: Formatting the TIMESTAMP in a webhook custom payload
#12

Wow @jtelfer - Thanks for looking into that so deeply! That is great. I definitely agree, a built in Teams notification channel would always be a cleaner solution, in the meantime your work will, I’m sure, help others here.


#13

+1 for the Incident start (and would be nice for the end time as well), the e-mail notification gets a nicely formatted date and time, why can’t we have the same option in the webhook ? We’ve got a feature idea request for this (Feature Idea).

Taking influences from various sources (including @jtelfer above), I’ve so far got this far with my custom payload

{
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
   "title": "New Relic $EVENT_TYPE",
   "text": "Runbook: $RUNBOOK_URL",
   "themeColor": "B286BC",
   "sections": [
    {
        "activityTitle": "Policy: $POLICY_NAME - Condition: $CONDITION_NAME",
        "activityImage": "https://static.intercomassets.com/avatars/792690/square_128/newrelic_logo-1476726027.png?1476726027",
        "activitySubtitle": "$CONDITION_NAME at $TIMESTAMP",
        "facts": [
          {
            "name": "NewRelic Incident #:",
            "value": "([$INCIDENT_ID]($INCIDENT_URL)) - $SEVERITY"
          },             
          {
            "name": "Details:",
            "value": "$EVENT_DETAILS"
          },
          {
            "name": "Current State:",
            "value": "$EVENT_STATE"
          },               
          {
            "name": "Account:",
            "value": "$ACCOUNT_ID $ACCOUNT_NAME"
          }              
        ]        
    },
    {
        "title": "**Violations - CRITICAL / WARNING**",
					"facts": [          
          {
            "name": "Open:",
            "value": "$OPEN_VIOLATIONS_COUNT_CRITICAL / $OPEN_VIOLATIONS_COUNT_WARNING"
          },
          {
            "name": "Closed:",
            "value": "$CLOSED_VIOLATIONS_COUNT_CRITICAL / $CLOSED_VIOLATIONS_COUNT_WARNING"
          }						
        ]
    },    
    {
        "title": "Chart",
        "images": [
            {
                "image":"$VIOLATION_CHART_URL"
            }
        ]
    }
  ],
"potentialAction": [
 {
  "@type": "OpenUri",
  "name": "View Incident",
  "targets": [
    { "os": "default", 
      "uri": "$INCIDENT_URL" 
    }
  ]
},
    {
  "@type": "OpenUri",
  "name": "Acknowledge Incident",
  "targets": [
    { "os": "default", "uri": "$INCIDENT_ACKNOWLEDGE_URL" }
  ]
},
    {
  "@type": "OpenUri",
  "name": "Open Alert Policy",
  "targets": [
    { "os": "default", 
      "uri": "$POLICY_URL" }
  ]
},    
{
  "@type": "OpenUri",
      "name": "Open ServiceNow",
      "targets": [
        { "os": "default", 
          "uri": "https://xxxxxxxxxx.service-now.com/nav_to.do?uri=%2Fhome.do%3F" }
      ]
    }      
  ]
} 

which gives me something like this


(the ServiceNow system being our incident management tool).
The only thing that really bugs me is the $TIMESTAMP (can you tell :wink: )