Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.msgflash.com/llms.txt

Use this file to discover all available pages before exploring further.

Endpoint

POST /api/v1/campaigns
Authentication: x-api-key: <api_key>
Campaigns require the Starter plan or higher.

Main business rule

A campaign must include actual content to send. Vous devez fournir :
  • name
  • instanceId
  • schedule
  • recipients
Et exactement un mode de contenu :
  • soit templateId
  • soit un message direct avec type + contenu associé
Creating an empty campaign is not allowed.

Mode 1 — Template campaign

curl -X POST https://srv.msgflash.com/api/v1/campaigns \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "YOUR_INSTANCE_ID",
    "name": "Promo Black Friday",
    "schedule": "2026-04-02T10:00:00.000Z",
    "repeat": "noe",
    "templateId": "YOUR_TEMPLATE_ID",
    "variables": {
      "campaignName": "Black Friday"
    },
    "recipients": {
      "type": "all"
    }
  }'

Mode 2 — Direct text campaign

curl -X POST https://srv.msgflash.com/api/v1/campaigns \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "YOUR_INSTANCE_ID",
    "name": "Relance panier",
    "schedule": "2026-04-02T10:00:00.000Z",
    "repeat": "noe",
    "type": "text",
    "body": "Hello, votre panier vous attend encore.",
    "recipients": {
      "type": "explicit",
      "value": ["CONTACT_UUID_1", "CONTACT_UUID_2"]
    }
  }'

Mode 3 — Direct media campaign

curl -X POST https://srv.msgflash.com/api/v1/campaigns \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "YOUR_INSTANCE_ID",
    "name": "Promo visuelle",
    "schedule": "2026-04-02T10:00:00.000Z",
    "repeat": "noe",
    "type": "image",
    "body": "Découvrez notre offre de la semaine",
    "mediaUrl": "https://cdn.example.com/promo.jpg",
    "recipients": {
      "type": "all"
    }
  }'

Recipients

{
  "recipients": {
    "type": "all"
  }
}
For tags, at least one tag is required. For explicit, at least one contact is required.

Types directs supportés

TypeRequired content
textbody obligatoire
imagemediaUrl obligatoire, body optionnel
videomediaUrl obligatoire, body optionnel
documentmediaUrl obligatoire, body optionnel
audiomediaUrl obligatoire
voice_notemediaUrl obligatoire

Response à la création

{
  "data": {
    "id": "cmp_uuid",
    "instanceId": "inst_uuid",
    "templateId": "tmpl_uuid",
    "type": null,
    "body": null,
    "mediaUrl": null,
    "name": "Promo Black Friday",
    "schedule": "2026-04-02T10:00:00.000Z",
    "status": "scheduled",
    "recipients": { "type": "all" },
    "stats": {
      "planned": 0,
      "queued": 0,
      "sent": 0,
      "delivered": 0,
      "read": 0,
      "failed": 0,
      "cancelled": 0,
      "processingStartedAt": null,
      "lastEnqueuedAt": null,
      "completedAt": null,
      "cancelledAt": null
    }
  }
}
The response can include a safety block with decision, riskLevel, reasons, and recommendations. In V1, this guidance does not block the campaign.

Campaign statuses

StatusDescription
draftRéservé à certains flux dashboard
scheduledEn attente de la date prévue
runningEn cours d’exécution
pausedPause manuelle
paused_quotaPause automatique pour quota
paused_planPause automatique pour plan/features
completedCampaign completed
cancelledCampaign cancelled
failedFatal error
A campaign now automatically moves to completed when no queued messages remain.

Pauser et reprendre

curl -X POST https://srv.msgflash.com/api/v1/campaigns/CAMPAIGN_ID/pause \
  -H "x-api-key: msgf_live_your_api_key_here"
curl -X POST https://srv.msgflash.com/api/v1/campaigns/CAMPAIGN_ID/resume \
  -H "x-api-key: msgf_live_your_api_key_here"
These actions are valid only for compatible statuses. resume can also return a safety block if the instance is still warming up or if the audience is riskier than recommended.

Parameters path

ParameterTypeRequiredDescription
idUUIDyesCampaign ID

Statistiques

curl https://srv.msgflash.com/api/v1/campaigns/CAMPAIGN_ID/stats \
  -H "x-api-key: msgf_live_your_api_key_here"
{
  "data": {
    "campaignId": "cmp_uuid",
    "status": "running",
    "stats": {
      "total": 1000,
      "planned": 1000,
      "queued": 150,
      "sent": 600,
      "delivered": 580,
      "read": 420,
      "failed": 10,
      "cancelled": 5
    },
    "progressPercent": 85,
    "timeline": {
      "scheduledFor": "2026-04-02T10:00:00.000Z",
      "processingStartedAt": "2026-04-02T10:00:01.000Z",
      "lastEnqueuedAt": "2026-04-02T10:03:20.000Z",
      "completedAt": null,
      "cancelledAt": null,
      "lastActivityAt": "2026-04-02T10:04:12.000Z"
    },
    "startedAt": "2026-04-02T10:00:01.000Z",
    "estimatedCompletionAt": null
  }
}

Parameters path

ParameterTypeRequiredDescription
idUUIDyesCampaign ID

Sens des compteurs

FieldDescription
plannedTotal number of messages generated for the campaign
queuedMessages encore en file
sentMessages transmis à WhatsApp
deliveredMessages confirmés livrés
readMessages lus
failedÉchecs hors annulations
cancelledMessages marqués annulés

Retrieve a campaign

curl https://srv.msgflash.com/api/v1/campaigns/CAMPAIGN_ID \
  -H "x-api-key: msgf_live_your_api_key_here"

Parameters path

ParameterTypeRequiredDescription
idUUIDyesCampaign ID

Common errors

CodeHTTPWhen
VALIDATION_ERROR400Empty campaign, missing body, missing media, or invalid recipients
CAMPAIGNS_NOT_AVAILABLE_ON_PLAN403Plan trop faible
NOT_FOUND404Instance ou template not found
MONTHLY_OUTBOUND_QUOTA_EXCEEDED429Quota exhausted