Message Templates
Create Meta message templates (Cloud API / WABA) via /api/v2/templates/create. List/manage via /api/template (also aliased at /api/v2/templates).
POST Create Simple Template
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"simple_announcement","category":"MARKETING","language":"en_US","message_body":"This is a simple announcement for the season.","footer_text":"Thank you"}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "simple_announcement",
"category": "MARKETING",
"language": "en_US",
"message_body": "This is a simple announcement for the season.",
"footer_text": "Thank you"
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "simple_announcement",
"category": "MARKETING",
"language": "en_US",
"message_body": "This is a simple announcement for the season.",
"footer_text": "Thank you"
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"simple_announcement","category":"MARKETING","language":"en_US","message_body":"This is a simple announcement for the season.","footer_text":"Thank you"}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Template with Variables
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"welcome_offer","category":"MARKETING","language":"en_US","template_type":"standard","header_text":"Hello {{name}}!","message_body":"Hi {{1}}, your order {{2}} has been confirmed. Total: {{3}}.","footer_text":"Reply STOP to unsubscribe","variable_examples":[{"key":"1","example":"John"},{"key":"2","example":"ORD-9876"},{"key":"3","example":"$49.99"}]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "welcome_offer",
"category": "MARKETING",
"language": "en_US",
"template_type": "standard",
"header_text": "Hello {{name}}!",
"message_body": "Hi {{1}}, your order {{2}} has been confirmed. Total: {{3}}.",
"footer_text": "Reply STOP to unsubscribe",
"variable_examples": [
{
"key": "1",
"example": "John"
},
{
"key": "2",
"example": "ORD-9876"
},
{
"key": "3",
"example": "$49.99"
}
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "welcome_offer",
"category": "MARKETING",
"language": "en_US",
"template_type": "standard",
"header_text": "Hello {{name}}!",
"message_body": "Hi {{1}}, your order {{2}} has been confirmed. Total: {{3}}.",
"footer_text": "Reply STOP to unsubscribe",
"variable_examples": [
{
"key": "1",
"example": "John"
},
{
"key": "2",
"example": "ORD-9876"
},
{
"key": "3",
"example": "$49.99"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"welcome_offer","category":"MARKETING","language":"en_US","template_type":"standard","header_text":"Hello {{name}}!","message_body":"Hi {{1}}, your order {{2}} has been confirmed. Total: {{3}}.","footer_text":"Reply STOP to unsubscribe","variable_examples":[{"key":"1","example":"John"},{"key":"2","example":"ORD-9876"},{"key":"3","example":"$49.99"}]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create OTP / Authentication Template
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"otp_verification","category":"AUTHENTICATION","language":"en_US","add_security_recommendation":true,"code_expiration_minutes":10,"otp_code_length":6,"otp_buttons":[{"otp_type":"COPY_CODE","copy_button_text":"Copy Code"}]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "otp_verification",
"category": "AUTHENTICATION",
"language": "en_US",
"add_security_recommendation": true,
"code_expiration_minutes": 10,
"otp_code_length": 6,
"otp_buttons": [
{
"otp_type": "COPY_CODE",
"copy_button_text": "Copy Code"
}
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "otp_verification",
"category": "AUTHENTICATION",
"language": "en_US",
"add_security_recommendation": true,
"code_expiration_minutes": 10,
"otp_code_length": 6,
"otp_buttons": [
{
"otp_type": "COPY_CODE",
"copy_button_text": "Copy Code"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"otp_verification","category":"AUTHENTICATION","language":"en_US","add_security_recommendation":true,"code_expiration_minutes":10,"otp_code_length":6,"otp_buttons":[{"otp_type":"COPY_CODE","copy_button_text":"Copy Code"}]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Template with Quick Reply Buttons
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"feedback_request","category":"UTILITY","language":"en_US","message_body":"How was your experience?","buttons":[{"type":"quick_reply","text":"Excellent"},{"type":"quick_reply","text":"Good"},{"type":"quick_reply","text":"Poor"}]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "feedback_request",
"category": "UTILITY",
"language": "en_US",
"message_body": "How was your experience?",
"buttons": [
{
"type": "quick_reply",
"text": "Excellent"
},
{
"type": "quick_reply",
"text": "Good"
},
{
"type": "quick_reply",
"text": "Poor"
}
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "feedback_request",
"category": "UTILITY",
"language": "en_US",
"message_body": "How was your experience?",
"buttons": [
{
"type": "quick_reply",
"text": "Excellent"
},
{
"type": "quick_reply",
"text": "Good"
},
{
"type": "quick_reply",
"text": "Poor"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"feedback_request","category":"UTILITY","language":"en_US","message_body":"How was your experience?","buttons":[{"type":"quick_reply","text":"Excellent"},{"type":"quick_reply","text":"Good"},{"type":"quick_reply","text":"Poor"}]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Template with CTA Buttons
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"contact_us","category":"MARKETING","language":"en_US","message_body":"Please contact us or visit our website.","buttons":[{"type":"phone_call","text":"Call Support","phone_number":"+1234567890"},{"type":"website","text":"Visit Website","website_url":"https://example.com"}]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "contact_us",
"category": "MARKETING",
"language": "en_US",
"message_body": "Please contact us or visit our website.",
"buttons": [
{
"type": "phone_call",
"text": "Call Support",
"phone_number": "+1234567890"
},
{
"type": "website",
"text": "Visit Website",
"website_url": "https://example.com"
}
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "contact_us",
"category": "MARKETING",
"language": "en_US",
"message_body": "Please contact us or visit our website.",
"buttons": [
{
"type": "phone_call",
"text": "Call Support",
"phone_number": "+1234567890"
},
{
"type": "website",
"text": "Visit Website",
"website_url": "https://example.com"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"contact_us","category":"MARKETING","language":"en_US","message_body":"Please contact us or visit our website.","buttons":[{"type":"phone_call","text":"Call Support","phone_number":"+1234567890"},{"type":"website","text":"Visit Website","website_url":"https://example.com"}]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Template with Coupon Code
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"discount_coupon","category":"MARKETING","language":"en_US","message_body":"Here is your discount code!","buttons":[{"type":"copy_code","text":"SAVE20"}]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "discount_coupon",
"category": "MARKETING",
"language": "en_US",
"message_body": "Here is your discount code!",
"buttons": [
{
"type": "copy_code",
"text": "SAVE20"
}
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "discount_coupon",
"category": "MARKETING",
"language": "en_US",
"message_body": "Here is your discount code!",
"buttons": [
{
"type": "copy_code",
"text": "SAVE20"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"discount_coupon","category":"MARKETING","language":"en_US","message_body":"Here is your discount code!","buttons":[{"type":"copy_code","text":"SAVE20"}]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Limited Time Offer Template
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"flash_sale","category":"MARKETING","language":"en_US","message_body":"Flash sale is ending soon!","is_limited_time_offer":true,"offer_text":"Use code FLASH at checkout","has_expiration":true}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "flash_sale",
"category": "MARKETING",
"language": "en_US",
"message_body": "Flash sale is ending soon!",
"is_limited_time_offer": true,
"offer_text": "Use code FLASH at checkout",
"has_expiration": true
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "flash_sale",
"category": "MARKETING",
"language": "en_US",
"message_body": "Flash sale is ending soon!",
"is_limited_time_offer": true,
"offer_text": "Use code FLASH at checkout",
"has_expiration": true
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"flash_sale","category":"MARKETING","language":"en_US","message_body":"Flash sale is ending soon!","is_limited_time_offer":true,"offer_text":"Use code FLASH at checkout","has_expiration":true}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Template with Catalog Button
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"shop_catalog","category":"MARKETING","language":"en_US","message_body":"Check out our new catalog!","buttons":[{"type":"catalog","text":"View Catalog"}]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "shop_catalog",
"category": "MARKETING",
"language": "en_US",
"message_body": "Check out our new catalog!",
"buttons": [
{
"type": "catalog",
"text": "View Catalog"
}
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "shop_catalog",
"category": "MARKETING",
"language": "en_US",
"message_body": "Check out our new catalog!",
"buttons": [
{
"type": "catalog",
"text": "View Catalog"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"shop_catalog","category":"MARKETING","language":"en_US","message_body":"Check out our new catalog!","buttons":[{"type":"catalog","text":"View Catalog"}]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Template with Call Permission
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"call_request","category":"MARKETING","language":"en_US","message_body":"Can we call you to discuss our offers?","call_permission":true}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "call_request",
"category": "MARKETING",
"language": "en_US",
"message_body": "Can we call you to discuss our offers?",
"call_permission": true
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "call_request",
"category": "MARKETING",
"language": "en_US",
"message_body": "Can we call you to discuss our offers?",
"call_permission": true
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"call_request","category":"MARKETING","language":"en_US","message_body":"Can we call you to discuss our offers?","call_permission":true}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Create Carousel Template
POST https://api.greenbubble.io/api/v2/templates/create
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/templates/create' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"waba_id":"1248119146671221","template_name":"product_carousel","category":"MARKETING","language":"en_US","template_type":"carousel_product","message_body":"Check out these new products","carousel_cards":[{"components":[{"type":"header","format":"IMAGE","example":{"header_url":"https://example.com/img1.png"}},{"type":"body","text":"Product 1"},{"type":"buttons","buttons":[{"type":"url","text":"Buy Now","url":"https://example.com/buy/1"}]}]}]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/templates/create', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"waba_id": "1248119146671221",
"template_name": "product_carousel",
"category": "MARKETING",
"language": "en_US",
"template_type": "carousel_product",
"message_body": "Check out these new products",
"carousel_cards": [
{
"components": [
{
"type": "header",
"format": "IMAGE",
"example": {
"header_url": "https://example.com/img1.png"
}
},
{
"type": "body",
"text": "Product 1"
},
{
"type": "buttons",
"buttons": [
{
"type": "url",
"text": "Buy Now",
"url": "https://example.com/buy/1"
}
]
}
]
}
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/templates/create"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"waba_id": "1248119146671221",
"template_name": "product_carousel",
"category": "MARKETING",
"language": "en_US",
"template_type": "carousel_product",
"message_body": "Check out these new products",
"carousel_cards": [
{
"components": [
{
"type": "header",
"format": "IMAGE",
"example": {
"header_url": "https://example.com/img1.png"
}
},
{
"type": "body",
"text": "Product 1"
},
{
"type": "buttons",
"buttons": [
{
"type": "url",
"text": "Buy Now",
"url": "https://example.com/buy/1"
}
]
}
]
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/templates/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"waba_id":"1248119146671221","template_name":"product_carousel","category":"MARKETING","language":"en_US","template_type":"carousel_product","message_body":"Check out these new products","carousel_cards":[{"components":[{"type":"header","format":"IMAGE","example":{"header_url":"https://example.com/img1.png"}},{"type":"body","text":"Product 1"},{"type":"buttons","buttons":[{"type":"url","text":"Buy Now","url":"https://example.com/buy/1"}]}]}]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
GET List Templates
List templates. Requires waba_id (or sender_id) when platform=whatsapp; returns 400 'WABA ID or sender_id is required' otherwise.
GET https://api.greenbubble.io/api/template?waba_id=1248119146671221&platform=whatsapp
cURL
curl -X GET 'https://api.greenbubble.io/api/template?waba_id=1248119146671221&platform=whatsapp' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/template?waba_id=1248119146671221&platform=whatsapp', {
method: 'GET',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/template?waba_id=1248119146671221&platform=whatsapp"
headers = { "x-api-key": "YOUR_API_KEY" }
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/template?waba_id=1248119146671221&platform=whatsapp');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-api-key: YOUR_API_KEY']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
GET Get Template by ID
GET https://api.greenbubble.io/api/template/TEMPLATE_ID
cURL
curl -X GET 'https://api.greenbubble.io/api/template/TEMPLATE_ID' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/template/TEMPLATE_ID', {
method: 'GET',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/template/TEMPLATE_ID"
headers = { "x-api-key": "YOUR_API_KEY" }
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/template/TEMPLATE_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-api-key: YOUR_API_KEY']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
PUT Update Template
PUT https://api.greenbubble.io/api/template/TEMPLATE_ID
cURL
curl -X PUT 'https://api.greenbubble.io/api/template/TEMPLATE_ID' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"message_body":"Updated body text","category":"UTILITY"}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/template/TEMPLATE_ID', {
method: 'PUT',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"message_body": "Updated body text",
"category": "UTILITY"
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/template/TEMPLATE_ID"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"message_body": "Updated body text",
"category": "UTILITY"
}
response = requests.put(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/template/TEMPLATE_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"message_body":"Updated body text","category":"UTILITY"}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
DELETE Delete Template
DELETE https://api.greenbubble.io/api/template/TEMPLATE_ID
cURL
curl -X DELETE 'https://api.greenbubble.io/api/template/TEMPLATE_ID' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/template/TEMPLATE_ID', {
method: 'DELETE',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/template/TEMPLATE_ID"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {}
response = requests.delete(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/template/TEMPLATE_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Sync Templates from Meta
POST https://api.greenbubble.io/api/template/sync
cURL
curl -X POST 'https://api.greenbubble.io/api/template/sync' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/template/sync', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/template/sync"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/template/sync');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
POST Suggest Template (AI)
POST https://api.greenbubble.io/api/template/suggest
cURL
curl -X POST 'https://api.greenbubble.io/api/template/suggest' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"prompt":"A welcome template for new customers with a discount code"}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/template/suggest', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"prompt": "A welcome template for new customers with a discount code"
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/template/suggest"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"prompt": "A welcome template for new customers with a discount code"
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/template/suggest');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"prompt":"A welcome template for new customers with a discount code"}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;