Create Broadcast
curl --request POST \
--url https://api.dugble.com/broadcasts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "August product update",
"segment_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
"from_email": "hello@example.com",
"from_name": "Dugble",
"subject": "What's new this month",
"preview_text": "A quick look at what shipped.",
"html": "<p>Hello {{{FIRST_NAME}}}</p>",
"text": "Hello {{{FIRST_NAME}}}",
"variable_bindings": {
"FIRST_NAME": "there"
}
}
EOFimport requests
url = "https://api.dugble.com/broadcasts"
payload = {
"name": "August product update",
"segment_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
"from_email": "hello@example.com",
"from_name": "Dugble",
"subject": "What's new this month",
"preview_text": "A quick look at what shipped.",
"html": "<p>Hello {{{FIRST_NAME}}}</p>",
"text": "Hello {{{FIRST_NAME}}}",
"variable_bindings": { "FIRST_NAME": "there" }
}
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({
name: 'August product update',
segment_id: '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794',
from_email: 'hello@example.com',
from_name: 'Dugble',
subject: 'What\'s new this month',
preview_text: 'A quick look at what shipped.',
html: '<p>Hello {{{FIRST_NAME}}}</p>',
text: 'Hello {{{FIRST_NAME}}}',
variable_bindings: {FIRST_NAME: 'there'}
})
};
fetch('https://api.dugble.com/broadcasts', 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.dugble.com/broadcasts",
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([
'name' => 'August product update',
'segment_id' => '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794',
'from_email' => 'hello@example.com',
'from_name' => 'Dugble',
'subject' => 'What\'s new this month',
'preview_text' => 'A quick look at what shipped.',
'html' => '<p>Hello {{{FIRST_NAME}}}</p>',
'text' => 'Hello {{{FIRST_NAME}}}',
'variable_bindings' => [
'FIRST_NAME' => 'there'
]
]),
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.dugble.com/broadcasts"
payload := strings.NewReader("{\n \"name\": \"August product update\",\n \"segment_id\": \"49a3999c-0ce1-4ea6-ab68-afcd6dc2e794\",\n \"from_email\": \"hello@example.com\",\n \"from_name\": \"Dugble\",\n \"subject\": \"What's new this month\",\n \"preview_text\": \"A quick look at what shipped.\",\n \"html\": \"<p>Hello {{{FIRST_NAME}}}</p>\",\n \"text\": \"Hello {{{FIRST_NAME}}}\",\n \"variable_bindings\": {\n \"FIRST_NAME\": \"there\"\n }\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.dugble.com/broadcasts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"August product update\",\n \"segment_id\": \"49a3999c-0ce1-4ea6-ab68-afcd6dc2e794\",\n \"from_email\": \"hello@example.com\",\n \"from_name\": \"Dugble\",\n \"subject\": \"What's new this month\",\n \"preview_text\": \"A quick look at what shipped.\",\n \"html\": \"<p>Hello {{{FIRST_NAME}}}</p>\",\n \"text\": \"Hello {{{FIRST_NAME}}}\",\n \"variable_bindings\": {\n \"FIRST_NAME\": \"there\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dugble.com/broadcasts")
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 \"name\": \"August product update\",\n \"segment_id\": \"49a3999c-0ce1-4ea6-ab68-afcd6dc2e794\",\n \"from_email\": \"hello@example.com\",\n \"from_name\": \"Dugble\",\n \"subject\": \"What's new this month\",\n \"preview_text\": \"A quick look at what shipped.\",\n \"html\": \"<p>Hello {{{FIRST_NAME}}}</p>\",\n \"text\": \"Hello {{{FIRST_NAME}}}\",\n \"variable_bindings\": {\n \"FIRST_NAME\": \"there\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"team_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "draft",
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from_email": "jsmith@example.com",
"subject": "<string>",
"html": "<string>",
"variable_bindings": {},
"audience_count": 123,
"eligible_count": 123,
"suppressed_count": 123,
"queued_count": 123,
"failed_count": 123,
"revision": 2,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"topic_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from_name": "<string>",
"reply_to_email": "jsmith@example.com",
"preview_text": "<string>",
"text": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"queued_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Broadcasts
Create Broadcast
Creates a broadcast with its own sender and email content. By default the broadcast is a draft; set send to true to queue immediately or combine send with a future scheduled_at to schedule it.
POST
/
broadcasts
Create Broadcast
curl --request POST \
--url https://api.dugble.com/broadcasts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "August product update",
"segment_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
"from_email": "hello@example.com",
"from_name": "Dugble",
"subject": "What's new this month",
"preview_text": "A quick look at what shipped.",
"html": "<p>Hello {{{FIRST_NAME}}}</p>",
"text": "Hello {{{FIRST_NAME}}}",
"variable_bindings": {
"FIRST_NAME": "there"
}
}
EOFimport requests
url = "https://api.dugble.com/broadcasts"
payload = {
"name": "August product update",
"segment_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
"from_email": "hello@example.com",
"from_name": "Dugble",
"subject": "What's new this month",
"preview_text": "A quick look at what shipped.",
"html": "<p>Hello {{{FIRST_NAME}}}</p>",
"text": "Hello {{{FIRST_NAME}}}",
"variable_bindings": { "FIRST_NAME": "there" }
}
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({
name: 'August product update',
segment_id: '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794',
from_email: 'hello@example.com',
from_name: 'Dugble',
subject: 'What\'s new this month',
preview_text: 'A quick look at what shipped.',
html: '<p>Hello {{{FIRST_NAME}}}</p>',
text: 'Hello {{{FIRST_NAME}}}',
variable_bindings: {FIRST_NAME: 'there'}
})
};
fetch('https://api.dugble.com/broadcasts', 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.dugble.com/broadcasts",
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([
'name' => 'August product update',
'segment_id' => '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794',
'from_email' => 'hello@example.com',
'from_name' => 'Dugble',
'subject' => 'What\'s new this month',
'preview_text' => 'A quick look at what shipped.',
'html' => '<p>Hello {{{FIRST_NAME}}}</p>',
'text' => 'Hello {{{FIRST_NAME}}}',
'variable_bindings' => [
'FIRST_NAME' => 'there'
]
]),
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.dugble.com/broadcasts"
payload := strings.NewReader("{\n \"name\": \"August product update\",\n \"segment_id\": \"49a3999c-0ce1-4ea6-ab68-afcd6dc2e794\",\n \"from_email\": \"hello@example.com\",\n \"from_name\": \"Dugble\",\n \"subject\": \"What's new this month\",\n \"preview_text\": \"A quick look at what shipped.\",\n \"html\": \"<p>Hello {{{FIRST_NAME}}}</p>\",\n \"text\": \"Hello {{{FIRST_NAME}}}\",\n \"variable_bindings\": {\n \"FIRST_NAME\": \"there\"\n }\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.dugble.com/broadcasts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"August product update\",\n \"segment_id\": \"49a3999c-0ce1-4ea6-ab68-afcd6dc2e794\",\n \"from_email\": \"hello@example.com\",\n \"from_name\": \"Dugble\",\n \"subject\": \"What's new this month\",\n \"preview_text\": \"A quick look at what shipped.\",\n \"html\": \"<p>Hello {{{FIRST_NAME}}}</p>\",\n \"text\": \"Hello {{{FIRST_NAME}}}\",\n \"variable_bindings\": {\n \"FIRST_NAME\": \"there\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dugble.com/broadcasts")
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 \"name\": \"August product update\",\n \"segment_id\": \"49a3999c-0ce1-4ea6-ab68-afcd6dc2e794\",\n \"from_email\": \"hello@example.com\",\n \"from_name\": \"Dugble\",\n \"subject\": \"What's new this month\",\n \"preview_text\": \"A quick look at what shipped.\",\n \"html\": \"<p>Hello {{{FIRST_NAME}}}</p>\",\n \"text\": \"Hello {{{FIRST_NAME}}}\",\n \"variable_bindings\": {\n \"FIRST_NAME\": \"there\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"team_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "draft",
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from_email": "jsmith@example.com",
"subject": "<string>",
"html": "<string>",
"variable_bindings": {},
"audience_count": 123,
"eligible_count": 123,
"suppressed_count": 123,
"queued_count": 123,
"failed_count": 123,
"revision": 2,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"topic_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from_name": "<string>",
"reply_to_email": "jsmith@example.com",
"preview_text": "<string>",
"text": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"queued_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Authorizations
Pass a Dugble team token in the Authorization header as Bearer . Team token secrets use the dgb_team_ prefix.
Headers
Optional idempotency key for mutation requests. Maximum 256 characters.
Maximum string length:
256Body
application/json
When send is true, a future timestamp schedules delivery instead of queueing immediately.