novu-java sdk: Trigger workflow to a topic
Using Java, how can i trigger workflow to a topic? Any Novu Java documentation that I can refer to? Thank you!
4 Replies
Hi @Mandy, I'm an AI assistant for Novu. While a team member reviews this question, I'll look through relevant sources and see if I can provide suggestions. Please tag @Ask Inkeep with any follow-up questions.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* Java
* Workflows
* General
* Get workflow
-----------------------------
Answer
To trigger a workflow to a topic using the Novu Java SDK, you'll generally follow these steps:
1. Ensure you've set up the Novu Java SDK in your project. This involves adding the dependency to your
pom.xml
or build.gradle
file and initializing the Novu
class with your API key (1) .
2. After setting up the SDK and creating your notification workflow and topic in the Novu dashboard, you'll utilize the SDK to trigger notifications to the topic. Although the exact method to trigger a notification to a topic wasn't explicitly detailed in the provided documentation excerpts, triggering a workflow typically involves creating a TriggerEventRequest
object and setting the appropriate details (such as the event name and subscriber information) before calling a method like novu.triggerEvent(triggerEventRequest)
.
For topics specifically, after your topic is created via the Novu dashboard or API, you'd trigger notifications to all subscribers of the topic by referencing the topic's unique identifier in your trigger event request. However, the exact Java SDK code snippet for triggering to a topic was not provided in the documents.
3. The provided documents do not directly include a Java code example for sending notifications to a topic. It emphasizes the need to first create a topic and then mentions that a topic allows sending notifications to multiple subscribers at once. The API for triggering notifications to topics typically involves specifying the topic identifier instead of individual subscriber identifiers.
Please refer to the official Novu documentation and Java SDK GitHub repository for the most current information and examples related to triggering notifications to topics. The specific syntax for doing so would depend on the methods available in the Novu Java SDK at the time of your implementation.
For comprehensive steps and more details on using the Novu Java SDK, including setting up your project, creating subscribers, and sending notifications, please refer to the Novu documentation.
Got it. Tagging @Support for additional help.
@Mandy
Apologies we are missing the triggering to topic example
I am checking with maintainer for an example