NotificationApiClient
com.notificationhub.sdk.client.NotificationApiClient — accessed via client.notifications().
Methods
send
NotificationResponse send(NotificationRequest request) throws NotificationHubException
Sends a notification. Equivalent to sendWithIdempotency(request, null).
sendWithIdempotency
NotificationResponse sendWithIdempotency(NotificationRequest request, UUID idempotencyKey) throws NotificationHubException
Sends a notification with a caller-supplied idempotency key so retries don't duplicate delivery. Sent as the Idempotency-Key header.
sendBulk
Map<String, Object> sendBulk(List<NotificationRequest> requests) throws NotificationHubException
Submits multiple notification requests in one call.
search
List<NotificationReceipt> search(ChannelType channel, String status, int limit, int offset) throws NotificationHubException
Lists notification receipts. channel and status are optional filters — pass null to omit either.
get
NotificationReceipt get(UUID notificationId) throws NotificationHubException
Fetches a single notification's receipt by ID.
getReceipts
Map<String, Object> getReceipts(UUID notificationId) throws NotificationHubException
Fetches the full receipt breakdown (e.g. per-channel dispatch detail) for a notification.
cancelSchedule
Map<String, String> cancelSchedule(UUID taskId) throws NotificationHubException
Cancels a previously scheduled (not-yet-sent) notification task.
trackOpen
byte[] trackOpen(UUID notificationId) throws NotificationHubException
Fetches the open-tracking pixel bytes. This request is unsigned — see Tracking.
Types
NotificationResponse (record)
| Field | Type |
|---|---|
notificationId | UUID |
idempotencyKey | UUID |
status | String |
dispatchedChannels | List<Map<String, String>> |
NotificationReceipt (record)
| Field | Type |
|---|---|
notificationId | UUID |
tenantId | String |
channel | String |
currentStatus | String |
firstOpenedAt | Instant |
lastOpenedAt | Instant |
openCount | int |
createdAt | Instant |
updatedAt | Instant |
clickCount | int |
lastClickedAt | Instant |
NotificationRequest.Builder
| Method | Description |
|---|---|
addChannel(ChannelType channel) | Adds a dispatch channel. Call once per channel. |
toEmail(String email) | Sets the email recipient. |
toPhone(String phone) | Sets the SMS recipient. |
toWebhook(String url) | Sets the webhook target URL. |
toPushToken(String token) | Sets a device push token target. |
toPushTopic(String topic) | Sets a push topic target. |
toInApp(String userId) | Sets the in-app recipient user ID. |
withMediaUrl(String imageUrl) | Attaches a media/image URL. |
withActionUrl(String actionUrl) | Attaches an action URL. |
templateId(String templateId) | Renders content from a saved template. |
subject(String subject) | Inline subject (email/push). |
message(String message) | Inline message body. |
addVariable(String key, Object value) | Adds a template/render variable. |
scheduleFor(Instant scheduledFor) | Defers delivery to a future time. |
build() | Returns a NotificationRequest. Throws IllegalStateException if no channel was added. |
Throws
All methods throw NotificationHubException (or a typed subclass) on a non-2xx response — see Exceptions.