notiflowsDocs
SDKsServer-side

Java

Notiflows Java SDK for server-side integration

The Java SDK is coming soon. In the meantime, you can use the REST API directly.

Preview

The Java SDK will provide a simple interface for triggering notiflows and managing users:

import com.notiflows.Client;
import com.notiflows.Recipient;
import java.util.List;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        var client = new Client("your-secret-key");

        // Trigger a notiflow
        client.notify(
            "welcome-email",
            List.of(new Recipient("user_123")),
            Map.of("name", "Jane")
        );

        // Manage users
        client.users().upsert("user_123", Map.of(
            "email", "jane@example.com",
            "first_name", "Jane"
        ));

        // Subscribe to topics
        client.users().subscribe("user_123", "product-updates");
    }
}

Installation (Coming Soon)

Maven:

<dependency>
    <groupId>com.notiflows</groupId>
    <artifactId>notiflows-java</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle:

implementation 'com.notiflows:notiflows-java:1.0.0'

Using the REST API

Until the SDK is available, you can interact with the API directly:

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        var client = HttpClient.newHttpClient();

        var body = """
            {
                "recipients": [{"external_id": "user_123"}],
                "data": {"name": "Jane"}
            }
            """;

        var request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.notiflows.com/admin/v1/notiflows/welcome-email/run"))
            .header("Authorization", "Bearer your-secret-key")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();

        var response = client.send(request, HttpResponse.BodyHandlers.ofString());
    }
}

See the Admin API Reference for complete documentation.

On this page