curl --request POST \
--url https://app.metricaas.com.br/v1/fluxos/{id}/posts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"media_id": "17895695668004550"
}
'import requests
url = "https://app.metricaas.com.br/v1/fluxos/{id}/posts"
payload = { "media_id": "17895695668004550" }
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({media_id: '17895695668004550'})
};
fetch('https://app.metricaas.com.br/v1/fluxos/{id}/posts', 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://app.metricaas.com.br/v1/fluxos/{id}/posts",
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([
'media_id' => '17895695668004550'
]),
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://app.metricaas.com.br/v1/fluxos/{id}/posts"
payload := strings.NewReader("{\n \"media_id\": \"17895695668004550\"\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://app.metricaas.com.br/v1/fluxos/{id}/posts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"media_id\": \"17895695668004550\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/fluxos/{id}/posts")
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 \"media_id\": \"17895695668004550\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"media_id": "17895695668004550",
"criado_em": "2023-11-07T05:31:56Z",
"criado_por": "user",
"codigo": "<string>",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"novo": true,
"vale_para": "ligados",
"posts_ligados": 123
}
}{
"data": {
"media_id": "17895695668004550",
"criado_em": "2023-11-07T05:31:56Z",
"criado_por": "user",
"codigo": "<string>",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"novo": true,
"vale_para": "ligados",
"posts_ligados": 123
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}Liga um post do Instagram ao fluxo
Exige automations:manage e um token write. O fluxo passa a responder
só aos comentários dos posts ligados — enquanto nenhum estiver ligado,
ele vale para todos os posts da conta.
Idempotente: ligar de novo o mesmo post devolve 200 com
novo: false e não grava nada. Não precisa de Idempotency-Key.
Ligar não cria versão nova do fluxo nem pede publicar.
media_id é o id de mídia da Graph do Instagram (o platform_post_id
do Post For Me), como string: com 17 dígitos ou mais ele passa do
inteiro seguro do JSON e chegaria arredondado.
curl --request POST \
--url https://app.metricaas.com.br/v1/fluxos/{id}/posts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"media_id": "17895695668004550"
}
'import requests
url = "https://app.metricaas.com.br/v1/fluxos/{id}/posts"
payload = { "media_id": "17895695668004550" }
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({media_id: '17895695668004550'})
};
fetch('https://app.metricaas.com.br/v1/fluxos/{id}/posts', 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://app.metricaas.com.br/v1/fluxos/{id}/posts",
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([
'media_id' => '17895695668004550'
]),
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://app.metricaas.com.br/v1/fluxos/{id}/posts"
payload := strings.NewReader("{\n \"media_id\": \"17895695668004550\"\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://app.metricaas.com.br/v1/fluxos/{id}/posts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"media_id\": \"17895695668004550\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/fluxos/{id}/posts")
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 \"media_id\": \"17895695668004550\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"media_id": "17895695668004550",
"criado_em": "2023-11-07T05:31:56Z",
"criado_por": "user",
"codigo": "<string>",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"novo": true,
"vale_para": "ligados",
"posts_ligados": 123
}
}{
"data": {
"media_id": "17895695668004550",
"criado_em": "2023-11-07T05:31:56Z",
"criado_por": "user",
"codigo": "<string>",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"novo": true,
"vale_para": "ligados",
"posts_ligados": 123
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}Authorizations
Authorization: Bearer mcp_… — gere em Configurações → Tokens de API.
O token de API tem modo read ou write. Um token read responde 403
a qualquer verbo que não seja GET. As capacidades do token são a
interseção com as da pessoa de quem ele herda o papel: se ela perder
acesso na grade de Equipe, o token perde junto, sem ninguém revogar nada.
Token de agência (gerado no console da agência): vale para as
empresas da agência, e a empresa de cada chamada vai no header
X-Empresa: <slug da empresa>. Sem o header, 401. Num token de
empresa o header é opcional e, se vier, tem de ser a própria empresa. O
modo read vale igual: um token de agência de leitura só faz GET —
é o token para pôr numa função que só consulta.