Skip to content

Latest commit

 

History

History
356 lines (275 loc) · 15.1 KB

README.md

File metadata and controls

356 lines (275 loc) · 15.1 KB

Workflows

(workflows())

Overview

All notifications are sent via a workflow. Each workflow acts as a container for the logic and blueprint that are associated with a type of notification in your system.

https://docs.novu.co/workflows

Available Operations

create

Workflow was previously named notification template

Example Usage

package hello.world;

import co.novu.co.novu.sdk.Novu;
import co.novu.co.novu.sdk.models.components.*;
import co.novu.co.novu.sdk.models.components.Security;
import co.novu.co.novu.sdk.models.operations.*;
import co.novu.co.novu.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Novu sdk = Novu.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .build();

            CreateWorkflowRequestDto req = CreateWorkflowRequestDto.builder()
                .name("<value>")
                .notificationGroupId("<value>")
                .steps(java.util.List.of(
                        NotificationStep.builder()
                            .build()))
                .build();

            WorkflowControllerCreateResponse res = sdk.workflows().create()
                .request(req)
                .call();

            if (res.workflowResponse().isPresent()) {
                // handle response
            }
        } catch (co.novu.co.novu.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

Parameter Type Required Description
request co.novu.co.novu.sdk.models.components.CreateWorkflowRequestDto ✔️ The request object to use for the request.

Response

Optional<? extends co.novu.co.novu.sdk.models.operations.WorkflowControllerCreateResponse>

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx /

delete

Workflow was previously named notification template

Example Usage

package hello.world;

import co.novu.co.novu.sdk.Novu;
import co.novu.co.novu.sdk.models.components.*;
import co.novu.co.novu.sdk.models.components.Security;
import co.novu.co.novu.sdk.models.operations.*;
import co.novu.co.novu.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Novu sdk = Novu.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .build();

            WorkflowControllerDeleteWorkflowByIdResponse res = sdk.workflows().delete()
                .workflowId("<value>")
                .call();

            if (res.dataBooleanDto().isPresent()) {
                // handle response
            }
        } catch (co.novu.co.novu.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

Parameter Type Required Description
workflowId String ✔️ N/A

Response

Optional<? extends co.novu.co.novu.sdk.models.operations.WorkflowControllerDeleteWorkflowByIdResponse>

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx /

list

Workflows were previously named notification templates

Example Usage

package hello.world;

import co.novu.co.novu.sdk.Novu;
import co.novu.co.novu.sdk.models.components.*;
import co.novu.co.novu.sdk.models.components.Security;
import co.novu.co.novu.sdk.models.operations.*;
import co.novu.co.novu.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Novu sdk = Novu.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .build();

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

            WorkflowControllerListWorkflowsResponse res = sdk.workflows().list()
                .request(req)
                .call();

            if (res.workflowsResponseDto().isPresent()) {
                // handle response
            }
        } catch (co.novu.co.novu.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

Parameter Type Required Description
request co.novu.co.novu.sdk.models.operations.WorkflowControllerListWorkflowsRequest ✔️ The request object to use for the request.

Response

Optional<? extends co.novu.co.novu.sdk.models.operations.WorkflowControllerListWorkflowsResponse>

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx /

retrieve

Workflow was previously named notification template

Example Usage

package hello.world;

import co.novu.co.novu.sdk.Novu;
import co.novu.co.novu.sdk.models.components.*;
import co.novu.co.novu.sdk.models.components.Security;
import co.novu.co.novu.sdk.models.operations.*;
import co.novu.co.novu.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Novu sdk = Novu.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .build();

            WorkflowControllerGetWorkflowByIdResponse res = sdk.workflows().retrieve()
                .workflowId("<value>")
                .call();

            if (res.workflowResponse().isPresent()) {
                // handle response
            }
        } catch (co.novu.co.novu.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

Parameter Type Required Description
workflowId String ✔️ N/A

Response

Optional<? extends co.novu.co.novu.sdk.models.operations.WorkflowControllerGetWorkflowByIdResponse>

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx /

update

Workflow was previously named notification template

Example Usage

package hello.world;

import co.novu.co.novu.sdk.Novu;
import co.novu.co.novu.sdk.models.components.*;
import co.novu.co.novu.sdk.models.components.Security;
import co.novu.co.novu.sdk.models.operations.*;
import co.novu.co.novu.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Novu sdk = Novu.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .build();

            WorkflowControllerUpdateWorkflowByIdResponse res = sdk.workflows().update()
                .workflowId("<value>")
                .updateWorkflowRequestDto(UpdateWorkflowRequestDto.builder()
                    .name("<value>")
                    .notificationGroupId("<value>")
                    .build())
                .call();

            if (res.workflowResponse().isPresent()) {
                // handle response
            }
        } catch (co.novu.co.novu.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Parameters

Parameter Type Required Description
workflowId String ✔️ N/A
updateWorkflowRequestDto co.novu.co.novu.sdk.models.components.UpdateWorkflowRequestDto ✔️ N/A

Response

Optional<? extends co.novu.co.novu.sdk.models.operations.WorkflowControllerUpdateWorkflowByIdResponse>

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx /