Automation / Bot Flows
Tenant automation REST surface under /api/automation. See DEVELOPER_DOCUMENTATION.md section 7 for builder specs.
GET List Flows
Optional query: status (active | draft | paused | all).
GET https://api.greenbubble.io/api/automation
cURL
curl -X GET 'https://api.greenbubble.io/api/automation' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation', {
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/automation"
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/automation');
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 Flow
GET https://api.greenbubble.io/api/automation/FLOW_ID
cURL
curl -X GET 'https://api.greenbubble.io/api/automation/FLOW_ID' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/FLOW_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/automation/FLOW_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/automation/FLOW_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;
POST Create Flow
POST https://api.greenbubble.io/api/automation
cURL
curl -X POST 'https://api.greenbubble.io/api/automation' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"Lead Qualification Draft","keyword":"pricing","prefix":"lead","platform":"whatsapp","is_active":false,"return_to":"main_menu","greeting":[{"text":"Welcome. What would you like help with?"},{"goto":"main_menu"}],"screens":{"main_menu":{"type":"menu","header":"Main Menu","body":"Choose one option.","button":"View","sections":[{"title":"Sales","options":[{"title":"Book Demo","description":"Talk to sales","goto":"demo"}]}]}}}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Lead Qualification Draft",
"keyword": "pricing",
"prefix": "lead",
"platform": "whatsapp",
"is_active": false,
"return_to": "main_menu",
"greeting": [
{
"text": "Welcome. What would you like help with?"
},
{
"goto": "main_menu"
}
],
"screens": {
"main_menu": {
"type": "menu",
"header": "Main Menu",
"body": "Choose one option.",
"button": "View",
"sections": [
{
"title": "Sales",
"options": [
{
"title": "Book Demo",
"description": "Talk to sales",
"goto": "demo"
}
]
}
]
}
}
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/automation"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"name": "Lead Qualification Draft",
"keyword": "pricing",
"prefix": "lead",
"platform": "whatsapp",
"is_active": false,
"return_to": "main_menu",
"greeting": [
{
"text": "Welcome. What would you like help with?"
},
{
"goto": "main_menu"
}
],
"screens": {
"main_menu": {
"type": "menu",
"header": "Main Menu",
"body": "Choose one option.",
"button": "View",
"sections": [
{
"title": "Sales",
"options": [
{
"title": "Book Demo",
"description": "Talk to sales",
"goto": "demo"
}
]
}
]
}
}
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/automation');
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, '{"name":"Lead Qualification Draft","keyword":"pricing","prefix":"lead","platform":"whatsapp","is_active":false,"return_to":"main_menu","greeting":[{"text":"Welcome. What would you like help with?"},{"goto":"main_menu"}],"screens":{"main_menu":{"type":"menu","header":"Main Menu","body":"Choose one option.","button":"View","sections":[{"title":"Sales","options":[{"title":"Book Demo","description":"Talk to sales","goto":"demo"}]}]}}}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
PUT Update Flow
PUT https://api.greenbubble.io/api/automation/FLOW_ID
cURL
curl -X PUT 'https://api.greenbubble.io/api/automation/FLOW_ID' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"Updated Flow Name"}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/FLOW_ID', {
method: 'PUT',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Updated Flow Name"
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/automation/FLOW_ID"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"name": "Updated Flow Name"
}
response = requests.put(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/automation/FLOW_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, '{"name":"Updated Flow Name"}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
DELETE Delete Flow
Soft delete; requires confirm: true.
DELETE https://api.greenbubble.io/api/automation/FLOW_ID
cURL
curl -X DELETE 'https://api.greenbubble.io/api/automation/FLOW_ID' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"confirm":true}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/FLOW_ID', {
method: 'DELETE',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"confirm": true
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/automation/FLOW_ID"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"confirm": true
}
response = requests.delete(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/automation/FLOW_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, '{"confirm":true}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
PATCH Toggle Active
PATCH https://api.greenbubble.io/api/automation/FLOW_ID/toggle
cURL
curl -X PATCH 'https://api.greenbubble.io/api/automation/FLOW_ID/toggle' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/FLOW_ID/toggle', {
method: 'PATCH',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/automation/FLOW_ID/toggle"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {}
response = requests.patch(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/automation/FLOW_ID/toggle');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
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;
PATCH Toggle Pause
PATCH https://api.greenbubble.io/api/automation/FLOW_ID/toggle-pause
cURL
curl -X PATCH 'https://api.greenbubble.io/api/automation/FLOW_ID/toggle-pause' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/FLOW_ID/toggle-pause', {
method: 'PATCH',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/automation/FLOW_ID/toggle-pause"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {}
response = requests.patch(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/automation/FLOW_ID/toggle-pause');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
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 Test Flow
POST https://api.greenbubble.io/api/automation/FLOW_ID/test
cURL
curl -X POST 'https://api.greenbubble.io/api/automation/FLOW_ID/test' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"flow_id":"FLOW_ID","test_data":{"message":"pricing","messageType":"text"}}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/FLOW_ID/test', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"flow_id": "FLOW_ID",
"test_data": {
"message": "pricing",
"messageType": "text"
}
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/automation/FLOW_ID/test"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"flow_id": "FLOW_ID",
"test_data": {
"message": "pricing",
"messageType": "text"
}
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/automation/FLOW_ID/test');
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, '{"flow_id":"FLOW_ID","test_data":{"message":"pricing","messageType":"text"}}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
GET List Node Types
GET https://api.greenbubble.io/api/automation/node-types
cURL
curl -X GET 'https://api.greenbubble.io/api/automation/node-types' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/node-types', {
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/automation/node-types"
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/automation/node-types');
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;
POST Suggest Flow (AI)
POST https://api.greenbubble.io/api/automation/suggest
cURL
curl -X POST 'https://api.greenbubble.io/api/automation/suggest' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"businessName":"Greenbubble.io","language":"English","industry":"WhatsApp automation","purpose":"Qualify inbound leads","action":"Ask what they need and route them","tone":"helpful","occasion":"General","additionalDetails":"Keep inactive until approved.","platform":"whatsapp"}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/suggest', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"businessName": "Greenbubble.io",
"language": "English",
"industry": "WhatsApp automation",
"purpose": "Qualify inbound leads",
"action": "Ask what they need and route them",
"tone": "helpful",
"occasion": "General",
"additionalDetails": "Keep inactive until approved.",
"platform": "whatsapp"
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/automation/suggest"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"businessName": "Greenbubble.io",
"language": "English",
"industry": "WhatsApp automation",
"purpose": "Qualify inbound leads",
"action": "Ask what they need and route them",
"tone": "helpful",
"occasion": "General",
"additionalDetails": "Keep inactive until approved.",
"platform": "whatsapp"
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/automation/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, '{"businessName":"Greenbubble.io","language":"English","industry":"WhatsApp automation","purpose":"Qualify inbound leads","action":"Ask what they need and route them","tone":"helpful","occasion":"General","additionalDetails":"Keep inactive until approved.","platform":"whatsapp"}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
GET List Flow Executions
GET https://api.greenbubble.io/api/automation/FLOW_ID/executions
cURL
curl -X GET 'https://api.greenbubble.io/api/automation/FLOW_ID/executions' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/FLOW_ID/executions', {
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/automation/FLOW_ID/executions"
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/automation/FLOW_ID/executions');
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 Execution
GET https://api.greenbubble.io/api/automation/executions/EXECUTION_ID
cURL
curl -X GET 'https://api.greenbubble.io/api/automation/executions/EXECUTION_ID' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/executions/EXECUTION_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/automation/executions/EXECUTION_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/automation/executions/EXECUTION_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;
GET Automation Statistics
GET https://api.greenbubble.io/api/automation/statistics
cURL
curl -X GET 'https://api.greenbubble.io/api/automation/statistics' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/automation/statistics', {
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/automation/statistics"
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/automation/statistics');
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;