Campaigns#
Group activities into campaigns for aggregate reporting.
Provider required
BrandwaveProvider ancestor in your component tree. See the React Hooks overview for setup instructions.useListCampaigns#
Retrieve a paginated list of campaigns for an organization.
import { useListCampaigns } from '@brandwave/react';
const { data, isLoading } = useListCampaigns({
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.
Underlying SDK method: bw.campaigns.list(params)
useCampaignStats#
Aggregate statistics for campaigns matching the given filters.
import { useCampaignStats } from '@brandwave/react';
const { data, isLoading } = useCampaignStats({
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.
Underlying SDK method: bw.campaigns.stats(params)
useCampaign#
Retrieve a single campaign by ID with full details.
import { useCampaign } from '@brandwave/react';
const { data, isLoading } = useCampaign({
id: 'abc-123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | Campaign identifier. |
Response#
Returns { data } with the result.
Underlying SDK method: bw.campaigns({ id })
useCreateCampaign#
Create a new campaign.
import { useCreateCampaign } from '@brandwave/react';
const { mutate, isPending } = useCreateCampaign();
mutate({
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.
Underlying SDK method: bw.campaigns.create(params)
useUpdateCampaign#
Update a campaign's details, status, budget, or dates.
import { useUpdateCampaign } from '@brandwave/react';
const { mutate, isPending } = useUpdateCampaign();
mutate({
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.
Underlying SDK method: bw.campaigns.update(params)
useDeleteCampaign#
Permanently delete a campaign and unlink all associated activities.
import { useDeleteCampaign } from '@brandwave/react';
const { mutate, isPending } = useDeleteCampaign();
mutate({
id: 'abc-123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | Campaign identifier to delete. |
Response#
Returns { data } with the result.
Underlying SDK method: bw.campaigns.delete(params)
Destructive action
useLinkCampaignActivity#
Link an activity to a campaign.
import { useLinkCampaignActivity } from '@brandwave/react';
const { mutate, isPending } = useLinkCampaignActivity();
mutate({
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.
Underlying SDK method: bw.campaigns.activities.link(params)
useUnlinkCampaignActivity#
Unlink an activity from a campaign.
import { useUnlinkCampaignActivity } from '@brandwave/react';
const { mutate, isPending } = useUnlinkCampaignActivity();
mutate({
campaignActivityId: 'ca_abc123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| campaignActivityId | string (UUID) | Required | Campaign-activity association identifier to remove. |
Response#
Returns { data } with the result.
Underlying SDK method: bw.campaigns.activities.unlink(params)