magicbell
Version:
MagicBell API wrapper
56 lines • 2.17 kB
JavaScript
// This file is generated. Do not update manually!
import { Resource } from '../client/resource.js';
import { BroadcastsNotifications } from './broadcasts/notifications.js';
export class Broadcasts extends Resource {
path = 'broadcasts';
entity = 'broadcast';
notifications = new BroadcastsNotifications(this.client);
/**
* Create a broadcast to send notifications to upto a 1,000 recipients - users or
* topic subscribers. You can identify users by their email address or by an
* external_id.
*
* You don't have to import your users into MagicBell. If a user does not exist
* we'll create it automatically.
*
* You can send user attributes like first_name, custom_attributes, and more when
* creating a broadcast.
*
* A new notification will be shown in the inbox of each recipient in real-time. It
* will also be delivered to each recipient through all channels you have enabled
* for your project.
*
* @param data
* @param options - override client request options.
* @returns A broadcast is a precursor to a notification. When you specify multiple
* recipients, MagicBell creates a notification for each recipient and delivers it
* to them based on their preferences.
**/
create(data, options) {
return this.request({
method: 'POST',
}, data, options);
}
list(dataOrOptions, options) {
return this.request({
method: 'GET',
paged: true,
}, dataOrOptions, options);
}
/**
* Fetch a broadcast by its ID.
*
* @param broadcastId - ID of the broadcast.
* @param options - override client request options.
* @returns A broadcast is a precursor to a notification. When you specify multiple
* recipients, MagicBell creates a notification for each recipient and delivers it
* to them based on their preferences.
**/
get(broadcastId, options) {
return this.request({
method: 'GET',
path: '{broadcast_id}',
}, broadcastId, options);
}
}
//# sourceMappingURL=broadcasts.js.map