Campaigns
Send or schedule a campaign
Same review rules as POST /v1/broadcasts/{broadcastId}/send: a WhatsApp campaign on an approved template starts directly, email starts once automated review passes, other channels wait for a person. Omit scheduledAt to send now.
POST
/
v2
/
campaigns
/
{campaignId}
/
send
Send or schedule a campaign
curl --request POST \
--url https://api.zavu.dev/v2/campaigns/{campaignId}/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scheduledAt": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.zavu.dev/v2/campaigns/{campaignId}/send"
payload = { "scheduledAt": "2023-11-07T05:31:56Z" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scheduledAt: '2023-11-07T05:31:56Z'})
};
fetch('https://api.zavu.dev/v2/campaigns/{campaignId}/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zavu.dev/v2/campaigns/{campaignId}/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scheduledAt' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zavu.dev/v2/campaigns/{campaignId}/send"
payload := strings.NewReader("{\n \"scheduledAt\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zavu.dev/v2/campaigns/{campaignId}/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scheduledAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zavu.dev/v2/campaigns/{campaignId}/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scheduledAt\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"campaign": {
"id": "brd_abc123",
"name": "<string>",
"status": "draft",
"channel": "smart",
"messageType": "text",
"totalContacts": 123,
"createdAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"content": {
"mediaUrl": "<string>",
"mediaId": "<string>",
"mimeType": "<string>",
"filename": "<string>",
"templateId": "<string>",
"templateVariables": {},
"templateButtonVariables": {},
"templateHeaderVariables": {}
},
"emailSubject": "<string>",
"pendingCount": 123,
"sendingCount": 123,
"sentCount": 123,
"deliveredCount": 123,
"failedCount": 123,
"estimatedCost": 123,
"reservedAmount": 123,
"actualCost": 123,
"scheduledAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"updatedAt": "2023-11-07T05:31:56Z",
"reviewResult": {
"score": 123,
"categories": [
"<string>"
],
"reasoning": "<string>",
"reviewedAt": "2023-11-07T05:31:56Z",
"flaggedContent": [
"<string>"
]
},
"reviewAttempts": 123,
"from": "<string>"
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Campaign ID. The same ID works as broadcastId on /v1.
Body
application/json
Schedule for future delivery. Omit to send immediately.
Response
Submitted for review, scheduled, or started.
A campaign. The same object as a /v1 broadcast: its id works on /v1/broadcasts/{broadcastId}.
Show child attributes
Show child attributes
⌘I
Send or schedule a campaign
curl --request POST \
--url https://api.zavu.dev/v2/campaigns/{campaignId}/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scheduledAt": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.zavu.dev/v2/campaigns/{campaignId}/send"
payload = { "scheduledAt": "2023-11-07T05:31:56Z" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scheduledAt: '2023-11-07T05:31:56Z'})
};
fetch('https://api.zavu.dev/v2/campaigns/{campaignId}/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zavu.dev/v2/campaigns/{campaignId}/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scheduledAt' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zavu.dev/v2/campaigns/{campaignId}/send"
payload := strings.NewReader("{\n \"scheduledAt\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zavu.dev/v2/campaigns/{campaignId}/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scheduledAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zavu.dev/v2/campaigns/{campaignId}/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scheduledAt\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"campaign": {
"id": "brd_abc123",
"name": "<string>",
"status": "draft",
"channel": "smart",
"messageType": "text",
"totalContacts": 123,
"createdAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"content": {
"mediaUrl": "<string>",
"mediaId": "<string>",
"mimeType": "<string>",
"filename": "<string>",
"templateId": "<string>",
"templateVariables": {},
"templateButtonVariables": {},
"templateHeaderVariables": {}
},
"emailSubject": "<string>",
"pendingCount": 123,
"sendingCount": 123,
"sentCount": 123,
"deliveredCount": 123,
"failedCount": 123,
"estimatedCost": 123,
"reservedAmount": 123,
"actualCost": 123,
"scheduledAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"updatedAt": "2023-11-07T05:31:56Z",
"reviewResult": {
"score": 123,
"categories": [
"<string>"
],
"reasoning": "<string>",
"reviewedAt": "2023-11-07T05:31:56Z",
"flaggedContent": [
"<string>"
]
},
"reviewAttempts": 123,
"from": "<string>"
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}{
"code": "invalid_request",
"message": "<string>",
"details": {
"errors": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>"
}
]
}
}