API de Mensagens
Criar a mensagem
Criar uma mensagem
POST
/
public
/
api
/
v1
/
inboxes
/
{inbox_identifier}
/
contacts
/
{contact_identifier}
/
conversations
/
{conversation_id}
/
messages
Criar a mensagem
curl --request POST \
--url https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages \
--header 'Content-Type: application/json' \
--data '
{
"content": "Hello, how can I help you?",
"echo_id": "1234567890"
}
'import requests
url = "https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages"
payload = {
"content": "Hello, how can I help you?",
"echo_id": "1234567890"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({content: 'Hello, how can I help you?', echo_id: '1234567890'})
};
fetch('https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'content' => 'Hello, how can I help you?',
'echo_id' => '1234567890'
]),
CURLOPT_HTTPHEADER => [
"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://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages"
payload := strings.NewReader("{\n \"content\": \"Hello, how can I help you?\",\n \"echo_id\": \"1234567890\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"Hello, how can I help you?\",\n \"echo_id\": \"1234567890\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"Hello, how can I help you?\",\n \"echo_id\": \"1234567890\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"content": "<string>",
"message_type": 123,
"content_type": "<string>",
"content_attributes": {},
"created_at": 123,
"conversation_id": 123,
"attachments": [
{
"id": 123,
"message_id": 123,
"account_id": 123,
"extension": "<string>",
"data_url": "<string>",
"thumb_url": "<string>",
"file_size": 123,
"width": 123,
"height": 123,
"coordinates_lat": 123,
"coordinates_long": 123,
"fallback_title": "<string>",
"meta": {},
"transcribed_text": "<string>"
}
],
"sender": {
"id": 123,
"name": "<string>",
"avatar_url": "<string>",
"thumbnail": "<string>",
"available_name": "<string>",
"availability_status": "<string>",
"email": "<string>",
"phone_number": "<string>",
"identifier": "<string>",
"blocked": true,
"additional_attributes": {},
"custom_attributes": {},
"description": "<string>",
"created_at": "<string>"
}
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Parâmetros de caminho
O identificador obtido do canal API de caixa de entrada
O id de origem do contato obtido na criação do contato
O ID numérico da conversa
Corpo
application/json
Resposta
Sucesso
Id da mensagem
Conteúdo de texto da mensagem. Pode ser nulo para mensagens com apenas anexos.
Indica o tipo de mensagem. Valores possíveis: 0 (entrada), 1 (saída), 2 (atividade), 3 (modelo)
Tipo de conteúdo da mensagem
Atributos de conteúdo adicionais da mensagem
Timestamp Unix de criação da mensagem
Id de exibição da conversa à qual a mensagem pertence
Anexos, se houver
Show child attributes
Show child attributes
Payload de remetente polimórfico retornado por push_event_data. Os campos disponíveis variam de acordo com o tipo de remetente.
Show child attributes
Show child attributes
⌘I
Criar a mensagem
curl --request POST \
--url https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages \
--header 'Content-Type: application/json' \
--data '
{
"content": "Hello, how can I help you?",
"echo_id": "1234567890"
}
'import requests
url = "https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages"
payload = {
"content": "Hello, how can I help you?",
"echo_id": "1234567890"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({content: 'Hello, how can I help you?', echo_id: '1234567890'})
};
fetch('https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'content' => 'Hello, how can I help you?',
'echo_id' => '1234567890'
]),
CURLOPT_HTTPHEADER => [
"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://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages"
payload := strings.NewReader("{\n \"content\": \"Hello, how can I help you?\",\n \"echo_id\": \"1234567890\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"Hello, how can I help you?\",\n \"echo_id\": \"1234567890\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://airys.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"Hello, how can I help you?\",\n \"echo_id\": \"1234567890\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"content": "<string>",
"message_type": 123,
"content_type": "<string>",
"content_attributes": {},
"created_at": 123,
"conversation_id": 123,
"attachments": [
{
"id": 123,
"message_id": 123,
"account_id": 123,
"extension": "<string>",
"data_url": "<string>",
"thumb_url": "<string>",
"file_size": 123,
"width": 123,
"height": 123,
"coordinates_lat": 123,
"coordinates_long": 123,
"fallback_title": "<string>",
"meta": {},
"transcribed_text": "<string>"
}
],
"sender": {
"id": 123,
"name": "<string>",
"avatar_url": "<string>",
"thumbnail": "<string>",
"available_name": "<string>",
"availability_status": "<string>",
"email": "<string>",
"phone_number": "<string>",
"identifier": "<string>",
"blocked": true,
"additional_attributes": {},
"custom_attributes": {},
"description": "<string>",
"created_at": "<string>"
}
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}