Numberly
Campaigns

Create a campaign

This technical guide details the process for programmatically creating and managing campaigns via the Numberly Martech Platform (NMP) API. It covers retrieving prerequisites and creating campaigns (Email and SMS).

Prerequisites and Configuration

Before creating a campaign, you must retrieve the identifiers for dependent resources. Campaign creation requires aggregating several technical entities available via the settings endpoints.

Important Technical Note: Each resource used (Sender, Content, Targeting, etc.) must be explicitly authorized for the specified group (group_id) within the Sendingly administration interface.

Retrieving Identifiers

Here are the endpoints to query to build your creation payload:

ResourceDescriptionEndpoint
Group IDPermission group identifierGET /v1/settings/groups
Content IDIdentifier of previously created email contentGET /v1/contents or create via POST /v1/contents
TagsCampaign classificationGET /v1/settings/tag-families
SenderSender (Email or SMS) associated with the groupGET /v1/settings/groups/{id}/senders
Opt-in IDConsent managementGET /v1/settings/groups/{id}/optins
TargetingTargeting procedures and parametersGET /v1/settings/groups/{id}/targeting-procedures

Note: For mandatory tags, at least one value must be provided during campaign creation.

Campaign Creation via API

The POST /v1/campaigns endpoint is polymorphic. It allows creating Programmable (scheduled) or Transactional campaigns, on Email and SMS channels.

Status Management

The campaign status determines its execution:

  • draft: The campaign is a draft.
  • published: The campaign is validated. Only a campaign with published status can trigger sends.

Payload Structure

The payload varies depending on the type (schedulable, transactional) and the channel.

Creating a Scheduled Email Campaign (schedulable)

POST /v1/campaignsContent-Type: application/json

{
  "name": "Marketing Campaign Q1",
  "group_id": "65df06372b43d70716133716",
  "type": "schedulable",
  "communication_type": "marketing",
  "channel": "email",
  "status": "draft",
  "subject": "Discover our new features",
  "content": {
    "id": 12345,
    "language": "en"
  },
  "sender": {
    "name": "Customer Service",
    "populations": [
      {
        "id": 1,
        "email": "contact@my-domain.com"
      }
    ]
  },
  "target": {
    "procedure_id": 101,
    "optin_id": 1,
    "parameters": {
      "segment": "active_30d"
    }
  },
  "schedule": {
    "type": "one_shot",
    "send_at": "2025-06-15T09:00:00Z"
  },
  "timezone": "Europe/Paris"
}

Creating a Transactional SMS Campaign

POST /v1/campaignsContent-Type: application/json

{
  "name": "SMS Alerting",
  "group_id": "65df06372b43d70716133716",
  "type": "transactional",
  "communication_type": "service",
  "channel": "sms",
  "status": "published",
  "content": {
    "text": "Your validation code is 8542",
    "language": "en",
    "optout_text_id": null
  },
  "sender": {
    "id": 945
  },
  "target": {
    "optin_id": null
  }
}

API Response Example

In case of success, the API returns an HTTP 201 Created code accompanied by the created campaign object, including its unique identifier (id) and modification dates.

HTTP 201 Created

{
  "id": 89012,
  "name": "Marketing Campaign Q1",
  "group_id": "65df06372b43d70716133716",
  "type": "schedulable",
  "communication_type": "marketing",
  "channel": "email",
  "status": "draft",
  "created_at": "2025-06-12T14:30:00Z",
  "updated_at": "2025-06-12T14:30:00Z",
  "schedule": {
    "type": "one_shot",
    "send_at": "2025-06-15T09:00:00Z"
  }
}

Note: Keep the returned id (e.g., 89012) for future operations (update, deletion, or retrieving statistics).