/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
docs/platform/sdks/server/java.mdx
122 строки
4 KB
mintlify[bot]
docs(docs): Apply SEO and metadata best practices (#11903)
13 июл 2026, 11:22
Не верифицирован
13 июл 2026, 11:22
01f36ae
Код
Авторство
О чём код?
--- title: 'Java' description: "Connect a Java application to Novu with the official server SDK to trigger workflows, manage subscribers, and send notifications from JVM code." --- Novu's Java SDK provides simple, yet comprehensive notification management, and delivery capabilities through multiple channels that you can implement using code that integrates seamlessly with your Java application. [Explore the source code on GitHub.](https://github.com/novuhq/novu-java) ## Installation JDK 11 or later is required. Maven users: ```xml <dependency> <groupId>co.novu</groupId> <artifactId>novu-java</artifactId> <version>LATEST</version> </dependency> ``` The latest version can be found [on GitHub.](https://github.com/novuhq/novu-java#sdk-installation) Gradle users: ```groovy implementation 'co.novu:novu-java:LATEST' ``` Sync your project, and you should have the artifacts downloaded. ## Usage <Tabs> <Tab title="US Region"> ```java package hello.world; import co.novu.Novu; import co.novu.models.components.*; import co.novu.models.errors.*; import co.novu.models.operations.EventsControllerTriggerResponse; import java.lang.Exception; import java.util.Map; public class Application { public static void main(String[] args) throws PayloadValidationExceptionDto, ErrorDto, ValidationErrorDto, Exception { Novu sdk = Novu.builder() .secretKey("YOUR_SECRET_KEY_HERE") .build(); EventsControllerTriggerResponse res = sdk.trigger() .body(TriggerEventRequestDto.builder() .workflowId("workflow_identifier") .to(To2.of("SUBSCRIBER_ID")) .payload(Map.ofEntries( Map.entry("comment_id", "string"), Map.entry("post", Map.ofEntries( Map.entry("text", "string"))))) .overrides(TriggerEventRequestDtoOverrides.builder() .build()) .actor(TriggerEventRequestDtoActor.of("<value>")) .context(Map.ofEntries( Map.entry("tenant", TriggerEventRequestDtoContextUnion.of("org-acme")))) .build()) .call(); if (res.triggerEventResponseDto().isPresent()) { // handle response } } } ``` </Tab> <Tab title="EU Region"> ```java package hello.world; import co.novu.Novu; import co.novu.models.components.*; import co.novu.models.errors.*; import co.novu.models.operations.EventsControllerTriggerResponse; import java.lang.Exception; import java.util.Map; public class Application { public static void main(String[] args) throws PayloadValidationExceptionDto, ErrorDto, ValidationErrorDto, Exception { Novu sdk = Novu.builder() .serverUrl("https://eu.api.novu.co") .secretKey("YOUR_SECRET_KEY_HERE") .build(); EventsControllerTriggerResponse res = sdk.trigger() .body(TriggerEventRequestDto.builder() .workflowId("workflow_identifier") .to(To2.of("SUBSCRIBER_ID")) .payload(Map.ofEntries( Map.entry("comment_id", "string"), Map.entry("post", Map.ofEntries( Map.entry("text", "string"))))) .overrides(TriggerEventRequestDtoOverrides.builder() .build()) .actor(TriggerEventRequestDtoActor.of("<value>")) .context(Map.ofEntries( Map.entry("tenant", TriggerEventRequestDtoContextUnion.of("org-acme")))) .build()) .call(); if (res.triggerEventResponseDto().isPresent()) { // handle response } } } ``` </Tab> </Tabs>