curl --request PUT \
--url https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"version": "2.1",
"data_api_version": "3.0",
"routing_model": {
"MY_FIRST_SCREEN": []
},
"screens": {
"id": "MY_FIRST_SCREEN",
"title": "MY_FIRST_SCREEN",
"terminal": true,
"data": {
"hello_world_text": {
"type": "string",
"__example__": "Hello World"
}
},
"layout": {
"type": "SingleColumnLayout",
"children": [
{
"type": "TextHeading",
"text": "${data.hello_world_text}"
},
{
"type": "Footer",
"label": "Static footer label",
"on-click-action": {
"name": "data_exchange",
"payload": {}
}
}
]
}
}
}
'import requests
url = "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json"
payload = {
"version": "2.1",
"data_api_version": "3.0",
"routing_model": { "MY_FIRST_SCREEN": [] },
"screens": {
"id": "MY_FIRST_SCREEN",
"title": "MY_FIRST_SCREEN",
"terminal": True,
"data": { "hello_world_text": {
"type": "string",
"__example__": "Hello World"
} },
"layout": {
"type": "SingleColumnLayout",
"children": [
{
"type": "TextHeading",
"text": "${data.hello_world_text}"
},
{
"type": "Footer",
"label": "Static footer label",
"on-click-action": {
"name": "data_exchange",
"payload": {}
}
}
]
}
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"version\": \"2.1\",\n \"data_api_version\": \"3.0\",\n \"routing_model\": {\n \"MY_FIRST_SCREEN\": []\n },\n \"screens\": {\n \"id\": \"MY_FIRST_SCREEN\",\n \"title\": \"MY_FIRST_SCREEN\",\n \"terminal\": true,\n \"data\": {\n \"hello_world_text\": {\n \"type\": \"string\",\n \"__example__\": \"Hello World\"\n }\n },\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": [\n {\n \"type\": \"TextHeading\",\n \"text\": \"${data.hello_world_text}\"\n },\n {\n \"type\": \"Footer\",\n \"label\": \"Static footer label\",\n \"on-click-action\": {\n \"name\": \"data_exchange\",\n \"payload\": {}\n }\n }\n ]\n }\n }\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.put("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"2.1\",\n \"data_api_version\": \"3.0\",\n \"routing_model\": {\n \"MY_FIRST_SCREEN\": []\n },\n \"screens\": {\n \"id\": \"MY_FIRST_SCREEN\",\n \"title\": \"MY_FIRST_SCREEN\",\n \"terminal\": true,\n \"data\": {\n \"hello_world_text\": {\n \"type\": \"string\",\n \"__example__\": \"Hello World\"\n }\n },\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": [\n {\n \"type\": \"TextHeading\",\n \"text\": \"${data.hello_world_text}\"\n },\n {\n \"type\": \"Footer\",\n \"label\": \"Static footer label\",\n \"on-click-action\": {\n \"name\": \"data_exchange\",\n \"payload\": {}\n }\n }\n ]\n }\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/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([
'version' => '2.1',
'data_api_version' => '3.0',
'routing_model' => [
'MY_FIRST_SCREEN' => [
]
],
'screens' => [
'id' => 'MY_FIRST_SCREEN',
'title' => 'MY_FIRST_SCREEN',
'terminal' => true,
'data' => [
'hello_world_text' => [
'type' => 'string',
'__example__' => 'Hello World'
]
],
'layout' => [
'type' => 'SingleColumnLayout',
'children' => [
[
'type' => 'TextHeading',
'text' => '${data.hello_world_text}'
],
[
'type' => 'Footer',
'label' => 'Static footer label',
'on-click-action' => [
'name' => 'data_exchange',
'payload' => [
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
version: '2.1',
data_api_version: '3.0',
routing_model: {MY_FIRST_SCREEN: []},
screens: {
id: 'MY_FIRST_SCREEN',
title: 'MY_FIRST_SCREEN',
terminal: true,
data: {hello_world_text: {type: 'string', __example__: 'Hello World'}},
layout: {
type: 'SingleColumnLayout',
children: [
{type: 'TextHeading', text: '${data.hello_world_text}'},
{
type: 'Footer',
label: 'Static footer label',
'on-click-action': {name: 'data_exchange', payload: {}}
}
]
}
}
})
};
fetch('https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"validationErrors": [
{
"error": "INVALID_PROPERTY",
"errorType": "JSON_SCHEMA_ERROR",
"message": "The property \"initial-text\" cannot be specified at \"$root/screens/0/layout/children/2/children/0\".",
"lineStart": 46,
"lineEnd": 46,
"columnStart": 17,
"columnEnd": 30
}
]
}Add WhatsApp Flow JSON
Add WhatsApp Flow JSON. File created from provided JSON content is sent and validated, errors found are provided in response. Regardless of whether any validation errors are returned, the Flow JSON is loaded on the Meta side and the request is considered successful. The maximum size of created file is 10MB. More information about JSON structure can be found under Meta documentation: https://developers.facebook.com/docs/whatsapp/flows/reference/flowjson.
Required scope: Enable one of: whatsapp:manage.
curl --request PUT \
--url https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"version": "2.1",
"data_api_version": "3.0",
"routing_model": {
"MY_FIRST_SCREEN": []
},
"screens": {
"id": "MY_FIRST_SCREEN",
"title": "MY_FIRST_SCREEN",
"terminal": true,
"data": {
"hello_world_text": {
"type": "string",
"__example__": "Hello World"
}
},
"layout": {
"type": "SingleColumnLayout",
"children": [
{
"type": "TextHeading",
"text": "${data.hello_world_text}"
},
{
"type": "Footer",
"label": "Static footer label",
"on-click-action": {
"name": "data_exchange",
"payload": {}
}
}
]
}
}
}
'import requests
url = "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json"
payload = {
"version": "2.1",
"data_api_version": "3.0",
"routing_model": { "MY_FIRST_SCREEN": [] },
"screens": {
"id": "MY_FIRST_SCREEN",
"title": "MY_FIRST_SCREEN",
"terminal": True,
"data": { "hello_world_text": {
"type": "string",
"__example__": "Hello World"
} },
"layout": {
"type": "SingleColumnLayout",
"children": [
{
"type": "TextHeading",
"text": "${data.hello_world_text}"
},
{
"type": "Footer",
"label": "Static footer label",
"on-click-action": {
"name": "data_exchange",
"payload": {}
}
}
]
}
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"version\": \"2.1\",\n \"data_api_version\": \"3.0\",\n \"routing_model\": {\n \"MY_FIRST_SCREEN\": []\n },\n \"screens\": {\n \"id\": \"MY_FIRST_SCREEN\",\n \"title\": \"MY_FIRST_SCREEN\",\n \"terminal\": true,\n \"data\": {\n \"hello_world_text\": {\n \"type\": \"string\",\n \"__example__\": \"Hello World\"\n }\n },\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": [\n {\n \"type\": \"TextHeading\",\n \"text\": \"${data.hello_world_text}\"\n },\n {\n \"type\": \"Footer\",\n \"label\": \"Static footer label\",\n \"on-click-action\": {\n \"name\": \"data_exchange\",\n \"payload\": {}\n }\n }\n ]\n }\n }\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.put("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"2.1\",\n \"data_api_version\": \"3.0\",\n \"routing_model\": {\n \"MY_FIRST_SCREEN\": []\n },\n \"screens\": {\n \"id\": \"MY_FIRST_SCREEN\",\n \"title\": \"MY_FIRST_SCREEN\",\n \"terminal\": true,\n \"data\": {\n \"hello_world_text\": {\n \"type\": \"string\",\n \"__example__\": \"Hello World\"\n }\n },\n \"layout\": {\n \"type\": \"SingleColumnLayout\",\n \"children\": [\n {\n \"type\": \"TextHeading\",\n \"text\": \"${data.hello_world_text}\"\n },\n {\n \"type\": \"Footer\",\n \"label\": \"Static footer label\",\n \"on-click-action\": {\n \"name\": \"data_exchange\",\n \"payload\": {}\n }\n }\n ]\n }\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/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([
'version' => '2.1',
'data_api_version' => '3.0',
'routing_model' => [
'MY_FIRST_SCREEN' => [
]
],
'screens' => [
'id' => 'MY_FIRST_SCREEN',
'title' => 'MY_FIRST_SCREEN',
'terminal' => true,
'data' => [
'hello_world_text' => [
'type' => 'string',
'__example__' => 'Hello World'
]
],
'layout' => [
'type' => 'SingleColumnLayout',
'children' => [
[
'type' => 'TextHeading',
'text' => '${data.hello_world_text}'
],
[
'type' => 'Footer',
'label' => 'Static footer label',
'on-click-action' => [
'name' => 'data_exchange',
'payload' => [
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
version: '2.1',
data_api_version: '3.0',
routing_model: {MY_FIRST_SCREEN: []},
screens: {
id: 'MY_FIRST_SCREEN',
title: 'MY_FIRST_SCREEN',
terminal: true,
data: {hello_world_text: {type: 'string', __example__: 'Hello World'}},
layout: {
type: 'SingleColumnLayout',
children: [
{type: 'TextHeading', text: '${data.hello_world_text}'},
{
type: 'Footer',
label: 'Static footer label',
'on-click-action': {name: 'data_exchange', payload: {}}
}
]
}
}
})
};
fetch('https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/flows/{flowId}/json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"validationErrors": [
{
"error": "INVALID_PROPERTY",
"errorType": "JSON_SCHEMA_ERROR",
"message": "The property \"initial-text\" cannot be specified at \"$root/screens/0/layout/children/2/children/0\".",
"lineStart": 46,
"lineEnd": 46,
"columnStart": 17,
"columnEnd": 30
}
]
}Authorizations
This is the most secure authorization type and the one with the most flexibility.
API keys can be generated by calling the dedicated API method. Furthermore, API keys can have a limited scope and cover only some API methods. Lastly, they can be revoked at any time. This range of possibilities makes API keys well suited for separating the API access rights across multiple applications or use cases. Finally, the loss of an API key is easily manageable.
You can manage your API keys from GUI, or programmatically with dedicated API.
API key Authorization header example:
Authorization: App 003026bbc133714df1834b8638bb496e-8f4b3d9a-e931-478d-a994-28a725159ab9
Path Parameters
Registered WhatsApp sender number. Must be in international format.
1ID of the flow to attach JSON to.
1Body
Flow JSON file content. The size is limited to 10 MB.
Response
Flow JSON Added
Errors found during validation of the uploaded file.
Show child attributes
Show child attributes