Criar flow como rascunho
curl --request POST \
--url https://api.bevits.com/v1/flows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Boleto a pagar",
"trigger": {
"platform": "nuvemshop",
"event": "order_created"
},
"start": "is_boleto",
"nodes": [
{
"key": "is_boleto",
"type": "condition",
"field": "order.paymentMethod",
"operator": "equals",
"value": "boleto",
"if_true": "wait_1_day"
},
{
"key": "wait_1_day",
"type": "wait",
"amount": 1,
"unit": "days",
"next": "still_pending"
},
{
"key": "still_pending",
"type": "condition",
"field": "order.paymentStatus",
"operator": "equals",
"value": "pending",
"if_true": "remind"
},
{
"key": "remind",
"type": "send_whatsapp",
"template_id": "wtp_..."
}
]
}
'import requests
url = "https://api.bevits.com/v1/flows"
payload = {
"name": "Boleto a pagar",
"trigger": {
"platform": "nuvemshop",
"event": "order_created"
},
"start": "is_boleto",
"nodes": [
{
"key": "is_boleto",
"type": "condition",
"field": "order.paymentMethod",
"operator": "equals",
"value": "boleto",
"if_true": "wait_1_day"
},
{
"key": "wait_1_day",
"type": "wait",
"amount": 1,
"unit": "days",
"next": "still_pending"
},
{
"key": "still_pending",
"type": "condition",
"field": "order.paymentStatus",
"operator": "equals",
"value": "pending",
"if_true": "remind"
},
{
"key": "remind",
"type": "send_whatsapp",
"template_id": "wtp_..."
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Boleto a pagar',
trigger: {platform: 'nuvemshop', event: 'order_created'},
start: 'is_boleto',
nodes: [
{
key: 'is_boleto',
type: 'condition',
field: 'order.paymentMethod',
operator: 'equals',
value: 'boleto',
if_true: 'wait_1_day'
},
{
key: 'wait_1_day',
type: 'wait',
amount: 1,
unit: 'days',
next: 'still_pending'
},
{
key: 'still_pending',
type: 'condition',
field: 'order.paymentStatus',
operator: 'equals',
value: 'pending',
if_true: 'remind'
},
{key: 'remind', type: 'send_whatsapp', template_id: 'wtp_...'}
]
})
};
fetch('https://api.bevits.com/v1/flows', 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.bevits.com/v1/flows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Boleto a pagar',
'trigger' => [
'platform' => 'nuvemshop',
'event' => 'order_created'
],
'start' => 'is_boleto',
'nodes' => [
[
'key' => 'is_boleto',
'type' => 'condition',
'field' => 'order.paymentMethod',
'operator' => 'equals',
'value' => 'boleto',
'if_true' => 'wait_1_day'
],
[
'key' => 'wait_1_day',
'type' => 'wait',
'amount' => 1,
'unit' => 'days',
'next' => 'still_pending'
],
[
'key' => 'still_pending',
'type' => 'condition',
'field' => 'order.paymentStatus',
'operator' => 'equals',
'value' => 'pending',
'if_true' => 'remind'
],
[
'key' => 'remind',
'type' => 'send_whatsapp',
'template_id' => 'wtp_...'
]
]
]),
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.bevits.com/v1/flows"
payload := strings.NewReader("{\n \"name\": \"Boleto a pagar\",\n \"trigger\": {\n \"platform\": \"nuvemshop\",\n \"event\": \"order_created\"\n },\n \"start\": \"is_boleto\",\n \"nodes\": [\n {\n \"key\": \"is_boleto\",\n \"type\": \"condition\",\n \"field\": \"order.paymentMethod\",\n \"operator\": \"equals\",\n \"value\": \"boleto\",\n \"if_true\": \"wait_1_day\"\n },\n {\n \"key\": \"wait_1_day\",\n \"type\": \"wait\",\n \"amount\": 1,\n \"unit\": \"days\",\n \"next\": \"still_pending\"\n },\n {\n \"key\": \"still_pending\",\n \"type\": \"condition\",\n \"field\": \"order.paymentStatus\",\n \"operator\": \"equals\",\n \"value\": \"pending\",\n \"if_true\": \"remind\"\n },\n {\n \"key\": \"remind\",\n \"type\": \"send_whatsapp\",\n \"template_id\": \"wtp_...\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.bevits.com/v1/flows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Boleto a pagar\",\n \"trigger\": {\n \"platform\": \"nuvemshop\",\n \"event\": \"order_created\"\n },\n \"start\": \"is_boleto\",\n \"nodes\": [\n {\n \"key\": \"is_boleto\",\n \"type\": \"condition\",\n \"field\": \"order.paymentMethod\",\n \"operator\": \"equals\",\n \"value\": \"boleto\",\n \"if_true\": \"wait_1_day\"\n },\n {\n \"key\": \"wait_1_day\",\n \"type\": \"wait\",\n \"amount\": 1,\n \"unit\": \"days\",\n \"next\": \"still_pending\"\n },\n {\n \"key\": \"still_pending\",\n \"type\": \"condition\",\n \"field\": \"order.paymentStatus\",\n \"operator\": \"equals\",\n \"value\": \"pending\",\n \"if_true\": \"remind\"\n },\n {\n \"key\": \"remind\",\n \"type\": \"send_whatsapp\",\n \"template_id\": \"wtp_...\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/flows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Boleto a pagar\",\n \"trigger\": {\n \"platform\": \"nuvemshop\",\n \"event\": \"order_created\"\n },\n \"start\": \"is_boleto\",\n \"nodes\": [\n {\n \"key\": \"is_boleto\",\n \"type\": \"condition\",\n \"field\": \"order.paymentMethod\",\n \"operator\": \"equals\",\n \"value\": \"boleto\",\n \"if_true\": \"wait_1_day\"\n },\n {\n \"key\": \"wait_1_day\",\n \"type\": \"wait\",\n \"amount\": 1,\n \"unit\": \"days\",\n \"next\": \"still_pending\"\n },\n {\n \"key\": \"still_pending\",\n \"type\": \"condition\",\n \"field\": \"order.paymentStatus\",\n \"operator\": \"equals\",\n \"value\": \"pending\",\n \"if_true\": \"remind\"\n },\n {\n \"key\": \"remind\",\n \"type\": \"send_whatsapp\",\n \"template_id\": \"wtp_...\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "flow_draft",
"validate_only": true,
"status": "draft",
"trigger": {
"platform": "<string>",
"event": "<string>"
},
"outline": [
"<string>"
],
"warnings": [
{
"code": "<string>",
"path": "<string>",
"message": "<string>",
"node_key": "<string>"
}
],
"next_step": "<string>",
"id": "<string>",
"revision": "<string>",
"html_url": "<string>"
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "Invalid API key.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "permission_denied",
"message": "This API key does not have the required \"write\" scope.",
"param": "scope",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
},
"retry_after": 2
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Referência
Criar flow como rascunho
Cria um flow de automação a partir de uma descrição declarativa. O flow é sempre salvo como rascunho e não envia nada até ser ativado. Com validate_only, apenas valida e devolve o resumo, sem salvar. Exige uma API key com o escopo write.
POST
/
v1
/
flows
Criar flow como rascunho
curl --request POST \
--url https://api.bevits.com/v1/flows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Boleto a pagar",
"trigger": {
"platform": "nuvemshop",
"event": "order_created"
},
"start": "is_boleto",
"nodes": [
{
"key": "is_boleto",
"type": "condition",
"field": "order.paymentMethod",
"operator": "equals",
"value": "boleto",
"if_true": "wait_1_day"
},
{
"key": "wait_1_day",
"type": "wait",
"amount": 1,
"unit": "days",
"next": "still_pending"
},
{
"key": "still_pending",
"type": "condition",
"field": "order.paymentStatus",
"operator": "equals",
"value": "pending",
"if_true": "remind"
},
{
"key": "remind",
"type": "send_whatsapp",
"template_id": "wtp_..."
}
]
}
'import requests
url = "https://api.bevits.com/v1/flows"
payload = {
"name": "Boleto a pagar",
"trigger": {
"platform": "nuvemshop",
"event": "order_created"
},
"start": "is_boleto",
"nodes": [
{
"key": "is_boleto",
"type": "condition",
"field": "order.paymentMethod",
"operator": "equals",
"value": "boleto",
"if_true": "wait_1_day"
},
{
"key": "wait_1_day",
"type": "wait",
"amount": 1,
"unit": "days",
"next": "still_pending"
},
{
"key": "still_pending",
"type": "condition",
"field": "order.paymentStatus",
"operator": "equals",
"value": "pending",
"if_true": "remind"
},
{
"key": "remind",
"type": "send_whatsapp",
"template_id": "wtp_..."
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Boleto a pagar',
trigger: {platform: 'nuvemshop', event: 'order_created'},
start: 'is_boleto',
nodes: [
{
key: 'is_boleto',
type: 'condition',
field: 'order.paymentMethod',
operator: 'equals',
value: 'boleto',
if_true: 'wait_1_day'
},
{
key: 'wait_1_day',
type: 'wait',
amount: 1,
unit: 'days',
next: 'still_pending'
},
{
key: 'still_pending',
type: 'condition',
field: 'order.paymentStatus',
operator: 'equals',
value: 'pending',
if_true: 'remind'
},
{key: 'remind', type: 'send_whatsapp', template_id: 'wtp_...'}
]
})
};
fetch('https://api.bevits.com/v1/flows', 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.bevits.com/v1/flows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Boleto a pagar',
'trigger' => [
'platform' => 'nuvemshop',
'event' => 'order_created'
],
'start' => 'is_boleto',
'nodes' => [
[
'key' => 'is_boleto',
'type' => 'condition',
'field' => 'order.paymentMethod',
'operator' => 'equals',
'value' => 'boleto',
'if_true' => 'wait_1_day'
],
[
'key' => 'wait_1_day',
'type' => 'wait',
'amount' => 1,
'unit' => 'days',
'next' => 'still_pending'
],
[
'key' => 'still_pending',
'type' => 'condition',
'field' => 'order.paymentStatus',
'operator' => 'equals',
'value' => 'pending',
'if_true' => 'remind'
],
[
'key' => 'remind',
'type' => 'send_whatsapp',
'template_id' => 'wtp_...'
]
]
]),
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.bevits.com/v1/flows"
payload := strings.NewReader("{\n \"name\": \"Boleto a pagar\",\n \"trigger\": {\n \"platform\": \"nuvemshop\",\n \"event\": \"order_created\"\n },\n \"start\": \"is_boleto\",\n \"nodes\": [\n {\n \"key\": \"is_boleto\",\n \"type\": \"condition\",\n \"field\": \"order.paymentMethod\",\n \"operator\": \"equals\",\n \"value\": \"boleto\",\n \"if_true\": \"wait_1_day\"\n },\n {\n \"key\": \"wait_1_day\",\n \"type\": \"wait\",\n \"amount\": 1,\n \"unit\": \"days\",\n \"next\": \"still_pending\"\n },\n {\n \"key\": \"still_pending\",\n \"type\": \"condition\",\n \"field\": \"order.paymentStatus\",\n \"operator\": \"equals\",\n \"value\": \"pending\",\n \"if_true\": \"remind\"\n },\n {\n \"key\": \"remind\",\n \"type\": \"send_whatsapp\",\n \"template_id\": \"wtp_...\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.bevits.com/v1/flows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Boleto a pagar\",\n \"trigger\": {\n \"platform\": \"nuvemshop\",\n \"event\": \"order_created\"\n },\n \"start\": \"is_boleto\",\n \"nodes\": [\n {\n \"key\": \"is_boleto\",\n \"type\": \"condition\",\n \"field\": \"order.paymentMethod\",\n \"operator\": \"equals\",\n \"value\": \"boleto\",\n \"if_true\": \"wait_1_day\"\n },\n {\n \"key\": \"wait_1_day\",\n \"type\": \"wait\",\n \"amount\": 1,\n \"unit\": \"days\",\n \"next\": \"still_pending\"\n },\n {\n \"key\": \"still_pending\",\n \"type\": \"condition\",\n \"field\": \"order.paymentStatus\",\n \"operator\": \"equals\",\n \"value\": \"pending\",\n \"if_true\": \"remind\"\n },\n {\n \"key\": \"remind\",\n \"type\": \"send_whatsapp\",\n \"template_id\": \"wtp_...\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/flows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Boleto a pagar\",\n \"trigger\": {\n \"platform\": \"nuvemshop\",\n \"event\": \"order_created\"\n },\n \"start\": \"is_boleto\",\n \"nodes\": [\n {\n \"key\": \"is_boleto\",\n \"type\": \"condition\",\n \"field\": \"order.paymentMethod\",\n \"operator\": \"equals\",\n \"value\": \"boleto\",\n \"if_true\": \"wait_1_day\"\n },\n {\n \"key\": \"wait_1_day\",\n \"type\": \"wait\",\n \"amount\": 1,\n \"unit\": \"days\",\n \"next\": \"still_pending\"\n },\n {\n \"key\": \"still_pending\",\n \"type\": \"condition\",\n \"field\": \"order.paymentStatus\",\n \"operator\": \"equals\",\n \"value\": \"pending\",\n \"if_true\": \"remind\"\n },\n {\n \"key\": \"remind\",\n \"type\": \"send_whatsapp\",\n \"template_id\": \"wtp_...\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "flow_draft",
"validate_only": true,
"status": "draft",
"trigger": {
"platform": "<string>",
"event": "<string>"
},
"outline": [
"<string>"
],
"warnings": [
{
"code": "<string>",
"path": "<string>",
"message": "<string>",
"node_key": "<string>"
}
],
"next_step": "<string>",
"id": "<string>",
"revision": "<string>",
"html_url": "<string>"
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "Invalid API key.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "permission_denied",
"message": "This API key does not have the required \"write\" scope.",
"param": "scope",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
},
"retry_after": 2
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Cabeçalhos
Corpo
application/json
Resposta
Flow validado ou salvo como rascunho.