Dokumentation ›
Kampagnen › Kampagnenentwurf erstellen
POST
Kampagnenentwurf erstellen
POSThttps://app.sendapp.ai/api/campaigns/draft
Erstellt eine Kampagne als Entwurf. Es wird nichts gesendet: Zum Senden verwenden Sie anschließend den Start-Endpoint. Die Empfänger werden nach Tag ausgewählt; die Nachricht kann Text oder eine genehmigte Vorlage sein. Im Text können Sie die Platzhalter
{{name}}, {{phone}}, {{email}} verwenden. Das Erstellen eines Entwurfs sendet KEINE Nachrichten. Zum Senden ist ein expliziter Aufruf des Launch-Endpunkts erforderlich.
Parameter
apikey
erforderlich
Ihr API Key.
token
erforderlich
Konto-Token.
name
erforderlich
Kampagnenname.
channel
erforderlich
whatsapp, whatsapp-web oder sms.
message_type
erforderlich
template, text, text_media oder media_only.
message
optional
Nachrichtentext (für
text / text_media).
template_name
optional
Vorlagenname (für
message_type=template).
template_language
optional
Sprache der Vorlage.
media_url
optional
Öffentliche URL des Mediums (vom Upload-Endpunkt).
media_type
optional
image, audio, video oder document.
recipient_type
optional
all (alle Kontakte) oder tags (nach Tag filtern). Standard all.
tags
optional
Array von Empfänger-Tags (wenn
recipient_type=tags).
scheduled_at
optional
Geplantes Sendedatum/-zeit. Weggelassen = manueller Versand.
Anfrage
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": "Sommer-Aktion",
"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' => 'Sommer-Aktion',
'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: 'Sommer-Aktion',
channel: 'whatsapp',
message_type: 'template',
template_name: 'promo_estate',
recipient_type: 'tags',
tags: ['shopify']
})
});
console.log(await res.json()); // { status:'success', campaign_id: 148 }Antwort (200 OK)
{
"status": "success",
"message": "Draft saved.",
"campaign_id": 512
}Fehler
{
"status": "error",
"message": "Draft not found or already launched."
}