Atualizar Flow
Renomeia e/ou recategoriza um Flow ainda em DRAFT. Aceita exatamente name e categories — e a omissão é a guarda: publicar é irreversível, então tem rota própria (POST /v1/flows/{id}/publish), assim como depreciar. Campo desconhecido é RECUSADO com 400 FLOW_UNKNOWN_FIELDS, nunca ignorado. Não mandar nenhum dos dois dá 400 FLOW_PATCH_EMPTY — e não um 200 sobre uma mudança que não aconteceu. Permissão flows:manage.
Exige chave com escopo de número. Uma chave de tenant precisa nomear o número no header x-whatsapp-number-id, senão recebe 403 TENANT_SCOPE_NOT_ALLOWED.
curl --request PATCH \
--url https://pilotstatus.com.br/v1/flows/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Agendamento (matriz)",
"categories": [
"APPOINTMENT_BOOKING"
]
}
'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}"
payload = {
"name": "Agendamento (matriz)",
"categories": ["APPOINTMENT_BOOKING"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Agendamento (matriz)', categories: ['APPOINTMENT_BOOKING']})
};
fetch('https://pilotstatus.com.br/v1/flows/{id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Agendamento (matriz)',
'categories' => [
'APPOINTMENT_BOOKING'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/flows/{id}"
payload := strings.NewReader("{\n \"name\": \"Agendamento (matriz)\",\n \"categories\": [\n \"APPOINTMENT_BOOKING\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.patch("https://pilotstatus.com.br/v1/flows/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Agendamento (matriz)\",\n \"categories\": [\n \"APPOINTMENT_BOOKING\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Agendamento (matriz)\",\n \"categories\": [\n \"APPOINTMENT_BOOKING\"\n ]\n}"
response = http.request(request)
puts response.read_bodyAutorizações
Sua chave de API ps_
Parâmetros de caminho
O id local do Flow — o campo id que GET /v1/flows devolve, nunca o metaFlowId.
Corpo
Novo nome. Vazio ou só espaços é recusado.
1"Agendamento (matriz)"
1SIGN_UP, SIGN_IN, APPOINTMENT_BOOKING, LEAD_GENERATION, CONTACT_US, CUSTOMER_SUPPORT, SURVEY, OTHER ["APPOINTMENT_BOOKING"]
Resposta
Flow atualizado
Esta página foi útil?
curl --request PATCH \
--url https://pilotstatus.com.br/v1/flows/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Agendamento (matriz)",
"categories": [
"APPOINTMENT_BOOKING"
]
}
'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}"
payload = {
"name": "Agendamento (matriz)",
"categories": ["APPOINTMENT_BOOKING"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Agendamento (matriz)', categories: ['APPOINTMENT_BOOKING']})
};
fetch('https://pilotstatus.com.br/v1/flows/{id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Agendamento (matriz)',
'categories' => [
'APPOINTMENT_BOOKING'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/flows/{id}"
payload := strings.NewReader("{\n \"name\": \"Agendamento (matriz)\",\n \"categories\": [\n \"APPOINTMENT_BOOKING\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.patch("https://pilotstatus.com.br/v1/flows/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Agendamento (matriz)\",\n \"categories\": [\n \"APPOINTMENT_BOOKING\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Agendamento (matriz)\",\n \"categories\": [\n \"APPOINTMENT_BOOKING\"\n ]\n}"
response = http.request(request)
puts response.read_body