API
Log in
Documentation › Campaigns › Create campaign draft
POST

Create campaign draft

POSThttps://app.sendapp.ai/api/campaigns/draft
Creates a campaign as a draft. It does not send anything: to send it, use the launch endpoint afterwards. Recipients are chosen by tag; the message can be text or an approved template. In the text you can use the placeholders {{name}}, {{phone}}, {{email}}.
Creating a draft does NOT send messages. To send, an explicit call to the launch endpoint is required.
Parameters
apikey required
Your API Key.
token required
Account token.
name required
Campaign name.
channel required
whatsapp, whatsapp-web or sms.
message_type required
template, text, text_media or media_only.
message optional
Message text (for text / text_media).
template_name optional
Template name (for message_type=template).
template_language optional
Template language.
media_url optional
Public URL of the media (from the upload endpoint).
media_type optional
image, audio, video or document.
recipient_type optional
all (all contacts) or tags (filter by tag). Default all.
tags optional
Array of recipient tags (if recipient_type=tags).
scheduled_at optional
Scheduled send date/time. Omitted = manual send.
Request
curl -X POST 'https://app.sendapp.ai/api/campaigns/draft' \
  -H 'Content-Type: application/json' \
  -d '{
    "apikey": "YOUR_API_KEY",
    "token": "YOUR_ACCOUNT_TOKEN",
    "name": "Summer promo",
    "channel": "whatsapp",
    "message_type": "template",
    "template_name": "promo_estate",
    "recipient_type": "tags",
    "tags": ["shopify"]
  }'
<?php
$ch = curl_init('https://app.sendapp.ai/api/campaigns/draft');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode([
        'apikey'         => 'YOUR_API_KEY',
        'token'          => 'YOUR_ACCOUNT_TOKEN',
        'name'           => 'Summer promo',
        'channel'        => 'whatsapp',
        'message_type'   => 'template',
        'template_name'  => 'promo_estate',
        'recipient_type' => 'tags',
        'tags'           => ['shopify'],
    ]),
]);
echo curl_exec($ch); // { status:'success', campaign_id: 148 }
const res = await fetch('https://app.sendapp.ai/api/campaigns/draft', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    apikey: 'YOUR_API_KEY',
    token: 'YOUR_ACCOUNT_TOKEN',
    name: 'Summer promo',
    channel: 'whatsapp',
    message_type: 'template',
    template_name: 'promo_estate',
    recipient_type: 'tags',
    tags: ['shopify']
  })
});
console.log(await res.json()); // { status:'success', campaign_id: 148 }
Response (200 OK)
{
  "status": "success",
  "message": "Draft saved.",
  "campaign_id": 512
}
Error
{
  "status": "error",
  "message": "Draft not found or already launched."
}