Automações
Consultar métricas da automação
Leia os totais históricos de ativações e mensagens diretas, além das DMs dos últimos sete dias, para uma automação do Instagram.
GET
/
api
/
v1
/
automations
/
{automationId}
/
metrics
Get automation metrics
curl --request GET \
--url https://levios.app/api/v1/automations/{automationId}/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://levios.app/api/v1/automations/{automationId}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/automations/{automationId}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_automation_metrics_not_found",
"message": "The requested automation metrics were not found.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_internal_error",
"message": "The request could not be completed.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_metrics_read_unavailable",
"message": "The automation metrics could not be read.",
"correlation_id": "<string>"
}
}Use este endpoint para medir uma automação. Envie o ID da automação no
caminho e um
account_id acessível na query string. Sua chave de API precisa
do escopo metrics:read.
A resposta contém:
automation_id: a automação cujas métricas foram consultadas.activations_total: total acumulado de ativações bem-sucedidas da automação.dms_total: total acumulado de intenções de mensagem direta enviadas.dms_last_7d: intenções de mensagem direta enviadas nos últimos sete dias.last_fired_at: timestamp do evento bem-sucedido mais recente ounullse a automação nunca tiver sido acionada.
Exemplo de requisição
curl --get \
--url "https://levios.app/api/v1/automations/${LEVIOS_AUTOMATION_ID}/metrics" \
--header "Authorization: Bearer ${LEVIOS_API_KEY}" \
--data-urlencode "account_id=${LEVIOS_ACCOUNT_ID}"
Get automation metrics
curl --request GET \
--url https://levios.app/api/v1/automations/{automationId}/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://levios.app/api/v1/automations/{automationId}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/automations/{automationId}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_automation_metrics_not_found",
"message": "The requested automation metrics were not found.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_internal_error",
"message": "The request could not be completed.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_metrics_read_unavailable",
"message": "The automation metrics could not be read.",
"correlation_id": "<string>"
}
}
