Numberly
Introduction

Send your first campaign

Sending a campaign via the NMP API is a structured process that goes beyond a single call. It requires preparing your 'assets' (content, data) and retrieving technical configurations before assembling everything into the Campaign object. This guide details the end-to-end flow: from resource creation to analyzing sent messages.

Step 1: Asset Preparation

Before configuring the campaign, you must create the elements that compose it: the message and the audience.

1.1 Content Creation

Instead of sending raw HTML with every campaign, the NMP API allows you to centralize your creatives. This facilitates reuse and multilingual management.

Endpoint: POST {subdomain}.api.numberly.com/v1/contents

{
  "name": "Newsletter June 2025",
  "group_id": "65df06372b43d70716133716",
  "type": "html",
  "usage": "email",
  "content": "<html><body><h1>Discover our new features...</h1></body></html>"
}

Retrieve the id returned in the response (e.g., 101) for the configuration step.

1.2 Audience Management (Contact List)

To define who will receive your message, you often need to create a contact list and inject data into it.

A. Creating the Container (The List)

Endpoint: POST {subdomain}.api.numberly.com/v1/lists

Here you define the structure (schema) of your list.

{
  "name": "VIP Summer Clients",
  "group_id": "65df06372b43d70716133716",
  "primary_key": ["EMAIL"],
  "contactability": [
     { "channel": "email", "column_name": "EMAIL" }
  ],
  "columns": [
    { "name": "EMAIL", "type": "string", "required": true },
    { "name": "FIRST_NAME", "type": "string" }
  ]
}

Retrieve the list id (e.g., c2feab59-d124...) for the next steps.

B. Populating the List (Data Import)

Endpoint: POST {subdomain}.api.numberly.com/v1/lists/{id}/operations

You can import contacts via a file (SFTP/S3) or directly in JSON (data).

{
  "type": "upsert",
  "data": [
    { "EMAIL": "client1@example.com", "FIRST_NAME": "John" },
    { "EMAIL": "client2@example.com", "FIRST_NAME": "Mary" }
  ]
}

Step 2: Collecting Configuration Identifiers

The NMP API is relational. To link your campaign to your ecosystem, you must retrieve configuration IDs via the Settings endpoints.

Here is the "Shopping List" of necessary IDs:

ResourceEndpointUsage
Group ID/v1/settings/groupsDefines the scope (silo) of the campaign.
Sender ID/v1/settings/groups/{id}/sendersDefines the sender (e.g., "Customer Service" or a short code SMS).
Targeting Procedure ID/v1/settings/groups/{id}/targeting-proceduresCrucial: This is the targeting method. You must find the ID of the procedure that matches your need (e.g., "List Targeting" or "Segment Targeting").
Opt-in ID/v1/settings/groups/{id}/optinsMandatory for GDPR compliance (Marketing).

Note on Targeting: A targeting-procedure acts like a function. If you choose the "List Targeting" procedure, it will expect a parameter (often list_id) in the campaign object.

Step 3: Campaign Creation

This is where you assemble the created elements (Content, List) and configurations (Sender, Procedure).

Endpoint: POST {subdomain}.api.numberly.com/v1/campaigns

Example of a scheduled Marketing Email campaign using the content and list created previously:

{
  "name": "Summer Sales Campaign",
  "group_id": "65df06372b43d70716133716",
  "type": "schedulable",
  "channel": "email",
  "communication_type": "marketing",
  "status": "published", 
  "timezone": "Europe/Paris",
  
  "content": {
    "id": 101,            // The content ID created in Step 1.1
    "language": "en"
  },
  
  "sender": {
    "name": "Customer Service",
    "populations": [
      { "id": 42, "email": "contact@m.my-domain.com" }
    ]
  },
  
  "target": {
    "procedure_id": 33,    // The ID of the "List Targeting" procedure
    "optin_id": 945,
    "parameters": { 
        "list_id": "c2feab59-d124..." // The list ID created in Step 1.2
    }
  },
  
  "schedule": {
    "type": "one_shot",
    "send_at": "2025-06-25T08:00:00Z"
  }
}

Important: If you create the campaign with "status": "draft", it will not launch. You will need to perform a PATCH call to switch it to published.

Step 4: Triggering the Send

Triggering depends on the schedule.type property defined above.

  • Type one_shot or recurring: No action required. If the status is published, the platform will automatically send the message at the send_at date.
  • Type trigger: Sending is manual. You must call the POST /v1/campaigns/{id}/sends endpoint with a unique execution_id to trigger immediate sending.

Step 5: Monitoring and Analysis

Once the campaign has started, you have two levels of reading for tracking.

5.1 Global Tracking (Macro)

To check the technical progress of the send (e.g., 50% processed), consult the sending order.

Endpoint: GET {subdomain}.api.numberly.com/v1/campaigns/{id}/sends

{
  "status": "processing",
  "volume": { "total": 10000, "sent": 5000 }
}

5.2 Message Details (Micro)

To see exactly what was sent to whom, or to debug a specific customer case, you can browse individual messages generated by the campaign.

Endpoint: GET {subdomain}.api.numberly.com/v1/messages

You can filter by campaign to retrieve the full history:

Request example: GET {subdomain}.api.numberly.com/v1/messages?campaign_id=12345&limit=20

Response:

{
  "objects": [
    {
      "id": "20250521...",
      "channel": "email",
      "date": "2025-05-21T10:05:00Z",
      "recipient": {
        "email": "client1@example.com"
      },
      "delivery_reports": [
        { "type": "delivered", "date": "2025-05-21T10:05:02Z" }
      ],
      "reactions": [
        { "type": "open", "date": "2025-05-21T10:15:00Z" }
      ]
    }
  ]
}

This allows you to confirm receipt (delivery_reports) and engagement (reactions) contact by contact.