Skip to main content

Configuration

Client builder options

OptionRequiredDescription
apiKey(String)Your project's API key.
apiSecret(String)Your project's API secret, used to compute the HMAC signature.
baseUrl(String)Overrides the default production endpoint. Must be HTTPS unless the host is localhost. Trailing slash is stripped automatically.
NotificationHubClient client = new NotificationHubClient.Builder()
.apiKey("your-api-key")
.apiSecret("your-api-secret")
.build();

The client is safe to construct once and reuse — build a single instance and share it across your application rather than constructing one per request.

Spring Boot auto-configuration

The Java SDK includes NotificationHubAutoConfiguration, which registers a NotificationHubClient bean automatically when both notificationhub.api-key and notificationhub.api-secret are present in your Spring configuration.

application.yml
notificationhub:
api-key: ${NOTIFICATIONHUB_API_KEY}
api-secret: ${NOTIFICATIONHUB_API_SECRET}
# Optional — omit to use the production default
base-url: ${NOTIFICATIONHUB_BASE_URL}

With this in place, inject the client anywhere in your application:

@Service
public class WelcomeEmailService {

private final NotificationHubClient client;

public WelcomeEmailService(NotificationHubClient client) {
this.client = client;
}
}

This auto-configuration is specific to the Java SDK — the Node.js SDK is configured directly through the Builder, as shown above.