Skip to main content

    Notification

    Manage self notifications with the Notification Service API.

    npm install @dynatrace-sdk/client-notification

    selfNotificationsClient

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

    createSelfNotification

    selfNotificationsClient.createSelfNotification(config): Promise<SelfNotification>

    Required scope: notification:self-notifications:write

    Parameters

    NameType
    config.body*requiredSelfNotificationCreate

    Returns

    Return typeStatus codeDescription
    SelfNotification201

    Throws

    Error TypeError Message
    ErrorEnvelopeError

    Code example

    import { selfNotificationsClient } from "@dynatrace-sdk/client-notification";

    const data =
    await selfNotificationsClient.createSelfNotification({
    body: {
    resourceId: "...",
    notificationType: "...",
    triggerConfiguration: {
    type: EventQueryTriggerConfigType.Event,
    value: { query: "..." },
    },
    },
    });

    deleteSelfNotification

    selfNotificationsClient.deleteSelfNotification(config): Promise<void>

    Required scope: notification:self-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 { selfNotificationsClient } from "@dynatrace-sdk/client-notification";

    const data =
    await selfNotificationsClient.deleteSelfNotification({
    id: "...",
    });

    getSelfNotification

    selfNotificationsClient.getSelfNotification(config): Promise<SelfNotification>

    Required scope: notification:self-notifications:read

    Parameters

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

    Returns

    Return typeStatus codeDescription
    SelfNotification200

    Throws

    Error TypeError Message
    ErrorEnvelopeError

    Code example

    import { selfNotificationsClient } from "@dynatrace-sdk/client-notification";

    const data =
    await selfNotificationsClient.getSelfNotification({
    id: "...",
    });

    getSelfNotifications

    selfNotificationsClient.getSelfNotifications(config): Promise<PaginatedSelfNotificationList>

    Required scope: notification:self-notifications:read

    Parameters

    NameTypeDescription
    config.appIdstring
    config.limitnumberNumber of results to return per page.
    config.notificationTypestring
    config.offsetnumberThe initial index from which to return the results.
    config.orderingstringWhich field to use when ordering the results.
    config.ownerstring
    config.resourceIdstring
    config.searchstringA search term.

    Returns

    Return typeStatus codeDescription
    PaginatedSelfNotificationList200

    Throws

    Error TypeError Message
    ErrorEnvelopeError

    Code example

    import { selfNotificationsClient } from "@dynatrace-sdk/client-notification";

    const data =
    await selfNotificationsClient.getSelfNotifications();

    patchSelfNotification

    selfNotificationsClient.patchSelfNotification(config): Promise<SelfNotification>

    Required scope: notification:self-notifications:write

    Parameters

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

    Returns

    Return typeStatus codeDescription
    SelfNotification200

    Throws

    Error TypeError Message
    ErrorEnvelopeError

    Code example

    import { selfNotificationsClient } from "@dynatrace-sdk/client-notification";

    const data =
    await selfNotificationsClient.patchSelfNotification({
    id: "...",
    body: {
    triggerConfiguration: {
    type: EventQueryTriggerConfigType.Event,
    value: { query: "..." },
    },
    },
    });

    updateSelfNotification

    selfNotificationsClient.updateSelfNotification(config): Promise<SelfNotification>

    Required scope: notification:self-notifications:write

    Parameters

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

    Returns

    Return typeStatus codeDescription
    SelfNotification200

    Throws

    Error TypeError Message
    ErrorEnvelopeError

    Code example

    import { selfNotificationsClient } from "@dynatrace-sdk/client-notification";

    const data =
    await selfNotificationsClient.updateSelfNotification({
    id: "...",
    body: {
    triggerConfiguration: {
    type: EventQueryTriggerConfigType.Event,
    value: { query: "..." },
    },
    },
    });

    Types

    DavisEventConfig

    NameTypeDescription
    customFilterstringAdditional DQL matcher expression to further filter events to match.
    entityTagsEntityTagsEntity tags to match by key and (optional) values. For example {"foo": [], "bar": ["a", "b", "c"]}
    entityTagsMatch"all" | "any"Event must match all or any of the entity tags.
    namesArray<DavisEventName>
    onProblemClosebooleanTrigger on Davis event open only or also on close. default: false
    typesDEPRECATEDArray<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

    NameType
    availabilityboolean
    customboolean
    errorboolean
    infoboolean
    monitoringUnavailableboolean
    resourceboolean
    slowdownboolean

    DavisProblemConfig

    NameTypeDescription
    categories*requiredDavisProblemCategories
    customFilterstringAdditional DQL matcher expression to further filter events to match.
    entityTagsEntityTagsEntity tags to match by key and (optional) values. For example {"foo": [], "bar": ["a", "b", "c"]}
    entityTagsMatch"all" | "any"Event must match all or any of the entity tags.
    onProblemClosebooleanTrigger on Davis problem open only or also on close. default: false

    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[] | undefined>

    Error

    NameType
    code*requirednumber
    detailsErrorDetails
    message*requiredstring

    ErrorDetails

    type: Record<string, any>

    ErrorEnvelope

    NameType
    error*requiredError

    EventQuery

    NameTypeDescription
    eventType"events" | "bizevents" | "dt.system.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

    PaginatedSelfNotificationList

    NameType
    count*requirednumber
    results*requiredArray<SelfNotification>

    SelfNotification

    NameTypeDescription
    appIdstringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
    id*requiredstring
    inputSelfNotificationInputSelfNotificationInput 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

    SelfNotificationCreate

    NameTypeDescription
    appIdstringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
    idstring
    inputSelfNotificationInputSelfNotificationInput 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

    SelfNotificationInput

    NameType
    contentstring
    subjectstring

    SelfNotificationUpdate

    NameTypeDescription
    appIdstringApp id for registered notification. Optional, by default automatically inferred from the request. Only relevant for manual testing purposes via swagger.
    inputSelfNotificationInputSelfNotificationInput 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
    triggerConfiguration*requiredEventTriggerConfig

    Enums

    DavisEventNameMatch

    Davis event name must equal or contain the string provided.

    Enum keys

    Contains | Equals

    DavisEventTriggerConfigType

    Enum keys

    DavisEvent

    DavisProblemTriggerConfigType

    Enum keys

    DavisProblem

    EntityTagsMatch

    Event must match all or any of the entity tags.

    Enum keys

    All | Any

    EventQueryTriggerConfigType

    Enum keys

    Event

    EventType

    Grail event type.

    Enum keys

    Bizevents | DtSystemEvents | Events

    Still have questions?
    Find answers in the Dynatrace Community