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: '1c7743a8-6410-4a9e-9f3b-2c1d5e8a4b01',
});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: '1c7743a8-6410-4a9e-9f3b-2c1d5e8a4b01',
});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: 'e2d4a6b8-0c1f-4e3a-95d7-8b6c4a2e0f06' });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: '1c7743a8-6410-4a9e-9f3b-2c1d5e8a4b01',
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: 'e2d4a6b8-0c1f-4e3a-95d7-8b6c4a2e0f06',
});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: 'e2d4a6b8-0c1f-4e3a-95d7-8b6c4a2e0f06',
});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: '3a8d1f56-9e42-4b7c-a1d8-6f0e2b9c4a03',
activityId: '7f2e9b34-5c81-4d6a-8e07-9a3b1c5d2f02',
});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: '2d8b6f43-9a17-4e5c-b7d0-3f9a1c6e8d10',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| campaignActivityId | string (UUID) | Required | Campaign-activity association identifier to remove. |
Response#
Returns { data } with the result.