Campaigns#
Group activities into campaigns for aggregate reporting.
List campaigns#
Retrieve a paginated list of campaigns for an organization.
typescript
const { items, totalCount, facets } = await bw.campaigns.list({
pageIndex: 0,
pageSize: 25,
organizationId: 'org_123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| pageIndex | integer | Required | Zero-based page index for pagination. |
| pageSize | integer | Required | Number of items per page (1-100). |
| organizationId | string (UUID) | Required | Organization identifier. |
| searchTerm | string | — | Free-text search term to filter results (max 200 characters). |
| sortBy | string | — | Column name to sort by. |
| sortDirection | 'asc' | 'desc' | — | Sort direction: ascending or descending. |
| status | 'active' | 'scheduled' | 'completed' | 'draft' | — | Filter by campaign status. |
| creatorId | string (UUID) | — | Filter by creator identifier. |
Response#
Returns { items, totalCount, facets } with paginated results.
Get campaign stats#
Aggregate statistics for campaigns matching the given filters.
typescript
const { data } = await bw.campaigns.stats({
organizationId: 'org_123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| organizationId | string (UUID) | Required | Organization identifier. |
| status | 'active' | 'scheduled' | 'completed' | 'draft' | — | Filter by campaign status. |
| creatorId | string (UUID) | — | Filter by creator identifier. |
| searchTerm | string | — | Free-text search term to filter results (max 200 characters). |
Response#
Returns { data } with the result.
Get campaign#
Retrieve a single campaign by ID with full details.
typescript
const { data } = await bw.campaigns({ id: 'abc-123' });Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | Campaign identifier. |
Response#
Returns { data } with the result.
Create campaign#
Create a new campaign.
typescript
const { data } = await bw.campaigns.create({
organizationId: 'org_123',
name: 'My Campaign',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| organizationId | string (UUID) | Required | Organization identifier. |
| name | string | Required | Campaign name. |
| startAt | string (ISO 8601) | null | — | Campaign start date. |
| endAt | string (ISO 8601) | null | — | Campaign end date. |
| budget | number | null | — | Total campaign budget (non-negative, max 1B). |
Response#
Returns { data } with the result.
Update campaign#
Update a campaign's details, status, budget, or dates.
typescript
const { data } = await bw.campaigns.update({
id: 'abc-123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | Campaign identifier to update. |
| name | string | — | Updated campaign name (1-255 characters). |
| startAt | string (ISO 8601) | null | — | Updated start date. |
| endAt | string (ISO 8601) | null | — | Updated end date. |
| budget | number | null | — | Updated budget (non-negative, max 1B). |
Response#
Returns { data } with the result.
Delete campaign#
Permanently delete a campaign and unlink all associated activities.
typescript
const { data } = await bw.campaigns.delete({
id: 'abc-123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | Campaign identifier to delete. |
Response#
Returns { data } with the result.
Destructive action
Deleting a campaign permanently removes the campaign and unlinks all associated activities. This action cannot be undone.
Link campaign activity#
Link an activity to a campaign.
typescript
const { data } = await bw.campaigns.activities.link({
campaignId: 'camp_abc123',
activityId: 'act_abc123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| campaignId | string (UUID) | Required | Campaign identifier to link the activity to. |
| activityId | string (UUID) | Required | Activity identifier to link. |
Response#
Returns { data } with the result.
Unlink campaign activity#
Unlink an activity from a campaign.
typescript
const { data } = await bw.campaigns.activities.unlink({
campaignActivityId: 'ca_abc123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| campaignActivityId | string (UUID) | Required | Campaign-activity association identifier to remove. |
Response#
Returns { data } with the result.