Skip to content
You are reading the unreleased documentation. No version is released yet, and these pages describe code that is not in a release.

Campaigns (admin API)

Admin routes of the campaigns module. Every route needs a staff session and the permission named on it; send X-Resolve-Locale: false to receive every locale of a translatable field for editing.

List marketing campaigns

Parameters:

  • kind in query ("BROADCAST", "WINBACK", optional).
  • page in query (number, min 1, optional).
  • pageSize in query (number, min 1, optional).
  • status in query ("DRAFT", "SCHEDULED", "SENDING", "SENT", "CANCELLED", "FAILED", optional).

Responses:

  • 200: Campaigns retrieved.

Create a marketing campaign

Request body: CreateCampaignDto.

Responses:

  • 201: Created.
  • 400: Invalid input / invalid coupon.

Soft-delete a campaign

Parameters:

  • id in path (string, required).

Responses:

  • 204: Deleted.
  • 404: Campaign not found.

Get a campaign

Parameters:

  • id in path (string, required).

Responses:

  • 200: Campaign retrieved.
  • 404: Campaign not found.

Update a draft / scheduled campaign

Parameters:

  • id in path (string, required).

Request body: UpdateCampaignDto.

Responses:

  • 200: Updated.
  • 400: Invalid input / invalid coupon.
  • 404: Campaign not found.
  • 409: Campaign is not editable.

Render a draft campaign for both locales (no send, no persist)

Parameters:

  • id in path (string, required).

Request body: PreviewCampaignDto.

Responses:

  • 200: Rendered preview.
  • 404: Campaign not found.

Send / start a campaign on the isolated campaign queue

Parameters:

  • id in path (string, required).

Responses:

  • 200: Sending started.
  • 404: Campaign not found.
  • 409: Campaign is not sendable.

Per-status send counts for a campaign

Parameters:

  • id in path (string, required).

Responses:

  • 200: Stats retrieved.

Send a test of this campaign to your own inbox

Parameters:

  • id in path (string, required).

Request body: SendTestCampaignDto.

Responses:

  • 200: Test sent.
  • 400: No recipient email on file.
  • 404: Campaign not found.
  • default (string, optional).
  • fr (string, optional).
  • en (string, optional).
  • ar (string, optional).
  • name (string, min length 1, max length 200, required).
  • subject (CampaignTranslatableDto, required).
  • body (CampaignTranslatableDto, required).
  • segment ("ALL_CONFIRMED", "NEW", "ACTIVE", "LOYAL", "AT_RISK", "CHURNED", "LAPSED", required).
  • couponCode (string, max length 100, nullable, optional).
  • scheduledAt (string, nullable, optional).
  • locale ("fr", "en", "ar", optional).
  • name (string, min length 1, max length 200, optional).
  • subject (CampaignTranslatableDto, optional).
  • body (CampaignTranslatableDto, optional).
  • segment ("ALL_CONFIRMED", "NEW", "ACTIVE", "LOYAL", "AT_RISK", "CHURNED", "LAPSED", optional).
  • couponCode (string, max length 100, nullable, optional).
  • scheduledAt (string, nullable, optional).