UI에서 공지채널을 관리하는 것 외에도 NerdGraph API 사용할 수 있습니다.
중요
이 문서는 목적지와 알림 메시지를 사용하여 새로운 알림 플랫폼에 Nerdgraph API를 사용하는 것을 참조합니다.알림 메시지는 기존 알림 채널과 다른 채널이라고도 합니다.
팁
NerdGraph를 시작하는 데 도움이 필요 하면 NerdGraph 소개를 참조하세요.
채널 나열 및 필터링
channels 쿼리를 사용하면 계정당 모든 채널에서 페이지를 매길 수 있습니다.또한 일부 필터링 기능을 허용합니다.
다음은 예입니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channels { entities { id name } error { details } } } } }}채널을 통해 페이지를 나누려면 초기 쿼리에서 nextCursor 필드를 요청해야 합니다.
커서 페이지 매김을 사용하면 응답에서 반환된 nextCursor 이 다시 비어 있을 때까지 결과 집합을 통해 계속 요청합니다. 이것은 결과의 끝에 도달했음을 의미합니다.
다음은 예입니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channels(cursor: "") { nextCursor entities { id name } totalCount } } } }}위의 코드는 다음과 같은 결과 집합을 반환합니다.
{ "data": { "actor": { "account": { "aiNotifications": { "channels": { "nextCursor": "/8o0y2qiR54m6thkdgHgwg==:jZTXDFKbTkhKwvMx+CtsPVM=", "entities": [ { "id": "01c0cbe7-3d70-47c1-99e0-adf906eed6c2", "name": "Channel Name" }, { "id": "05db0207-c137-4985-8cb5-f21e7e57b8cc", "name": "Another Channel Name" } // ... more channels here in reality ], "totalCount": 807 } } } } }}따라서 후속 요청에서 커서가 비어 있을 때까지 다음과 같이 커서를 제공합니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channels(cursor: "/8o0y2qiR54m6thkdgHgwg==:jZTXDFKbTkhKwvMx+CtsPVM=") { nextCursor entities { id name } totalCount } } } }}API는 이름으로 채널 쿼리를 허용합니다.name 필터는 정확히 일치 및 부분 일치를 반환합니다.대소문자를 구분하지 않습니다.이렇게 하면 제공된 이름과 일치하는 채널에 대한 정보만 반환됩니다.
이 예에서는 이름에 "DevOps" 있는 채널을 찾으려고 합니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channels(filters: { name: "DevOps" }) { entities { id name } } } } }}API를 사용하면 채널 ID로 쿼리할 수 있습니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channels(filters: { id: YOUR_CHANNEL_ID }) { entities { id name } } } } }}API를 사용하면 대상 ID별로 채널을 쿼리할 수 있습니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channels(filters: { destinationId: YOUR_DESTINATION_ID }) { entities { id name } } } } }}API를 사용하면 채널 유형별로 쿼리할 수 있습니다.다음 쿼리는 선택한 계정의 모든 이메일 채널을 반환합니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channels(filters: { type: EMAIL }) { entities { id name } } } } }}채널 만들기
채널을 생성하려면 각 채널 유형에 대해 다른 입력을 제공해야 합니다.각 채널은 대상에 연결됩니다.목적지에 대한 정보는 목적지에 대한 NerdGraph 튜토리얼을 참조하십시오.
가장 좋은 방법은 channelSchema 엔드포인트를 사용하여 다음과 같이 properties 에서 보내야 하는 필드를 확인하는 것입니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channelSchema( channelType: CHANNEL_TYPE destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT constraints: [] ) { schema { fields { mandatory label key component } } result } } } }}Jira는 구성 가능한 티켓팅 시스템이므로 이 채널을 만드는 고정된 방법은 없습니다.
두 개의 정적 필드( project 및 issuetype 가 있습니다.
다음과 같이 project 제안을 가져오고 값 중 하나를 issuetype 에 대한 제약 조건으로 사용합니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channelSuggestions( channelType: JIRA_CLASSIC destinationId: YOUR_DESTINATION_ID key: FIELD_NAME constraints: [{ key: "project", value: YOUR_PROJECT_VALUE }] ) { entities { value } error } } } }}선택한 값은 스키마를 가져오기 위한 제약 조건으로 사용됩니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channelSchema( channelType: JIRA_CLASSIC destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT constraints: [ { key: "project", value: YOUR_PROJECT_VALUE } { key: "issuetype", value: YOUR_ISSUE_TYPE_VALUE } ] ) { schema { fields { mandatory label key component } } result } } } }}각 필드를 가져오고 제안에서 값을 선택하거나 자유 텍스트로 선택한 후 채널을 만들 수 있습니다.
mutation { aiNotificationsCreateChannel(accountId: YOUR_ACCOUNT_ID, channel: { type: JIRA, name: "Channel Name", destinationId: YOUR_DESTINATION_ID, product: YOUR_PRODUCT, properties: [ { key: YOUR_FIELD_NAME, value: YOUR_FIELD_NAME, }, // ... And so forth with the rest of the fields ] }) { channel { id name } }}ServiceNow는 구성 가능한 티켓팅 시스템이므로 이 채널을 만드는 고정된 방법은 없습니다.
스키마는 위에 표시된 것처럼 가져와야 하며 각 필드는 자유 텍스트로 채워지거나 제안을 사용하여 채워져야 합니다.
{ actor { account(id: YOUR_ACCOUNT_ID) { aiNotifications { channelSchema( channelType: SERVICE_NOW destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT constraints: [] ) { schema { fields { mandatory label key component } } result } } } }}각 필드를 가져오고 제안에서 값을 선택하거나 자유 텍스트로 선택한 후 채널을 만들 수 있습니다.
mutation { aiNotificationsCreateChannel(accountId: YOUR_ACCOUNT_ID, channel: { type: SERVICE_NOW, name: "Channel Name", destinationId: YOUR_DESTINATION_ID, product: YOUR_PRODUCT, properties: [ { key: YOUR_FIELD_NAME, value: YOUR_FIELD_NAME, }, // ... And so forth with the rest of the fields ] }) { channel { id name } }}mutation { aiNotificationsCreateChannel( accountId: YOUR_ACCOUNT_ID channel: { type: SLACK name: "Channel Name" destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT properties: [{ key: "channelId", value: YOUR_SLACK_CHANNEL_ID }] } ) { channel { id name } }}메모
Microsoft Teams 통합은 이제 미국과 EU 지역 모두에서 사용할 수 있습니다.
전제 조건
Microsoft Teams에 공지를 보내도록 뉴렐릭을 구성하기 전에 다음을 수행해야 합니다.
공지를 받고 싶은 기존 Microsoft Teams 채널이 있어야 합니다.
뉴렐릭에서 Microsoft Teams 대상을 만들고
destinationId을 얻으세요.1단계: 사용 가능한 팀 ID 가져오기
팁
이미 팀 ID와 채널 ID를 알고 있다면 1단계와 2단계를 건너뛰고 3단계 로 바로 이동하여 공지 채널을 구성할 수 있습니다.
이 쿼리는 대상을 통해 어떤 Microsoft Teams에 액세스할 수 있는지 알아냅니다.
destinationId을 제공하고 팀 ID를 원한다는 것을 지정하면(key: "teamId"통해) API는 이름과 ID가 포함된 사용 가능한 팀 목록을 반환합니다.{actor {account(id: YOUR_ACCOUNT_ID) {aiNotifications {suggestions(destinationId: YOUR_DESTINATION_IDkey: "teamId"channelType: MICROSOFT_TEAMSconstraints: []) {entities {displayValuevalue}errors {descriptiondetailstype}}}}}}응답에는 팀 목록과 각 팀의 표시 이름, 고유 팀 ID가 포함됩니다.
{"data": {"actor": {"account": {"aiNotifications": {"suggestions": {"entities": [{"displayValue": "Engineering Team","value": "389e7f6c-xxxx-47f0-aa77-xxxxxxxxxxxx"},{"displayValue": "DevOps Team","value": "834dc358-xxxx-4445-9938-xxxxxxxxxxxx"}],"errors": []}}}}}}팁
결과에 원하는 팀이 보이지 않으면
filter파라미터를 사용하여 이름으로 검색할 수 있습니다.{actor {account(id: YOUR_ACCOUNT_ID) {aiNotifications {suggestions(destinationId: YOUR_DESTINATION_IDkey: "teamId"channelType: MICROSOFT_TEAMSconstraints: []filter: { type: CONTAINS, value: "Engineering" }) {entities {displayValuevalue}}}}}}2단계: 팀에 사용 가능한 채널 ID 가져오기
1단계에서 팀 ID를 얻으면 이 쿼리를 통해 해당 팀 내에 어떤 채널이 있는지 알아낼 수 있습니다.
destinationId과teamId을 제약 조건으로 제공하면 API는 이름과 ID가 포함된 사용 가능한 채널 목록을 반환합니다.{actor {account(id: YOUR_ACCOUNT_ID) {aiNotifications {suggestions(destinationId: YOUR_DESTINATION_IDkey: "channelId"channelType: MICROSOFT_TEAMSconstraints: [{ key: "teamId", value: "YOUR_TEAM_ID" }]) {entities {displayValuevalue}errors {descriptiondetailstype}}}}}}응답에는 지정된 팀 내의 채널 목록이 포함됩니다.
{"data": {"actor": {"account": {"aiNotifications": {"suggestions": {"entities": [{"displayValue": "General","value": "19:xxxxxxxxxxxxxxxxxxxxxxxx@thread.tacv2"},{"displayValue": "Alerts","value": "19:yyyyyyyyyyyyyyyyyyyyyyyy@thread.tacv2"}],"errors": []}}}}}}팁
팀 ID와 마찬가지로
filter파라미터를 사용하여 이름으로 채널을 필터링하고 지정된 팀 내에서 검색할 수 있습니다.3단계: 뉴렐릭 공지 채널 구성
팀 ID와 채널 ID를 모두 얻은 후, 뉴렐릭 공지 채널을 구성하여 Microsoft Teams 채널에 알림을 보내세요.
중요
이 변형은 기존 Microsoft Teams 채널에 연결되는 뉴렐릭 공지 채널 개체를 생성합니다. Teams 채널은 이미 Microsoft Teams 작업 영역에 있어야 합니다. 이 API Microsoft Teams 자체 내에서 새로운 팀이나 채널을 생성하지 않습니다. 기존 Teams 채널에 공지를 보내도록만 구성합니다.
mutation {aiNotificationsCreateChannel(accountId: YOUR_ACCOUNT_IDchannel: {type: MICROSOFT_TEAMSname: "Channel Name"destinationId: YOUR_DESTINATION_IDproduct: YOUR_PRODUCTproperties: [{ key: "teamId", value: YOUR_TEAM_ID }{ key: "channelId", value: YOUR_CHANNEL_ID }]}) {channel {idname}}}product파장은 공지를 생성하는 뉴렐릭 제품을 지정합니다. 유효한 값은 다음과 같습니다.IINT- 응용 프로그램 인텔리전스(인시던트 Intelligence)ALERTSERROR_TRACKINGAPM- 애플리케이션 성능 모니터링CHANGE_TRACKINGSECURITYPD- 사전 감지기타 값:
CSSP,DISCUSSIONS,NTFC,SHARING
payload 속성은 알림에서 보낼 페이로드입니다.핸들바 구문을 사용하여 요청에서 정보를 동적으로 삽입합니다.
mutation { aiNotificationsCreateChannel( accountId: YOUR_ACCOUNT_ID channel: { type: WEBHOOK name: "Channel Name" destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT properties: [{ key: "payload", value: "{\"key\":\"value\"}" }] } ) { channel { id name } }}mutation { aiNotificationsCreateChannel( accountId: YOUR_ACCOUNT_ID channel: { type: EMAIL name: "Channel Name" destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT properties: [] } ) { channel { id name } }}eventSource 은 기존 이벤트 소스의 전체 URL이어야 합니다.eventContent 은 다음과 같이 알림 본문에서 전송될 페이로드입니다.
mutation { aiNotificationsCreateChannel(accountId: YOUR_ACCOUNT_ID, channel: { type: EVENT_BRIDGE, name: "Channel Name", destinationId: YOUR_DESTINATION_ID, product: YOUR_PRODUCT, properties: [ { key: "eventSource", value: YOUR_AWS_EVENT_SOURCE }, { key: "eventContent", value: YOUR_EVENT_CONTENT/var> } ] }) { channel { id name } }}PagerDuty에는 서비스 수준과 계정 수준의 두 가지 통합 유형이 있습니다.자세한 내용은 PagerDuty 통합 문서 를 참조하십시오.
서비스 수준:
mutation { aiNotificationsCreateChannel( accountId: YOUR_ACCOUNT_ID channel: { type: PAGERDUTY_SERVICE_INTEGRATION name: "Channel Name" destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT properties: [{ key: "summary", value: YOUR_PAGE_SUMMARY }] } ) { channel { id name } }}계정 수준:
mutation { aiNotificationsCreateChannel( accountId: YOUR_ACCOUNT_ID channel: { type: PAGERDUTY_ACCOUNT_INTEGRATION name: "Channel Name" destinationId: YOUR_DESTINATION_ID product: YOUR_PRODUCT properties: [ { key: "summary", value: YOUR_PAGE_SUMMARY } { key: "email", value: EMAIL_OF_PD_USER } { key: "service", value: YOUR_PD_SERVICE_ID } ] } ) { channel { id name } }}채널 업데이트
채널을 업데이트할 때 채널의 모든 속성을 제공할 필요는 없습니다.예를 들어 이름만 업데이트하려는 경우 다음과 같이 업데이트해야 하는 유일한 속성입니다.
mutation { aiNotificationsUpdateChannel( accountId: YOUR_ACCOUNT_ID channelId: YOUR_CHANNEL_ID channel: { name: "Updated channel Name" } ) { channel { id name } }}채널 테스트
NerdGraph API를 통해 채널을 테스트할 수 있습니다.이는 채널을 생성하기 전이나 후에 수행할 수 있습니다.
mutation { aiNotificationsTestChannel( accountId: YOUR_ACCOUNT_ID channel: { type: PAGERDUTY_SERVICE_INTEGRATION name: "Channel Name" properties: [{ key: "summary", value: YOUR_PAGE_SUMMARY }] } ) { error { details } details result }}mutation { aiNotificationsTestChannelById( accountId: YOUR_ACCOUNT_ID channelId: YOUR_CHANNEL_ID ) { error { details } details result }}채널 삭제
NerdGraph API를 통해 채널을 삭제할 수 있습니다.
mutation { aiNotificationsDeleteChannel( accountId: YOUR_ACCOUNT_ID channelId: YOUR_CHANNEL_ID ) { ids error { details } }}