@dynatrace-sdk/client-notification-v2

中文文档
2.5.0发布于 2026/07/29Apache-2.0TypeScriptESM + CJS近 30 天下载 1.4万

npm License

原始使用文档
文档目录50 节
  1. Installation
  2. Getting help
  3. License
  4. eventNotificationsClient
  5. createEventNotification
  6. deleteEventNotification
  7. getEventNotification
  8. getEventNotifications
  9. patchEventNotification
  10. updateEventNotification
  11. resourceNotificationsClient
  12. createResourceNotification
  13. deleteResourceNotification
  14. deleteResourceNotificationByTypeAndResource
  15. getResourceNotification
  16. getResourceNotifications
  17. Types
  18. DavisEventConfig
  19. DavisEventName
  20. DavisEventTriggerConfig
  21. DavisProblemCategories
  22. DavisProblemConfig
  23. DavisProblemTriggerConfig
  24. EntityTags
  25. Error
  26. ErrorDetails
  27. ErrorEnvelope
  28. EventNotification
  29. EventNotificationInput
  30. EventNotificationRequest
  31. EventNotificationUpdate
  32. EventQuery
  33. EventQueryTriggerConfig
  34. ModificationInfo
  35. PaginatedEventNotificationList
  36. PaginatedResourceNotificationList
  37. ResourceNotification
  38. ResourceNotificationRequest
  39. EventTriggerConfig
  40. Enums
  41. DavisEventNameMatch
  42. DavisEventTriggerConfigType
  43. DavisProblemConfigProblemOpenDuration
  44. DavisProblemTriggerConfigType
  45. EntityTagsMatch
  46. EventQueryTriggerConfigType
  47. EventType
  48. MaintenanceWindowTriggerBehaviorType
  49. TriggerOn
  50. TriggerOnUpdateFields

@dynatrace-sdk/client-notification-v2

npm License

Manage resource/event notifications with the Notification Service API.

Installation

npm install @dynatrace-sdk/client-notification-v2

Getting help

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

API reference

Full API reference for the latest version of the SDK is also available at the Dynatrace Developer.

eventNotificationsClient

import { eventNotificationsClient } from '@dynatrace-sdk/client-notification-v2';

createEventNotification

eventNotificationsClient.createEventNotification(config): Promise<EventNotification>

Required scope: notification:notifications:write

Parameters

NameType
config.body*requiredEventNotificationRequest

Returns

