Pular para o conteúdo principal
GET
/
api
/
v1
/
accounts
/
{account_id}
/
conversations
/
{conversation_id}
/
messages
Obter mensagens
curl --request GET \
  --url https://airys.chat/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages \
  --header 'api_access_token: <api-key>'
import requests

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

headers = {"api_access_token": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {api_access_token: '<api-key>'}};

fetch('https://airys.chat/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages', 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/{conversation_id}/messages",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "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"
	"net/http"
	"io"
)

func main() {

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

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("api_access_token", "<api-key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://airys.chat/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages")
  .header("api_access_token", "<api-key>")
  .asString();
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)
request["api_access_token"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "meta": {
    "labels": [
      "<string>"
    ],
    "additional_attributes": {},
    "contact": {
      "payload": [
        {
          "additional_attributes": {},
          "availability_status": "<string>",
          "email": "<string>",
          "id": 123,
          "name": "<string>",
          "phone_number": "<string>",
          "blocked": true,
          "identifier": "<string>",
          "thumbnail": "<string>",
          "custom_attributes": {
            "attribute_key": "attribute_value",
            "signed_up_at": "dd/mm/yyyy"
          },
          "last_activity_at": 123,
          "created_at": 123,
          "contact_inboxes": [
            {
              "source_id": "<string>",
              "inbox": {
                "id": 123,
                "avatar_url": "<string>",
                "channel_id": 123,
                "name": "<string>",
                "channel_type": "<string>",
                "provider": "<string>"
              }
            }
          ]
        }
      ]
    },
    "assignee": {
      "id": 123,
      "account_id": 123,
      "auto_offline": true,
      "confirmed": true,
      "email": "<string>",
      "available_name": "<string>",
      "name": "<string>",
      "thumbnail": "<string>",
      "custom_role_id": 123
    },
    "agent_last_seen_at": "2023-11-07T05:31:56Z",
    "assignee_last_seen_at": "2023-11-07T05:31:56Z"
  },
  "payload": [
    {
      "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": {}
    }
  ]
}
{
  "description": "<string>",
  "errors": [
    {
      "field": "<string>",
      "message": "<string>",
      "code": "<string>"
    }
  ]
}
{
  "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

conversation_id
integer
obrigatório

O ID numérico da conversa

Parâmetros de consulta

after
integer

Buscar mensagens após a mensagem com este ID. Retorna até 100 mensagens em ordem crescente.

before
integer

Buscar mensagens antes da mensagem com este ID. Retorna até 20 mensagens em ordem crescente.

Resposta

Sucesso

meta
object
payload
object[]

Matriz de mensagens