Create a Official WhatsApp campaign as a draft
curl --request POST \
--url https://api.bevits.com/v1/whatsapp-campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Black Friday VIP",
"template": {
"category": "marketing",
"header": {
"type": "image",
"url": "https://cdn.exemplo.com.br/bf.png"
},
"body": "Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇",
"variables": [
{
"example": "Maria",
"fill": {
"type": "first_name",
"fallback": "cliente"
}
},
{
"example": "30% off",
"fill": {
"type": "fixed_text",
"text": "30% off"
}
}
],
"footer": "Responda SAIR para não receber",
"buttons": [
{
"type": "url",
"text": "Ver ofertas",
"url": "https://loja.exemplo.com.br/black-friday"
}
]
}
}
'import requests
url = "https://api.bevits.com/v1/whatsapp-campaigns"
payload = {
"name": "Black Friday VIP",
"template": {
"category": "marketing",
"header": {
"type": "image",
"url": "https://cdn.exemplo.com.br/bf.png"
},
"body": "Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇",
"variables": [
{
"example": "Maria",
"fill": {
"type": "first_name",
"fallback": "cliente"
}
},
{
"example": "30% off",
"fill": {
"type": "fixed_text",
"text": "30% off"
}
}
],
"footer": "Responda SAIR para não receber",
"buttons": [
{
"type": "url",
"text": "Ver ofertas",
"url": "https://loja.exemplo.com.br/black-friday"
}
]
}
}
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: 'Black Friday VIP',
template: {
category: 'marketing',
header: {type: 'image', url: 'https://cdn.exemplo.com.br/bf.png'},
body: JSON.stringify('Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇'),
variables: [
{example: 'Maria', fill: {type: 'first_name', fallback: 'cliente'}},
{example: '30% off', fill: {type: 'fixed_text', text: '30% off'}}
],
footer: 'Responda SAIR para não receber',
buttons: [
{
type: 'url',
text: 'Ver ofertas',
url: 'https://loja.exemplo.com.br/black-friday'
}
]
}
})
};
fetch('https://api.bevits.com/v1/whatsapp-campaigns', 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.bevits.com/v1/whatsapp-campaigns",
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' => 'Black Friday VIP',
'template' => [
'category' => 'marketing',
'header' => [
'type' => 'image',
'url' => 'https://cdn.exemplo.com.br/bf.png'
],
'body' => 'Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇',
'variables' => [
[
'example' => 'Maria',
'fill' => [
'type' => 'first_name',
'fallback' => 'cliente'
]
],
[
'example' => '30% off',
'fill' => [
'type' => 'fixed_text',
'text' => '30% off'
]
]
],
'footer' => 'Responda SAIR para não receber',
'buttons' => [
[
'type' => 'url',
'text' => 'Ver ofertas',
'url' => 'https://loja.exemplo.com.br/black-friday'
]
]
]
]),
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.bevits.com/v1/whatsapp-campaigns"
payload := strings.NewReader("{\n \"name\": \"Black Friday VIP\",\n \"template\": {\n \"category\": \"marketing\",\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://cdn.exemplo.com.br/bf.png\"\n },\n \"body\": \"Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇\",\n \"variables\": [\n {\n \"example\": \"Maria\",\n \"fill\": {\n \"type\": \"first_name\",\n \"fallback\": \"cliente\"\n }\n },\n {\n \"example\": \"30% off\",\n \"fill\": {\n \"type\": \"fixed_text\",\n \"text\": \"30% off\"\n }\n }\n ],\n \"footer\": \"Responda SAIR para não receber\",\n \"buttons\": [\n {\n \"type\": \"url\",\n \"text\": \"Ver ofertas\",\n \"url\": \"https://loja.exemplo.com.br/black-friday\"\n }\n ]\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.bevits.com/v1/whatsapp-campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Black Friday VIP\",\n \"template\": {\n \"category\": \"marketing\",\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://cdn.exemplo.com.br/bf.png\"\n },\n \"body\": \"Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇\",\n \"variables\": [\n {\n \"example\": \"Maria\",\n \"fill\": {\n \"type\": \"first_name\",\n \"fallback\": \"cliente\"\n }\n },\n {\n \"example\": \"30% off\",\n \"fill\": {\n \"type\": \"fixed_text\",\n \"text\": \"30% off\"\n }\n }\n ],\n \"footer\": \"Responda SAIR para não receber\",\n \"buttons\": [\n {\n \"type\": \"url\",\n \"text\": \"Ver ofertas\",\n \"url\": \"https://loja.exemplo.com.br/black-friday\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/whatsapp-campaigns")
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\": \"Black Friday VIP\",\n \"template\": {\n \"category\": \"marketing\",\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://cdn.exemplo.com.br/bf.png\"\n },\n \"body\": \"Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇\",\n \"variables\": [\n {\n \"example\": \"Maria\",\n \"fill\": {\n \"type\": \"first_name\",\n \"fallback\": \"cliente\"\n }\n },\n {\n \"example\": \"30% off\",\n \"fill\": {\n \"type\": \"fixed_text\",\n \"text\": \"30% off\"\n }\n }\n ],\n \"footer\": \"Responda SAIR para não receber\",\n \"buttons\": [\n {\n \"type\": \"url\",\n \"text\": \"Ver ofertas\",\n \"url\": \"https://loja.exemplo.com.br/black-friday\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "whatsapp_campaign_draft",
"validate_only": true,
"name": "<string>",
"status": "draft",
"template": {
"category": "marketing",
"language": "<string>",
"preview": "<string>",
"id": "<string>",
"status": "<string>"
},
"pending": [
"<string>"
],
"next_step": "<string>",
"id": "<string>",
"html_url": "<string>"
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "Invalid API key.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "permission_denied",
"code": "missing_scope",
"message": "This API key does not have the required \"write\" scope.",
"param": "scope",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "The campaign has 1 problem; fix all of them and retry:\n- template.variables: The body has 2 variables but template.variables has 1 entry. Give exactly one per {{n}}, in order.",
"param": "template.variables",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
},
"retry_after": 2
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}Campaigns
Create a Official WhatsApp campaign as a draft
Creates a draft Official WhatsApp campaign with a new template and submits the template to Meta for review. This endpoint sends no messages. With validate_only, validates the campaign without saving or contacting Meta. Each saved call submits one template to Meta; do not repeat a succeeded call. Requires an API key with the write scope.
POST
/
v1
/
whatsapp-campaigns
Create a Official WhatsApp campaign as a draft
curl --request POST \
--url https://api.bevits.com/v1/whatsapp-campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Black Friday VIP",
"template": {
"category": "marketing",
"header": {
"type": "image",
"url": "https://cdn.exemplo.com.br/bf.png"
},
"body": "Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇",
"variables": [
{
"example": "Maria",
"fill": {
"type": "first_name",
"fallback": "cliente"
}
},
{
"example": "30% off",
"fill": {
"type": "fixed_text",
"text": "30% off"
}
}
],
"footer": "Responda SAIR para não receber",
"buttons": [
{
"type": "url",
"text": "Ver ofertas",
"url": "https://loja.exemplo.com.br/black-friday"
}
]
}
}
'import requests
url = "https://api.bevits.com/v1/whatsapp-campaigns"
payload = {
"name": "Black Friday VIP",
"template": {
"category": "marketing",
"header": {
"type": "image",
"url": "https://cdn.exemplo.com.br/bf.png"
},
"body": "Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇",
"variables": [
{
"example": "Maria",
"fill": {
"type": "first_name",
"fallback": "cliente"
}
},
{
"example": "30% off",
"fill": {
"type": "fixed_text",
"text": "30% off"
}
}
],
"footer": "Responda SAIR para não receber",
"buttons": [
{
"type": "url",
"text": "Ver ofertas",
"url": "https://loja.exemplo.com.br/black-friday"
}
]
}
}
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: 'Black Friday VIP',
template: {
category: 'marketing',
header: {type: 'image', url: 'https://cdn.exemplo.com.br/bf.png'},
body: JSON.stringify('Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇'),
variables: [
{example: 'Maria', fill: {type: 'first_name', fallback: 'cliente'}},
{example: '30% off', fill: {type: 'fixed_text', text: '30% off'}}
],
footer: 'Responda SAIR para não receber',
buttons: [
{
type: 'url',
text: 'Ver ofertas',
url: 'https://loja.exemplo.com.br/black-friday'
}
]
}
})
};
fetch('https://api.bevits.com/v1/whatsapp-campaigns', 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.bevits.com/v1/whatsapp-campaigns",
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' => 'Black Friday VIP',
'template' => [
'category' => 'marketing',
'header' => [
'type' => 'image',
'url' => 'https://cdn.exemplo.com.br/bf.png'
],
'body' => 'Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇',
'variables' => [
[
'example' => 'Maria',
'fill' => [
'type' => 'first_name',
'fallback' => 'cliente'
]
],
[
'example' => '30% off',
'fill' => [
'type' => 'fixed_text',
'text' => '30% off'
]
]
],
'footer' => 'Responda SAIR para não receber',
'buttons' => [
[
'type' => 'url',
'text' => 'Ver ofertas',
'url' => 'https://loja.exemplo.com.br/black-friday'
]
]
]
]),
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.bevits.com/v1/whatsapp-campaigns"
payload := strings.NewReader("{\n \"name\": \"Black Friday VIP\",\n \"template\": {\n \"category\": \"marketing\",\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://cdn.exemplo.com.br/bf.png\"\n },\n \"body\": \"Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇\",\n \"variables\": [\n {\n \"example\": \"Maria\",\n \"fill\": {\n \"type\": \"first_name\",\n \"fallback\": \"cliente\"\n }\n },\n {\n \"example\": \"30% off\",\n \"fill\": {\n \"type\": \"fixed_text\",\n \"text\": \"30% off\"\n }\n }\n ],\n \"footer\": \"Responda SAIR para não receber\",\n \"buttons\": [\n {\n \"type\": \"url\",\n \"text\": \"Ver ofertas\",\n \"url\": \"https://loja.exemplo.com.br/black-friday\"\n }\n ]\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.bevits.com/v1/whatsapp-campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Black Friday VIP\",\n \"template\": {\n \"category\": \"marketing\",\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://cdn.exemplo.com.br/bf.png\"\n },\n \"body\": \"Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇\",\n \"variables\": [\n {\n \"example\": \"Maria\",\n \"fill\": {\n \"type\": \"first_name\",\n \"fallback\": \"cliente\"\n }\n },\n {\n \"example\": \"30% off\",\n \"fill\": {\n \"type\": \"fixed_text\",\n \"text\": \"30% off\"\n }\n }\n ],\n \"footer\": \"Responda SAIR para não receber\",\n \"buttons\": [\n {\n \"type\": \"url\",\n \"text\": \"Ver ofertas\",\n \"url\": \"https://loja.exemplo.com.br/black-friday\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/whatsapp-campaigns")
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\": \"Black Friday VIP\",\n \"template\": {\n \"category\": \"marketing\",\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://cdn.exemplo.com.br/bf.png\"\n },\n \"body\": \"Oi {{1}}! A Black Friday começou: {{2}} em toda a loja. Aproveite 👇\",\n \"variables\": [\n {\n \"example\": \"Maria\",\n \"fill\": {\n \"type\": \"first_name\",\n \"fallback\": \"cliente\"\n }\n },\n {\n \"example\": \"30% off\",\n \"fill\": {\n \"type\": \"fixed_text\",\n \"text\": \"30% off\"\n }\n }\n ],\n \"footer\": \"Responda SAIR para não receber\",\n \"buttons\": [\n {\n \"type\": \"url\",\n \"text\": \"Ver ofertas\",\n \"url\": \"https://loja.exemplo.com.br/black-friday\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "whatsapp_campaign_draft",
"validate_only": true,
"name": "<string>",
"status": "draft",
"template": {
"category": "marketing",
"language": "<string>",
"preview": "<string>",
"id": "<string>",
"status": "<string>"
},
"pending": [
"<string>"
],
"next_step": "<string>",
"id": "<string>",
"html_url": "<string>"
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "Invalid API key.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "permission_denied",
"code": "missing_scope",
"message": "This API key does not have the required \"write\" scope.",
"param": "scope",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "The campaign has 1 problem; fix all of them and retry:\n- template.variables: The body has 2 variables but template.variables has 1 entry. Give exactly one per {{n}}, in order.",
"param": "template.variables",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
},
"retry_after": 2
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}Headers
Body
application/json
Response
Campaign validated or saved as a draft, with its template submitted to Meta for review.