WhatsApp
Upload flow JSON
Upload or replace a DRAFT flow’s Flow JSON - the screens, components, and navigation that define the form. Meta validates on upload; the response’s validation_errors comes back either way, so a successful upload doesn’t guarantee the flow is publishable yet. Requires social:write.
PUT
/
whatsapp
/
flows
/
{flow_id}
/
json
Upload flow JSON
curl --request PUT \
--url https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": 42,
"flow_json": {
"version": "6.0",
"screens": [
{
"id": "APPOINTMENT",
"title": "Book appointment",
"terminal": true,
"layout": {
"type": "SingleColumnLayout",
"children": []
}
}
]
}
}
'import requests
url = "https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json"
payload = {
"account_id": 42,
"flow_json": {
"version": "6.0",
"screens": [
{
"id": "APPOINTMENT",
"title": "Book appointment",
"terminal": True,
"layout": {
"type": "SingleColumnLayout",
"children": []
}
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 42,
flow_json: {
version: '6.0',
screens: [
{
id: 'APPOINTMENT',
title: 'Book appointment',
terminal: true,
layout: {type: 'SingleColumnLayout', children: []}
}
]
}
})
};
fetch('https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json', 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.smartlyq.com/v1/whatsapp/flows/{flow_id}/json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 42,
'flow_json' => [
'version' => '6.0',
'screens' => [
[
'id' => 'APPOINTMENT',
'title' => 'Book appointment',
'terminal' => true,
'layout' => [
'type' => 'SingleColumnLayout',
'children' => [
]
]
]
]
]
]),
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.smartlyq.com/v1/whatsapp/flows/{flow_id}/json"
payload := strings.NewReader("{\n \"account_id\": 42,\n \"flow_json\": {\n \"version\": \"6.0\",\n \"screens\": [\n {\n \"id\": \"APPOINTMENT\",\n \"title\": \"Book appointment\",\n \"terminal\": true,\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": []\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": 42,\n \"flow_json\": {\n \"version\": \"6.0\",\n \"screens\": [\n {\n \"id\": \"APPOINTMENT\",\n \"title\": \"Book appointment\",\n \"terminal\": true,\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": []\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": 42,\n \"flow_json\": {\n \"version\": \"6.0\",\n \"screens\": [\n {\n \"id\": \"APPOINTMENT\",\n \"title\": \"Book appointment\",\n \"terminal\": true,\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": []\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"uploaded": true,
"validation_errors": [
{}
]
}
}Authorizations
API key from Developer dashboard (Bearer token).
Path Parameters
Body
application/json
⌘I
Upload flow JSON
curl --request PUT \
--url https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": 42,
"flow_json": {
"version": "6.0",
"screens": [
{
"id": "APPOINTMENT",
"title": "Book appointment",
"terminal": true,
"layout": {
"type": "SingleColumnLayout",
"children": []
}
}
]
}
}
'import requests
url = "https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json"
payload = {
"account_id": 42,
"flow_json": {
"version": "6.0",
"screens": [
{
"id": "APPOINTMENT",
"title": "Book appointment",
"terminal": True,
"layout": {
"type": "SingleColumnLayout",
"children": []
}
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 42,
flow_json: {
version: '6.0',
screens: [
{
id: 'APPOINTMENT',
title: 'Book appointment',
terminal: true,
layout: {type: 'SingleColumnLayout', children: []}
}
]
}
})
};
fetch('https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json', 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.smartlyq.com/v1/whatsapp/flows/{flow_id}/json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 42,
'flow_json' => [
'version' => '6.0',
'screens' => [
[
'id' => 'APPOINTMENT',
'title' => 'Book appointment',
'terminal' => true,
'layout' => [
'type' => 'SingleColumnLayout',
'children' => [
]
]
]
]
]
]),
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.smartlyq.com/v1/whatsapp/flows/{flow_id}/json"
payload := strings.NewReader("{\n \"account_id\": 42,\n \"flow_json\": {\n \"version\": \"6.0\",\n \"screens\": [\n {\n \"id\": \"APPOINTMENT\",\n \"title\": \"Book appointment\",\n \"terminal\": true,\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": []\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": 42,\n \"flow_json\": {\n \"version\": \"6.0\",\n \"screens\": [\n {\n \"id\": \"APPOINTMENT\",\n \"title\": \"Book appointment\",\n \"terminal\": true,\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": []\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smartlyq.com/v1/whatsapp/flows/{flow_id}/json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": 42,\n \"flow_json\": {\n \"version\": \"6.0\",\n \"screens\": [\n {\n \"id\": \"APPOINTMENT\",\n \"title\": \"Book appointment\",\n \"terminal\": true,\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": []\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"uploaded": true,
"validation_errors": [
{}
]
}
}
