Pular para o conteúdo principal
POST
/
api
/
v1
/
accounts
/
{account_id}
/
conversations
/
filter
Conversations Filter
curl --request POST \
  --url https://airys.chat/api/v1/accounts/{account_id}/conversations/filter \
  --header 'Content-Type: application/json' \
  --header 'api_access_token: <api-key>' \
  --data '
{
  "payload": [
    {
      "attribute_key": "browser_language",
      "filter_operator": "not_equal_to",
      "values": [
        "en"
      ],
      "query_operator": "AND"
    },
    {
      "attribute_key": "status",
      "filter_operator": "equal_to",
      "values": [
        "pending"
      ],
      "query_operator": null
    }
  ]
}
'
import requests

url = "https://airys.chat/api/v1/accounts/{account_id}/conversations/filter"

payload = { "payload": [
{
"attribute_key": "browser_language",
"filter_operator": "not_equal_to",
"values": ["en"],
"query_operator": "AND"
},
{
"attribute_key": "status",
"filter_operator": "equal_to",
"values": ["pending"],
"query_operator": None
}
] }
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: [
{
attribute_key: 'browser_language',
filter_operator: 'not_equal_to',
values: ['en'],
query_operator: 'AND'
},
{
attribute_key: 'status',
filter_operator: 'equal_to',
values: ['pending'],
query_operator: null
}
]
})
};

fetch('https://airys.chat/api/v1/accounts/{account_id}/conversations/filter', 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://airys.chat/api/v1/accounts/{account_id}/conversations/filter",
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([
'payload' => [
[
'attribute_key' => 'browser_language',
'filter_operator' => 'not_equal_to',
'values' => [
'en'
],
'query_operator' => 'AND'
],
[
'attribute_key' => 'status',
'filter_operator' => 'equal_to',
'values' => [
'pending'
],
'query_operator' => null
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_access_token: <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://airys.chat/api/v1/accounts/{account_id}/conversations/filter"

payload := strings.NewReader("{\n \"payload\": [\n {\n \"attribute_key\": \"browser_language\",\n \"filter_operator\": \"not_equal_to\",\n \"values\": [\n \"en\"\n ],\n \"query_operator\": \"AND\"\n },\n {\n \"attribute_key\": \"status\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\n \"pending\"\n ],\n \"query_operator\": null\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("api_access_token", "<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.post("https://airys.chat/api/v1/accounts/{account_id}/conversations/filter")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": [\n {\n \"attribute_key\": \"browser_language\",\n \"filter_operator\": \"not_equal_to\",\n \"values\": [\n \"en\"\n ],\n \"query_operator\": \"AND\"\n },\n {\n \"attribute_key\": \"status\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\n \"pending\"\n ],\n \"query_operator\": null\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://airys.chat/api/v1/accounts/{account_id}/conversations/filter")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": [\n {\n \"attribute_key\": \"browser_language\",\n \"filter_operator\": \"not_equal_to\",\n \"values\": [\n \"en\"\n ],\n \"query_operator\": \"AND\"\n },\n {\n \"attribute_key\": \"status\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\n \"pending\"\n ],\n \"query_operator\": null\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "meta": {
      "mine_count": 123,
      "unassigned_count": 123,
      "assigned_count": 123,
      "all_count": 123
    },
    "payload": [
      {
        "id": 123,
        "messages": [
          {
            "id": 123,
            "content": "<string>",
            "account_id": 123,
            "inbox_id": 123,
            "conversation_id": 123,
            "created_at": 123,
            "updated_at": 123,
            "private": true,
            "source_id": "<string>",
            "content_attributes": {},
            "sender_id": 123,
            "external_source_ids": {},
            "additional_attributes": {},
            "processed_message_content": "<string>",
            "sentiment": {},
            "conversation": {},
            "attachment": {},
            "sender": {}
          }
        ],
        "account_id": 123,
        "uuid": "<string>",
        "additional_attributes": {},
        "agent_last_seen_at": 123,
        "assignee_last_seen_at": 123,
        "can_reply": true,
        "contact_last_seen_at": 123,
        "custom_attributes": {},
        "inbox_id": 123,
        "labels": [
          "<string>"
        ],
        "muted": true,
        "snoozed_until": 123,
        "created_at": 123,
        "updated_at": 123,
        "timestamp": 123,
        "first_reply_created_at": 123,
        "unread_count": 123,
        "last_non_activity_message": {
          "id": 123,
          "content": "<string>",
          "account_id": 123,
          "inbox_id": 123,
          "conversation_id": 123,
          "created_at": 123,
          "updated_at": 123,
          "private": true,
          "source_id": "<string>",
          "content_attributes": {},
          "sender_id": 123,
          "external_source_ids": {},
          "additional_attributes": {},
          "processed_message_content": "<string>",
          "sentiment": {},
          "conversation": {},
          "attachment": {},
          "sender": {}
        },
        "last_activity_at": 123,
        "priority": "<string>",
        "waiting_since": 123,
        "sla_policy_id": 123,
        "applied_sla": {},
        "sla_events": [
          {}
        ],
        "meta": {
          "sender": {
            "additional_attributes": {},
            "availability_status": "<string>",
            "email": "<string>",
            "id": 123,
            "name": "<string>",
            "phone_number": "<string>",
            "blocked": true,
            "identifier": "<string>",
            "thumbnail": "<string>",
            "custom_attributes": {},
            "last_activity_at": 123,
            "created_at": 123
          },
          "channel": "<string>",
          "assignee": {
            "id": 123,
            "access_token": "<string>",
            "account_id": 123,
            "available_name": "<string>",
            "avatar_url": "<string>",
            "confirmed": true,
            "display_name": "<string>",
            "message_signature": "<string>",
            "email": "<string>",
            "hmac_identifier": "<string>",
            "inviter_id": 123,
            "name": "<string>",
            "provider": "<string>",
            "pubsub_token": "<string>",
            "ui_settings": {},
            "uid": "<string>",
            "type": "<string>",
            "custom_attributes": {},
            "accounts": [
              {
                "id": 123,
                "name": "<string>",
                "status": "<string>",
                "active_at": "2023-11-07T05:31:56Z",
                "permissions": [
                  "<string>"
                ],
                "availability": "<string>",
                "availability_status": "<string>",
                "auto_offline": true,
                "custom_role_id": 123,
                "custom_role": {}
              }
            ]
          },
          "hmac_verified": true
        }
      }
    ]
  }
}
{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}

Autorizações

api_access_token
string
header
obrigatório

Este token pode ser obtido visitando a página de perfil ou por meio do console rails. Fornece acesso a endpoints com base nos níveis de permissões do usuário. Este token pode ser salvo por um sistema externo quando o usuário é criado via API, para realizar atividades em nome do usuário.

Parâmetros de caminho

account_id
integer
obrigatório

O ID numérico da conta

Parâmetros de consulta

page
number

Corpo

application/json
payload
object[]
Exemplo:
[
{
"attribute_key": "browser_language",
"filter_operator": "not_equal_to",
"values": ["en"],
"query_operator": "AND"
},
{
"attribute_key": "status",
"filter_operator": "equal_to",
"values": ["pending"],
"query_operator": null
}
]

Resposta

Sucesso

data
object