Skip to content

Latest commit

 

History

History
128 lines (92 loc) · 6.87 KB

File metadata and controls

128 lines (92 loc) · 6.87 KB

Notifications

Overview

Available Operations

  • list - List all events
  • get - Retrieve an event

list

List all notification events (triggered events) for the current environment. This API supports filtering by channels, templates, emails, subscriberIds, transactionId, topicKey, severity, contextKeys. Checkout all available filters in the query section. This API returns event triggers, to list each channel notifications, check messages APIs.

Example Usage

package hello.world;

import co.novu.Novu;
import co.novu.models.errors.ErrorDto;
import co.novu.models.errors.ValidationErrorDto;
import co.novu.models.operations.NotificationsControllerListNotificationsRequest;
import co.novu.models.operations.NotificationsControllerListNotificationsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorDto, ValidationErrorDto, Exception {

        Novu sdk = Novu.builder()
                .secretKey("YOUR_SECRET_KEY_HERE")
            .build();

        NotificationsControllerListNotificationsRequest req = NotificationsControllerListNotificationsRequest.builder()
                .build();

        NotificationsControllerListNotificationsResponse res = sdk.notifications().list()
                .request(req)
                .call();

        if (res.activitiesResponseDto().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request NotificationsControllerListNotificationsRequest ✔️ The request object to use for the request.

Response

NotificationsControllerListNotificationsResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorDto 414 application/json
models/errors/ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
models/errors/ValidationErrorDto 422 application/json
models/errors/ErrorDto 500 application/json
models/errors/APIException 4XX, 5XX */*

get

Retrieve an event by its unique key identifier notificationId. Here notificationId is of mongodbId type. This API returns the event details - execution logs, status, actual notification (message) generated by each workflow step.

Example Usage

package hello.world;

import co.novu.Novu;
import co.novu.models.errors.ErrorDto;
import co.novu.models.errors.ValidationErrorDto;
import co.novu.models.operations.NotificationsControllerGetNotificationResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorDto, ValidationErrorDto, Exception {

        Novu sdk = Novu.builder()
                .secretKey("YOUR_SECRET_KEY_HERE")
            .build();

        NotificationsControllerGetNotificationResponse res = sdk.notifications().get()
                .notificationId("<id>")
                .call();

        if (res.activityNotificationResponseDto().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
notificationId String ✔️ N/A
idempotencyKey Optional<String> A header for idempotency purposes

Response

NotificationsControllerGetNotificationResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorDto 414 application/json
models/errors/ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
models/errors/ValidationErrorDto 422 application/json
models/errors/ErrorDto 500 application/json
models/errors/APIException 4XX, 5XX */*