Return typeStatus codeDescription
EventNotification201

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { eventNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await eventNotificationsClient.createEventNotification({
    body: {
      resourceId: "...",
      notificationType: "...",
      triggerConfiguration: {
        type: "event",
        value: { query: "..." },
      },
    },
  });

deleteEventNotification

eventNotificationsClient.deleteEventNotification(config): Promise<void>

Required scope: notification:notifications:write

Parameters

NameTypeDescription
config.id*requiredstringA UUID string identifying this self notification.

Returns

Return typeStatus codeDescription
void204No response body

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { eventNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await eventNotificationsClient.deleteEventNotification({
    id: "...",
  });

getEventNotification

eventNotificationsClient.getEventNotification(config): Promise<EventNotification>

Required scope: notification:notifications:read

Parameters

NameTypeDescription
config.id*requiredstringA UUID string identifying this self notification.

Returns

Return typeStatus codeDescription
EventNotification200

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { eventNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await eventNotificationsClient.getEventNotification({
    id: "...",
  });

getEventNotifications

eventNotificationsClient.getEventNotifications(config): Promise<PaginatedEventNotificationList>

Required scope: notification:notifications:read

Parameters

NameTypeDescription
config.appIdstringApplication id associated with the notification. Optional, by default automatically inferred from the request header. Only relevant for manual testing purposes via swagger.
config.limitnumberNumber of results to return per page.
config.notificationTypestringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
config.offsetnumberThe initial index from which to return the results.
config.orderingstringWhich field to use when ordering the results.
config.ownerstring
config.resourceIdstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.
config.searchstringA search term.

Returns

Return typeStatus codeDescription
PaginatedEventNotificationList200

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { eventNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await eventNotificationsClient.getEventNotifications();

patchEventNotification

eventNotificationsClient.patchEventNotification(config): Promise<EventNotification>

Required scope: notification:notifications:write

Parameters

NameTypeDescription
config.body*requiredEventNotificationUpdate
config.id*requiredstringA UUID string identifying this self notification.

Returns

Return typeStatus codeDescription
EventNotification200

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { eventNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await eventNotificationsClient.patchEventNotification({
    id: "...",
    body: {
      triggerConfiguration: {
        type: "event",
        value: { query: "..." },
      },
    },
  });

updateEventNotification

eventNotificationsClient.updateEventNotification(config): Promise<EventNotification>

Required scope: notification:notifications:write

Parameters

NameTypeDescription
config.body*requiredEventNotificationUpdate
config.id*requiredstringA UUID string identifying this self notification.

Returns

Return typeStatus codeDescription
EventNotification200

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { eventNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await eventNotificationsClient.updateEventNotification({
    id: "...",
    body: {
      triggerConfiguration: {
        type: "event",
        value: { query: "..." },
      },
    },
  });

resourceNotificationsClient

import { resourceNotificationsClient } from '@dynatrace-sdk/client-notification-v2';

createResourceNotification

resourceNotificationsClient.createResourceNotification(config): Promise<ResourceNotification>

Required scope: notification:notifications:write

Parameters

NameType
config.body*requiredResourceNotificationRequest

Returns

Return typeStatus codeDescription
ResourceNotification201

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { resourceNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await resourceNotificationsClient.createResourceNotification(
    {
      body: { notificationType: "...", resourceId: "..." },
    },
  );

deleteResourceNotification

resourceNotificationsClient.deleteResourceNotification(config): Promise<void>

Required scope: notification:notifications:write

Parameters

NameTypeDescription
config.appIdstringApplication id associated with the notification. Optional, by default automatically inferred from the request header. Only relevant for manual testing purposes via swagger.
config.id*requiredstringA UUID string identifying this resource notification.

Returns

Return typeStatus codeDescription
void204No response body

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { resourceNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await resourceNotificationsClient.deleteResourceNotification(
    { id: "..." },
  );

deleteResourceNotificationByTypeAndResource

resourceNotificationsClient.deleteResourceNotificationByTypeAndResource(config): Promise<void>

Required scope: notification:notifications:write

Parameters

NameTypeDescription
config.appIdstringApplication id associated with the notification. Optional, by default automatically inferred from the request header. Only relevant for manual testing purposes via swagger.
config.notificationType*requiredstringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
config.resourceId*requiredstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.

Returns

Return typeStatus codeDescription
void204No response body

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { resourceNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await resourceNotificationsClient.deleteResourceNotificationByTypeAndResource(
    { notificationType: "...", resourceId: "..." },
  );

getResourceNotification

resourceNotificationsClient.getResourceNotification(config): Promise<ResourceNotification>

Required scope: notification:notifications:read

Parameters

NameTypeDescription
config.appIdstringApplication id associated with the notification. Optional, by default automatically inferred from the request header. Only relevant for manual testing purposes via swagger.
config.id*requiredstringA UUID string identifying this resource notification.

Returns

Return typeStatus codeDescription
ResourceNotification200

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { resourceNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await resourceNotificationsClient.getResourceNotification(
    { id: "..." },
  );

getResourceNotifications

resourceNotificationsClient.getResourceNotifications(config): Promise<PaginatedResourceNotificationList>

Required scope: notification:notifications:read

Parameters

NameTypeDescription
config.appIdstringApplication id associated with the notification. Optional, by default automatically inferred from the request header. Only relevant for manual testing purposes via swagger.
config.limitnumberNumber of results to return per page.
config.notificationTypestringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
config.offsetnumberThe initial index from which to return the results.
config.orderingstringWhich field to use when ordering the results.
config.resourceIdstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.
config.searchstringA search term.

Returns

Return typeStatus codeDescription
PaginatedResourceNotificationList200

Throws

Error TypeError Message
ErrorEnvelopeError
Code example
import { resourceNotificationsClient } from "@dynatrace-sdk/client-notification-v2";

const data =
  await resourceNotificationsClient.getResourceNotifications();

Types

DavisEventConfig

NameTypeDescription
customFilternull | stringAdditional DQL matcher expression to further filter events to match. default: ""
entityTagsnull | EntityTags
entityTagsMatchnull | "all" | "any"
maintenanceWindowTriggerBehavior"always" | "inside" | "outside"default: "always"
namesnull | Array<DavisEventName>
onProblemCloseDEPRECATEDbooleanTrigger on Davis event open only or also on close. Deprecated — use triggerOn instead. default: false
triggerOnnull | "open" | "open-and-close" | "close"Event state to trigger on. "open" (active only), "open-and-close" (both phases), or "close" (closure only). When unset, falls back to onProblemClose for backward compatibility.
typesDEPRECATEDnull | Array<string>

DavisEventName

NameTypeDescription
match*required"equals" | "contains"Davis event name must equal or contain the string provided.
name*requiredstring

DavisEventTriggerConfig

NameType
type*required"davis-event"
value*requiredDavisEventConfig

DavisProblemCategories

NameTypeDefault
availabilitybooleanfalse
custombooleanfalse
errorbooleanfalse
infobooleanfalse
monitoringUnavailablebooleanfalse
resourcebooleanfalse
slowdownbooleanfalse

DavisProblemConfig

NameTypeDescription
analysisReadybooleanRun only after first root cause analysis run completed. default: false
categories*requiredDavisProblemCategories
customFilternull | stringAdditional DQL matcher expression to further filter events to match. default: ""
entityTagsnull | EntityTags
entityTagsMatchnull | "all" | "any"
onProblemCloseDEPRECATEDbooleanTrigger on Davis problem open only or also on close. Deprecated — use triggerOn instead. default: false
problemOpenDurationnull | 5 | 10 | 15 | 30 | 60 | 120 | 240 | 1440 | 10080Minimum problem duration in minutes before the trigger fires.
severityThresholdnull | numberTriggers only for problems whose severity is this value or more severe. Lower numbers are more severe (1 = critical, 5 = informational), so 3 matches severities 1, 2, and 3.
triggerOnnull | "open" | "open-and-close" | "close"Problem state to trigger on. "open" (active only), "open-and-close" (both phases), or "close" (closure only). When unset, falls back to onProblemClose for backward compatibility.
triggerOnUpdateFieldsArray<"dt.davis.affected_users_count" | "dt.davis.impact_level" | "event.category" | "event.severity" | "root_cause_entity_id" | "smartscape.affected_entities">Problem event fields tracked for value changes. Changes to any selected field cause re-triggering.

DavisProblemTriggerConfig

NameType
type*required"davis-problem"
value*requiredDavisProblemConfig

EntityTags

Entity tags to match by key and (optional) values. For example {"foo": [], "bar": ["a", "b", "c"]}

type: Record<string, string | string[]>

Error

NameType
code*requirednumber
detailsErrorDetails
message*requiredstring

ErrorDetails

NameType
errorCodestring
errorRefstring

ErrorEnvelope

NameType
error*requiredError

EventNotification

NameTypeDescription
appIdstringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
id*requiredstring
inputEventNotificationInputInput object consisting of subject and content. Supports automation expressions https://dt-url.net/workflows-expression-reference and markdown syntax. A template provided with an app ({notification_type}.notification-template.json) will take precedence over the input provided here.
modificationInfo*requiredModificationInfo
notificationType*requiredstringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
owner*requiredstring
resourceId*requiredstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.
titlestring
triggerConfiguration*requiredEventTriggerConfig

EventNotificationInput

NameType
contentnull | string
subjectnull | string

EventNotificationRequest

NameTypeDescription
appIdstringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
idstring
inputEventNotificationInputInput object consisting of subject and content. Supports automation expressions https://dt-url.net/workflows-expression-reference and markdown syntax. A template provided with an app ({notification_type}.notification-template.json) will take precedence over the input provided here.
notificationType*requiredstringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
resourceId*requiredstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.
titlestring
triggerConfiguration*requiredEventTriggerConfig

EventNotificationUpdate

NameTypeDescription
appIdstringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
inputEventNotificationInputInput object consisting of subject and content. Supports automation expressions https://dt-url.net/workflows-expression-reference and markdown syntax. A template provided with an app ({notification_type}.notification-template.json) will take precedence over the input provided here.
notificationTypestringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
resourceIdstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.
titlestring
triggerConfigurationEventTriggerConfig

EventQuery

NameTypeDescription
eventType"events" | "bizevents" | "dt.system.events" | "security.events"Grail event type.
query*requiredstringDQL matcher expression defining which events to match.

EventQueryTriggerConfig

NameType
type*required"event"
value*requiredEventQuery

ModificationInfo

NameType
createdBy*requirednull | string
createdTime*requiredDate
lastModifiedBy*requirednull | string
lastModifiedTime*requiredDate

PaginatedEventNotificationList

NameType
count*requirednumber
results*requiredArray<EventNotification>

PaginatedResourceNotificationList

NameType
count*requirednumber
results*requiredArray<ResourceNotification>

ResourceNotification

NameTypeDescription
appIdnull | stringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
id*requiredstring
modificationInfo*requiredModificationInfo
notificationType*requiredstringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
owningUser*requiredstring
resourceId*requiredstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.

ResourceNotificationRequest

NameTypeDescription
appIdnull | stringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
notificationType*requiredstringString that defines the type of a notification in context of an app. Allows to differentiate between multiple types of notifications in context of one app.
resourceId*requiredstringUnique identifier of resource to notify on. Used to determine if there is a notification registered for a resource in context of the app and notification type for a user.

EventTriggerConfig

type: <a href="#eventquerytriggerconfig">EventQueryTriggerConfig</a> | <a href="#davisproblemtriggerconfig" target="_blank" rel="noopener noreferrer">DavisProblemTriggerConfig</a> | <a href="#daviseventtriggerconfig">DavisEventTriggerConfig</a>

Enums

DavisEventNameMatch

⚠️ Deprecated Use literal values.

Davis event name must equal or contain the string provided.

Enum keys

Contains | Equals

DavisEventTriggerConfigType

⚠️ Deprecated Use literal values.

Enum keys

DavisEvent

DavisProblemConfigProblemOpenDuration

⚠️ Deprecated Use literal values.

Minimum problem duration in minutes before the trigger fires.

Enum keys

DavisProblemConfigProblemOpenDuration_10 | DavisProblemConfigProblemOpenDuration_10080 | DavisProblemConfigProblemOpenDuration_120 | DavisProblemConfigProblemOpenDuration_1440 | DavisProblemConfigProblemOpenDuration_15 | DavisProblemConfigProblemOpenDuration_240 | DavisProblemConfigProblemOpenDuration_30 | DavisProblemConfigProblemOpenDuration_5 | DavisProblemConfigProblemOpenDuration_60

DavisProblemTriggerConfigType

⚠️ Deprecated Use literal values.

Enum keys

DavisProblem

EntityTagsMatch

⚠️ Deprecated Use literal values.

Event must match all or any of the entity tags.

Enum keys

All | Any

EventQueryTriggerConfigType

⚠️ Deprecated Use literal values.

Enum keys

Event

EventType

⚠️ Deprecated Use literal values.

Grail event type.

Enum keys

Bizevents | DtSystemEvents | Events | SecurityEvents

MaintenanceWindowTriggerBehaviorType

⚠️ Deprecated Use literal values.

Specifies when to trigger based on maintenance window status.

Enum keys

Always | Inside | Outside

TriggerOn

⚠️ Deprecated Use literal values.

Enum keys

Close | Open | OpenAndClose

TriggerOnUpdateFields

⚠️ Deprecated Use literal values.

Enum keys

DtDavisAffectedUsersCount | DtDavisImpactLevel | EventCategory | EventSeverity | RootCauseEntityId | SmartscapeAffectedEntities

版本与发布记录

@dynatrace-sdk/client-notification-v2 共发布 4 个版本,首次发布于 2025/08/12;过去 12 个月发布了 3 个版本。

版本发布日期距今
2.5.0latest2026/07/293 个月前
2.4.12026/06/304 个月前
2.2.02026/06/035 个月前
1.0.02025/08/121.3 年前

关于 @dynatrace-sdk/client-notification-v2 的常见问题

如何安装 @dynatrace-sdk/client-notification-v2?

在项目目录运行 npm install @dynatrace-sdk/client-notification-v2,或使用 pnpm add / yarn add / bun add。

@dynatrace-sdk/client-notification-v2 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dynatrace-sdk/client-notification-v2 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dynatrace-sdk/client-notification-v2 可以商用吗?

@dynatrace-sdk/client-notification-v2 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@dynatrace-sdk/client-notification-v2 的下载量有多少?

根据 npm 官方下载统计,@dynatrace-sdk/client-notification-v2 在 2026/10/13 – 2026/11/11 这 30 天内被下载 14,440 次,日均约 481 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dynatrace-sdk/client-notification-v2 还在维护吗?

最新版本 2.5.0 发布于 2026/07/29(3 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 3 个;首次发布于 2025/08/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。