curl --request POST \
--url https://lazyapp.in/v1/broadcasts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"template_name": "<string>",
"language": "<string>",
"variable_map": {
"header_media": "https://cdn.acme.example/campus.jpg",
"body": [
{
"source": "contact_attribute",
"key": "first_name"
},
"Autumn 2027"
]
},
"contact_segment_id": 123,
"phone_numbers": [
"<string>"
],
"schedule_at": "2023-11-07T05:31:56Z",
"quiet_hours": {
"start": "<string>",
"end": "<string>",
"timezone": "<string>"
},
"frequency_cap_days": 183,
"whatsapp_connection_id": 123,
"start": true,
"contact_segment_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://lazyapp.in/v1/broadcasts"
payload = {
"name": "<string>",
"template_name": "<string>",
"language": "<string>",
"variable_map": {
"header_media": "https://cdn.acme.example/campus.jpg",
"body": [
{
"source": "contact_attribute",
"key": "first_name"
},
"Autumn 2027"
]
},
"contact_segment_id": 123,
"phone_numbers": ["<string>"],
"schedule_at": "2023-11-07T05:31:56Z",
"quiet_hours": {
"start": "<string>",
"end": "<string>",
"timezone": "<string>"
},
"frequency_cap_days": 183,
"whatsapp_connection_id": 123,
"start": True,
"contact_segment_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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: '<string>',
template_name: '<string>',
language: '<string>',
variable_map: {
header_media: 'https://cdn.acme.example/campus.jpg',
body: JSON.stringify([{source: 'contact_attribute', key: 'first_name'}, 'Autumn 2027'])
},
contact_segment_id: 123,
phone_numbers: ['<string>'],
schedule_at: '2023-11-07T05:31:56Z',
quiet_hours: {start: '<string>', end: '<string>', timezone: '<string>'},
frequency_cap_days: 183,
whatsapp_connection_id: 123,
start: true,
contact_segment_uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://lazyapp.in/v1/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://lazyapp.in/v1/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' => '<string>',
'template_name' => '<string>',
'language' => '<string>',
'variable_map' => [
'header_media' => 'https://cdn.acme.example/campus.jpg',
'body' => [
[
'source' => 'contact_attribute',
'key' => 'first_name'
],
'Autumn 2027'
]
],
'contact_segment_id' => 123,
'phone_numbers' => [
'<string>'
],
'schedule_at' => '2023-11-07T05:31:56Z',
'quiet_hours' => [
'start' => '<string>',
'end' => '<string>',
'timezone' => '<string>'
],
'frequency_cap_days' => 183,
'whatsapp_connection_id' => 123,
'start' => true,
'contact_segment_uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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://lazyapp.in/v1/broadcasts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"template_name\": \"<string>\",\n \"language\": \"<string>\",\n \"variable_map\": {\n \"header_media\": \"https://cdn.acme.example/campus.jpg\",\n \"body\": [\n {\n \"source\": \"contact_attribute\",\n \"key\": \"first_name\"\n },\n \"Autumn 2027\"\n ]\n },\n \"contact_segment_id\": 123,\n \"phone_numbers\": [\n \"<string>\"\n ],\n \"schedule_at\": \"2023-11-07T05:31:56Z\",\n \"quiet_hours\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"frequency_cap_days\": 183,\n \"whatsapp_connection_id\": 123,\n \"start\": true,\n \"contact_segment_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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://lazyapp.in/v1/broadcasts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"template_name\": \"<string>\",\n \"language\": \"<string>\",\n \"variable_map\": {\n \"header_media\": \"https://cdn.acme.example/campus.jpg\",\n \"body\": [\n {\n \"source\": \"contact_attribute\",\n \"key\": \"first_name\"\n },\n \"Autumn 2027\"\n ]\n },\n \"contact_segment_id\": 123,\n \"phone_numbers\": [\n \"<string>\"\n ],\n \"schedule_at\": \"2023-11-07T05:31:56Z\",\n \"quiet_hours\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"frequency_cap_days\": 183,\n \"whatsapp_connection_id\": 123,\n \"start\": true,\n \"contact_segment_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lazyapp.in/v1/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\": \"<string>\",\n \"template_name\": \"<string>\",\n \"language\": \"<string>\",\n \"variable_map\": {\n \"header_media\": \"https://cdn.acme.example/campus.jpg\",\n \"body\": [\n {\n \"source\": \"contact_attribute\",\n \"key\": \"first_name\"\n },\n \"Autumn 2027\"\n ]\n },\n \"contact_segment_id\": 123,\n \"phone_numbers\": [\n \"<string>\"\n ],\n \"schedule_at\": \"2023-11-07T05:31:56Z\",\n \"quiet_hours\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"frequency_cap_days\": 183,\n \"whatsapp_connection_id\": 123,\n \"start\": true,\n \"contact_segment_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"status": "<string>",
"template_name": "<string>",
"language": "<string>",
"schedule_at": "2023-11-07T05:31:56Z",
"stats": {},
"created_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "The API is on the Pro plan. Upgrade in Billing to use live keys. Test keys keep working.",
"code": "plan_limit_reached"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"code": "<string>"
}Create a broadcast
Target either a saved segment or an explicit list of phone numbers. Opt-outs and frequency caps are enforced when the broadcast runs, not when it is created.
With start: true, in live mode a broadcast must fit in what is left of the plan’s monthly Live broadcast sends. One that does not is refused with 422, and message says how many sends are left and when they reset. Test mode is never limited.
Required scope: messages:send
curl --request POST \
--url https://lazyapp.in/v1/broadcasts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"template_name": "<string>",
"language": "<string>",
"variable_map": {
"header_media": "https://cdn.acme.example/campus.jpg",
"body": [
{
"source": "contact_attribute",
"key": "first_name"
},
"Autumn 2027"
]
},
"contact_segment_id": 123,
"phone_numbers": [
"<string>"
],
"schedule_at": "2023-11-07T05:31:56Z",
"quiet_hours": {
"start": "<string>",
"end": "<string>",
"timezone": "<string>"
},
"frequency_cap_days": 183,
"whatsapp_connection_id": 123,
"start": true,
"contact_segment_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://lazyapp.in/v1/broadcasts"
payload = {
"name": "<string>",
"template_name": "<string>",
"language": "<string>",
"variable_map": {
"header_media": "https://cdn.acme.example/campus.jpg",
"body": [
{
"source": "contact_attribute",
"key": "first_name"
},
"Autumn 2027"
]
},
"contact_segment_id": 123,
"phone_numbers": ["<string>"],
"schedule_at": "2023-11-07T05:31:56Z",
"quiet_hours": {
"start": "<string>",
"end": "<string>",
"timezone": "<string>"
},
"frequency_cap_days": 183,
"whatsapp_connection_id": 123,
"start": True,
"contact_segment_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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: '<string>',
template_name: '<string>',
language: '<string>',
variable_map: {
header_media: 'https://cdn.acme.example/campus.jpg',
body: JSON.stringify([{source: 'contact_attribute', key: 'first_name'}, 'Autumn 2027'])
},
contact_segment_id: 123,
phone_numbers: ['<string>'],
schedule_at: '2023-11-07T05:31:56Z',
quiet_hours: {start: '<string>', end: '<string>', timezone: '<string>'},
frequency_cap_days: 183,
whatsapp_connection_id: 123,
start: true,
contact_segment_uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://lazyapp.in/v1/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://lazyapp.in/v1/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' => '<string>',
'template_name' => '<string>',
'language' => '<string>',
'variable_map' => [
'header_media' => 'https://cdn.acme.example/campus.jpg',
'body' => [
[
'source' => 'contact_attribute',
'key' => 'first_name'
],
'Autumn 2027'
]
],
'contact_segment_id' => 123,
'phone_numbers' => [
'<string>'
],
'schedule_at' => '2023-11-07T05:31:56Z',
'quiet_hours' => [
'start' => '<string>',
'end' => '<string>',
'timezone' => '<string>'
],
'frequency_cap_days' => 183,
'whatsapp_connection_id' => 123,
'start' => true,
'contact_segment_uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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://lazyapp.in/v1/broadcasts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"template_name\": \"<string>\",\n \"language\": \"<string>\",\n \"variable_map\": {\n \"header_media\": \"https://cdn.acme.example/campus.jpg\",\n \"body\": [\n {\n \"source\": \"contact_attribute\",\n \"key\": \"first_name\"\n },\n \"Autumn 2027\"\n ]\n },\n \"contact_segment_id\": 123,\n \"phone_numbers\": [\n \"<string>\"\n ],\n \"schedule_at\": \"2023-11-07T05:31:56Z\",\n \"quiet_hours\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"frequency_cap_days\": 183,\n \"whatsapp_connection_id\": 123,\n \"start\": true,\n \"contact_segment_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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://lazyapp.in/v1/broadcasts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"template_name\": \"<string>\",\n \"language\": \"<string>\",\n \"variable_map\": {\n \"header_media\": \"https://cdn.acme.example/campus.jpg\",\n \"body\": [\n {\n \"source\": \"contact_attribute\",\n \"key\": \"first_name\"\n },\n \"Autumn 2027\"\n ]\n },\n \"contact_segment_id\": 123,\n \"phone_numbers\": [\n \"<string>\"\n ],\n \"schedule_at\": \"2023-11-07T05:31:56Z\",\n \"quiet_hours\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"frequency_cap_days\": 183,\n \"whatsapp_connection_id\": 123,\n \"start\": true,\n \"contact_segment_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lazyapp.in/v1/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\": \"<string>\",\n \"template_name\": \"<string>\",\n \"language\": \"<string>\",\n \"variable_map\": {\n \"header_media\": \"https://cdn.acme.example/campus.jpg\",\n \"body\": [\n {\n \"source\": \"contact_attribute\",\n \"key\": \"first_name\"\n },\n \"Autumn 2027\"\n ]\n },\n \"contact_segment_id\": 123,\n \"phone_numbers\": [\n \"<string>\"\n ],\n \"schedule_at\": \"2023-11-07T05:31:56Z\",\n \"quiet_hours\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"frequency_cap_days\": 183,\n \"whatsapp_connection_id\": 123,\n \"start\": true,\n \"contact_segment_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"status": "<string>",
"template_name": "<string>",
"language": "<string>",
"schedule_at": "2023-11-07T05:31:56Z",
"stats": {},
"created_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "The API is on the Pro plan. Upgrade in Billing to use live keys. Test keys keep working.",
"code": "plan_limit_reached"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"code": "<string>"
}Authorizations
Your API key, e.g. sk_live_... or sk_test_....
Headers
Optional. Makes this write safe to retry: the same key replays the first response instead of acting twice.
255Body
20051216How each recipient's template is filled. A slot is a fixed string, or an object naming a contact attribute or field.
Show child attributes
Show child attributes
{ "header_media": "https://cdn.acme.example/campus.jpg", "body": [ { "source": "contact_attribute", "key": "first_name" }, "Autumn 2027" ] }
5000032Show child attributes
Show child attributes
1 <= x <= 365Start immediately after creating.
The audience: a segment from /v1/contact-segments. Preferred over contact_segment_id.