fastify-xwhatconverts
leads.list
List WhatConverts leads with optional filtering by type, status, date range, and account.
leads.list
List leads with optional filters. Returns a paginated result from the WhatConverts API.
Signature
fastify.xwhatconverts.leads.list(params?: {
leadsPerPage?: number;
pageNumber?: number;
accountId?: string;
profileId?: string;
leadType?: "phone_call" | "form" | "chat" | "transaction";
leadStatus?: "unique" | "repeat";
startDate?: string;
endDate?: string;
order?: "asc" | "desc";
quotable?: boolean;
spam?: boolean;
duplicate?: boolean;
}): Promise<object>
Params
| Name | Type | Required | Description |
|---|---|---|---|
leadsPerPage | number | No | Results per page. Default 25, max 250. |
pageNumber | number | No | Page number for pagination. |
accountId | string | No | Filter by account ID. |
profileId | string | No | Filter by profile ID. |
leadType | string | No | Filter by type: phone_call, form, chat, transaction. |
leadStatus | string | No | Filter by status: unique or repeat. |
startDate | string | No | Start date in YYYY-MM-DD format. |
endDate | string | No | End date in YYYY-MM-DD format. |
order | string | No | Sort order: asc or desc. |
quotable | boolean | No | Filter by quotable status. |
spam | boolean | No | Filter by spam status. |
duplicate | boolean | No | Filter by duplicate status. |
Returns
A paginated WhatConverts leads response object containing a leads array and pagination metadata.
Throws
[xWhatConverts] Network error: <message>— network-level failure.[xWhatConverts] API error: <status>— non-2xx HTTP response from WhatConverts.
Examples
Basic — list all leads
const result = await fastify.xwhatconverts.leads.list();
console.log(result.leads); // array of lead objects
Realistic — paginate phone call leads by date range
fastify.get("/leads", async (request) => {
const { page = 1, startDate, endDate } = request.query;
const result = await fastify.xwhatconverts.leads.list({
leadType: "phone_call",
leadStatus: "unique",
startDate,
endDate,
pageNumber: page,
leadsPerPage: 100,
order: "desc",
});
return {
leads: result.leads,
total: result.total_leads,
page: result.page_number,
};
});
See Also
- leads.get — fetch a single lead by ID
- leads.create — create a new lead
AI Context
package: "@xenterprises/fastify-xwhatconverts"
method: fastify.xwhatconverts.leads.list(params?)
use-when: List WhatConverts leads with optional filters — date range, lead type, search, profile, pagination
params: profileId, startDate, endDate, leadType, searchQuery, page, perPage, customerJourney
returns: { leads: array, totalLeads: number }
