Message Building

The client.message() method provides a fluent API to construct notification payloads without worrying about provider-specific differences.

Usage

typescript
// Create a message using the fluent API
const message = client.message()
    .token('push-token')
    .title('Welcome!')
    .body('Thanks for signing up.')
    .data({ userId: '123' })
    .priority(MessagePriority.HIGH)
    .build();

// Send the message
await client.send(message);

Available Methods

MethodDescription
title(title: string)Sets the notification title.
body(body: string)Sets the notification body text.
data(data: Record<string, string>)Sets custom key-value data payload.
imageUrl(url: string)Sets a rich notification image URL.
priority(priority: MessagePriority)Sets delivery priority (HIGH/NORMAL).
build()Returns the formatted PushMessage object.