import { APIResource } from "../../core/resource.js"; import * as BroadcastsAPI from "./broadcasts.js"; import { BroadcastContactsCursor } from "./broadcasts.js"; import { APIPromise } from "../../core/api-promise.js"; import { type CursorParams, PagePromise } from "../../core/pagination.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class Contacts extends APIResource { /** * List contacts in a broadcast with optional status filter. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const broadcastContact of client.broadcasts.contacts.list( * 'broadcastId', * )) { * // ... * } * ``` */ list(broadcastID: string, query?: ContactListParams | null | undefined, options?: RequestOptions): PagePromise; /** * Add contacts to a broadcast in batch. Maximum 1000 contacts per request. * * @example * ```ts * const response = await client.broadcasts.contacts.add( * 'broadcastId', * { * contacts: [ * { * recipient: '+14155551234', * templateVariables: { * name: 'John', * order_id: 'ORD-001', * }, * }, * { * recipient: '+14155555678', * templateVariables: { * name: 'Jane', * order_id: 'ORD-002', * }, * }, * ], * }, * ); * ``` */ add(broadcastID: string, body: ContactAddParams, options?: RequestOptions): APIPromise; /** * Remove a contact from a broadcast in draft status. * * @example * ```ts * await client.broadcasts.contacts.remove('contactId', { * broadcastId: 'broadcastId', * }); * ``` */ remove(contactID: string, params: ContactRemoveParams, options?: RequestOptions): APIPromise; } export interface ContactAddResponse { /** * Number of contacts successfully added. */ added: number; /** * Number of duplicate contacts skipped. */ duplicates: number; /** * Number of invalid contacts rejected. */ invalid: number; /** * Details about invalid contacts. */ errors?: Array; } export declare namespace ContactAddResponse { interface Error { reason?: string; recipient?: string; } } export interface ContactListParams extends CursorParams { /** * Status of a contact within a broadcast. */ status?: BroadcastsAPI.BroadcastContactStatus; } export interface ContactAddParams { /** * List of contacts to add (max 1000 per request). */ contacts: Array; } export declare namespace ContactAddParams { interface Contact { /** * Phone number (E.164) or email address. */ recipient: string; /** * Per-contact button variables for dynamic URL/OTP buttons. Keys are the button * index (0, 1, 2). */ templateButtonVariables?: { [key: string]: string; }; /** * Per-contact value for a text-header variable, keyed by `1`. If omitted, Zavu * resolves the header from `templateVariables` by the header placeholder's name. */ templateHeaderVariables?: { [key: string]: string; }; /** * Per-contact body variables. Key them to match the template body: by position * (`1`, `2`, ...) for positional templates, or by name (e.g. `customer_name`) for * named templates. Zavu detects the template's format and sends the correct * payload to Meta. Do not mix positional and named keys. */ templateVariables?: { [key: string]: string; }; } } export interface ContactRemoveParams { broadcastId: string; } export declare namespace Contacts { export { type ContactAddResponse as ContactAddResponse, type ContactListParams as ContactListParams, type ContactAddParams as ContactAddParams, type ContactRemoveParams as ContactRemoveParams, }; } export { type BroadcastContactsCursor }; //# sourceMappingURL=contacts.d.ts.map