Skip to content

Commit 4453261

Browse files
Merge pull request #22214 from newrelic/MSTeams-integration-APImethod
Added MS Teams integration
2 parents 925d3eb + d05c96b commit 4453261

File tree

2 files changed

+258
-0
lines changed

2 files changed

+258
-0
lines changed

src/content/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels.mdx

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,228 @@ The best practice is to use the `channelSchema` endpoint to see which fields mus
461461
```
462462
</Collapser>
463463

464+
<Collapser
465+
className="freq-link"
466+
id="microsoft-teams"
467+
title="Microsoft Teams"
468+
>
469+
<Callout title="Note">
470+
The Microsoft Teams integration is now available in both US and EU regions.
471+
</Callout>
472+
473+
### Prerequisites
474+
475+
Before configuring New Relic to send notifications to Microsoft Teams, you must:
476+
477+
* Have an existing Microsoft Teams channel where you want to receive notifications.
478+
* Create a [Microsoft Teams destination](/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-destinations/#microsoft-teams) in New Relic and obtain the `destinationId`.
479+
480+
### Step 1: Fetch available Team IDs
481+
482+
<Callout variant="tip">
483+
If you already know your Team ID and Channel ID, you can skip Steps 1 and 2 and go directly to [Step 3](#step-3-configure-the-new-relic-notification-channel) to configure the notification channel.
484+
</Callout>
485+
486+
This query discovers which Microsoft Teams are accessible through your destination. You provide the `destinationId` and specify that you want Team IDs (via `key: "teamId"`), and the API returns a list of available teams with their names and IDs:
487+
488+
```graphql
489+
{
490+
actor {
491+
account(id: YOUR_ACCOUNT_ID) {
492+
aiNotifications {
493+
suggestions(
494+
destinationId: YOUR_DESTINATION_ID,
495+
key: "teamId",
496+
channelType: MICROSOFT_TEAMS,
497+
constraints: []
498+
) {
499+
entities {
500+
displayValue
501+
value
502+
}
503+
errors {
504+
description
505+
details
506+
type
507+
}
508+
}
509+
}
510+
}
511+
}
512+
}
513+
```
514+
515+
The response will contain a list of teams with their display names and unique Team IDs:
516+
517+
```json
518+
{
519+
"data": {
520+
"actor": {
521+
"account": {
522+
"aiNotifications": {
523+
"suggestions": {
524+
"entities": [
525+
{
526+
"displayValue": "Engineering Team",
527+
"value": "389e7f6c-xxxx-47f0-aa77-xxxxxxxxxxxx"
528+
},
529+
{
530+
"displayValue": "DevOps Team",
531+
"value": "834dc358-xxxx-4445-9938-xxxxxxxxxxxx"
532+
}
533+
],
534+
"errors": []
535+
}
536+
}
537+
}
538+
}
539+
}
540+
}
541+
```
542+
543+
<Callout variant="tip">
544+
If you don't see the team you're looking for in the results, you can use the `filter` parameter to search for it by name:
545+
546+
```graphql
547+
{
548+
actor {
549+
account(id: YOUR_ACCOUNT_ID) {
550+
aiNotifications {
551+
suggestions(
552+
destinationId: YOUR_DESTINATION_ID,
553+
key: "teamId",
554+
channelType: MICROSOFT_TEAMS,
555+
constraints: [],
556+
filter: {
557+
type: CONTAINS,
558+
value: "Engineering"
559+
}
560+
) {
561+
entities {
562+
displayValue
563+
value
564+
}
565+
}
566+
}
567+
}
568+
}
569+
}
570+
```
571+
</Callout>
572+
573+
### Step 2: Fetch available Channel IDs for a Team
574+
575+
Once you have a Team ID from Step 1, this query discovers which channels exist within that specific team. You provide the `destinationId` and the `teamId` (as a constraint), and the API returns a list of available channels with their names and IDs:
576+
577+
```graphql
578+
{
579+
actor {
580+
account(id: YOUR_ACCOUNT_ID) {
581+
aiNotifications {
582+
suggestions(
583+
destinationId: YOUR_DESTINATION_ID,
584+
key: "channelId",
585+
channelType: MICROSOFT_TEAMS,
586+
constraints: [
587+
{
588+
key: "teamId",
589+
value: "YOUR_TEAM_ID"
590+
}
591+
]
592+
) {
593+
entities {
594+
displayValue
595+
value
596+
}
597+
errors {
598+
description
599+
details
600+
type
601+
}
602+
}
603+
}
604+
}
605+
}
606+
}
607+
```
608+
609+
The response will contain a list of channels within the specified team:
610+
611+
```json
612+
{
613+
"data": {
614+
"actor": {
615+
"account": {
616+
"aiNotifications": {
617+
"suggestions": {
618+
"entities": [
619+
{
620+
"displayValue": "General",
621+
"value": "19:xxxxxxxxxxxxxxxxxxxxxxxx@thread.tacv2"
622+
},
623+
{
624+
"displayValue": "Alerts",
625+
"value": "19:yyyyyyyyyyyyyyyyyyyyyyyy@thread.tacv2"
626+
}
627+
],
628+
"errors": []
629+
}
630+
}
631+
}
632+
}
633+
}
634+
}
635+
```
636+
637+
<Callout variant="tip">
638+
Similar to Team IDs, you can filter channels by name using the `filter` parameter to search within the specified team.
639+
</Callout>
640+
641+
### Step 3: Configure the New Relic notification channel
642+
643+
After obtaining both the Team ID and Channel ID, configure the New Relic notification channel to send alerts to your Microsoft Teams channel.
644+
645+
<Callout variant="important">
646+
This mutation creates a New Relic notification channel object that connects to an **existing** Microsoft Teams channel. The Teams channel must already exist in your Microsoft Teams workspace. This API does not create new teams or channels within Microsoft Teams itself - it only configures New Relic to send notifications to your existing Teams channels.
647+
</Callout>
648+
649+
```graphql
650+
mutation {
651+
aiNotificationsCreateChannel(accountId: YOUR_ACCOUNT_ID, channel: {
652+
type: MICROSOFT_TEAMS,
653+
name: "Channel Name",
654+
destinationId: YOUR_DESTINATION_ID,
655+
product: YOUR_PRODUCT,
656+
properties: [
657+
{
658+
key: "teamId",
659+
value: YOUR_TEAM_ID
660+
},
661+
{
662+
key: "channelId",
663+
value: YOUR_CHANNEL_ID
664+
}
665+
]
666+
}) {
667+
channel {
668+
id
669+
name
670+
}
671+
}
672+
}
673+
```
674+
675+
The `product` parameter specifies the New Relic product generating the notification. Valid values include:
676+
- `IINT` - Applied Intelligence (Incident Intelligence)
677+
- `ALERTS`
678+
- `ERROR_TRACKING`
679+
- `APM` - Application Performance Monitoring
680+
- `CHANGE_TRACKING`
681+
- `SECURITY`
682+
- `PD` - Proactive Detection
683+
- Other values: `CSSP`, `DISCUSSIONS`, `NTFC`, `SHARING`
684+
</Collapser>
685+
464686
<Collapser
465687
className="freq-link"
466688
id="webhook"

src/content/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-destinations.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,42 @@ In order to create a destination, different inputs must be supplied for each des
293293
Because our integration with slack is only available with OAuth2 authentication, the destination cannot be created with a mutation.
294294
</Collapser>
295295

296+
<Collapser
297+
className="freq-link"
298+
id="microsoft-teams"
299+
title="Microsoft Teams"
300+
>
301+
<Callout title="Note">
302+
The Microsoft Teams integration is now available in both US and EU regions.
303+
</Callout>
304+
305+
Before creating a New Relic destination that connects to Microsoft Teams, you must [install the New Relic for Microsoft Teams app](/docs/alerts/get-notified/microsoft-teams-integrations/#add-new-relic-for-microsoft-team) in your Microsoft Teams workspace. After installation, you'll receive a security code that is required for this mutation.
306+
307+
```graphql
308+
mutation {
309+
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
310+
type: MICROSOFT_TEAMS,
311+
name: "Destination Name",
312+
properties: [
313+
{
314+
key: "securityCode",
315+
value: YOUR_SECURITY_CODE
316+
}
317+
]
318+
}) {
319+
destination {
320+
id
321+
name
322+
}
323+
}
324+
}
325+
```
326+
327+
<Callout variant="important">
328+
After creating the New Relic destination, obtain the `destinationId` from the response. This ID is required to configure notification channels. See the [Microsoft Teams channel configuration section](/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#microsoft-teams) for the complete workflow.
329+
</Callout>
330+
</Collapser>
331+
296332
<Collapser
297333
className="freq-link"
298334
id="webhook"

0 commit comments

Comments
 (0)