Notification Types

The jxpush library uses a universal message format that is mapped to specific provider payloads automatically.

PushMessage

The main interface for sending a message.

typescript
interface PushMessage {
    // Targeting
    token?: string | string[]; // Single token or array of tokens
    topic?: string;            // Alternatively, target a topic

    // Content
    notification?: NotificationPayload;
    data?: Record<string, string>; // Custom key-value pairs

    // Delivery options
    priority?: MessagePriority; // HIGH or NORMAL
    ttl?: number;               // Time to live in seconds
}

NotificationPayload

The visual content of the notification.

typescript
interface NotificationPayload {
    title: string;
    body: string;
    imageUrl?: string;  // Rich notification image
    badge?: number;     // App icon badge count
    sound?: string;     // Sound file name or 'default'
    clickAction?: string; // Deep link or intent
    channelId?: string;   // Android notification channel
}