Obtener JSON del Flow
Lee el documento Flow JSON que Meta tiene actualmente para este Flow, en vivo desde el Graph. flowJson es un string, devuelto byte a byte tal como Meta lo sirve (sin interpretar ni reformatear), para que se pueda editar y enviar de vuelta a POST /v1/flows/{id}/json sin cambios. Permiso flows:read. La respuesta es Cache-Control: no-store.
Un Flow que aún no llegó a Meta (metaFlowId: null) es 404 FLOW_NOT_FOUND. Cuando Meta no devuelve ningún documento (un Flow que nunca recibió uno, o una falla transitoria), la respuesta es 502 FLOW_JSON_UNAVAILABLE. Indicar el número en la query (whatsappNumberId, numberId, wabaId, metaWabaId) es 400 FLOW_NUMBER_FROM_KEY; un rechazo del Graph de Meta es 400 con el motivo de Meta en ambos idiomas.
Requiere una clave con alcance de número. Una clave con alcance de tenant debe indicar el número con el header x-whatsapp-number-id, o recibe 403 TENANT_SCOPE_NOT_ALLOWED.
curl --request GET \
--url https://pilotstatus.com.br/v1/flows/{id}/json \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}/json"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/flows/{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://pilotstatus.com.br/v1/flows/{id}/json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/flows/{id}/json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://pilotstatus.com.br/v1/flows/{id}/json")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}/json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "cmf1a2b3c4d5e6f7g8h9i0j1",
"flowJson": "{\"version\":\"7.1\",\"screens\":[{\"id\":\"WELCOME_SCREEN\",\"title\":\"Welcome\",\"terminal\":true,\"layout\":{\"type\":\"SingleColumnLayout\",\"children\":[]}}]}"
}{
"error": "Esta rota não aceita whatsappNumberId na query: o número é o da própria chave de API. Use a chave do número onde o Flow vive.",
"errorEN": "This route does not accept whatsappNumberId in the query: the number is the API key's own. Use the key bound to the number the Flow lives on.",
"code": "FLOW_NUMBER_FROM_KEY"
}{
"error": "Unauthorized"
}{
"error": "This endpoint acts on a single WhatsApp number: send the x-whatsapp-number-id header naming the number to act on (its id or instance id from GET /v1/numbers) | Este endpoint atua sobre um único número de WhatsApp: envie o header x-whatsapp-number-id indicando o número desejado (o id dele ou o id da instância, obtidos em GET /v1/numbers)",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Flow não encontrado para o número desta chave.",
"errorEN": "Flow not found for this key's number.",
"code": "FLOW_NOT_FOUND"
}{
"error": "Flows existem apenas em números Meta (API Oficial). O número desta chave não é Meta ou não tem uma WABA associada — use uma chave de um número Meta.",
"errorEN": "Flows only exist on Meta (Cloud API) numbers. This key's number is not a Meta number, or has no WABA behind it — use a key bound to a Meta number.",
"code": "FLOW_REQUIRES_META_NUMBER"
}{
"error": "Too many requests"
}{
"error": "Erro interno do servidor.",
"errorEN": "Internal server error.",
"code": "INTERNAL_ERROR"
}{
"error": "A Meta não devolveu o documento deste Flow. Se ele nunca recebeu um JSON, envie um; se já recebeu, tente de novo em instantes.",
"errorEN": "Meta returned no document for this Flow. If it never received a JSON, upload one; if it did, try again shortly.",
"code": "FLOW_JSON_UNAVAILABLE"
}¿Esta página le ayudó?
curl --request GET \
--url https://pilotstatus.com.br/v1/flows/{id}/json \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}/json"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/flows/{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://pilotstatus.com.br/v1/flows/{id}/json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/flows/{id}/json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://pilotstatus.com.br/v1/flows/{id}/json")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}/json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "cmf1a2b3c4d5e6f7g8h9i0j1",
"flowJson": "{\"version\":\"7.1\",\"screens\":[{\"id\":\"WELCOME_SCREEN\",\"title\":\"Welcome\",\"terminal\":true,\"layout\":{\"type\":\"SingleColumnLayout\",\"children\":[]}}]}"
}{
"error": "Esta rota não aceita whatsappNumberId na query: o número é o da própria chave de API. Use a chave do número onde o Flow vive.",
"errorEN": "This route does not accept whatsappNumberId in the query: the number is the API key's own. Use the key bound to the number the Flow lives on.",
"code": "FLOW_NUMBER_FROM_KEY"
}{
"error": "Unauthorized"
}{
"error": "This endpoint acts on a single WhatsApp number: send the x-whatsapp-number-id header naming the number to act on (its id or instance id from GET /v1/numbers) | Este endpoint atua sobre um único número de WhatsApp: envie o header x-whatsapp-number-id indicando o número desejado (o id dele ou o id da instância, obtidos em GET /v1/numbers)",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Flow não encontrado para o número desta chave.",
"errorEN": "Flow not found for this key's number.",
"code": "FLOW_NOT_FOUND"
}{
"error": "Flows existem apenas em números Meta (API Oficial). O número desta chave não é Meta ou não tem uma WABA associada — use uma chave de um número Meta.",
"errorEN": "Flows only exist on Meta (Cloud API) numbers. This key's number is not a Meta number, or has no WABA behind it — use a key bound to a Meta number.",
"code": "FLOW_REQUIRES_META_NUMBER"
}{
"error": "Too many requests"
}{
"error": "Erro interno do servidor.",
"errorEN": "Internal server error.",
"code": "INTERNAL_ERROR"
}{
"error": "A Meta não devolveu o documento deste Flow. Se ele nunca recebeu um JSON, envie um; se já recebeu, tente de novo em instantes.",
"errorEN": "Meta returned no document for this Flow. If it never received a JSON, upload one; if it did, try again shortly.",
"code": "FLOW_JSON_UNAVAILABLE"
}