Obtener mensajes de un chat específico
curl --request GET \
--url http://localhost:3000/chat/{chat_jid}/messages \
--header 'Authorization: Basic <encoded-value>'import requests
url = "http://localhost:3000/chat/{chat_jid}/messages"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('http://localhost:3000/chat/{chat_jid}/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_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/chat/{chat_jid}/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 => [
"Authorization: Basic <encoded-value>"
],
]);
$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 := "http://localhost:3000/chat/{chat_jid}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/chat/{chat_jid}/messages")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/chat/{chat_jid}/messages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"code": "SUCCESS",
"message": "Success get chat messages",
"results": {
"data": [
{
"id": "3EB0B430B6F8F1D0E053AC120E0A9E5C",
"chat_jid": "6289685028129@s.whatsapp.net",
"sender_jid": "6289685028129@s.whatsapp.net",
"sender_display_name": "Saved Contact",
"content": "Hello, how are you?",
"timestamp": "2024-01-15T10:30:00Z",
"is_from_me": false,
"media_type": "image",
"reactions": [
{
"emoji": "👍",
"sender_jid": "628123456789@s.whatsapp.net",
"sender_display_name": "Saved Contact",
"is_from_me": false,
"timestamp": "2024-01-15T10:31:00Z"
}
],
"call_metadata": "{\"call_id\":\"ABC\",\"auto_rejected\":false}",
"referral_metadata": "{\"ctwa_clid\":\"clid_123\",\"source_app\":\"whatsapp\"}",
"context_metadata": "{\"replied_to_id\":\"AC625C65EA7143E71D784176C4A90A93\"}",
"filename": "photo.jpg",
"url": "https://media.example.com/file.jpg",
"file_length": 1024768,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"limit": 50,
"offset": 0,
"total": 1250
},
"chat_info": {
"jid": "6289685028129@s.whatsapp.net",
"name": "John Doe",
"last_message_time": "2024-01-15T10:30:00Z",
"ephemeral_expiration": 0,
"created_at": "2024-01-10T08:00:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"archived": false
}
}
}{
"code": 400,
"message": "field cannot be blank",
"results": null
}{
"code": 401,
"message": "Unauthorized access",
"results": null
}{
"code": 404,
"message": "Chat not found",
"results": null
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "you are not loggin",
"results": null
}chat
Obtener mensajes de un chat específico
Recuperar mensajes de una conversación de chat específica con opciones de filtrado
GET
/
chat
/
{chat_jid}
/
messages
Obtener mensajes de un chat específico
curl --request GET \
--url http://localhost:3000/chat/{chat_jid}/messages \
--header 'Authorization: Basic <encoded-value>'import requests
url = "http://localhost:3000/chat/{chat_jid}/messages"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('http://localhost:3000/chat/{chat_jid}/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_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/chat/{chat_jid}/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 => [
"Authorization: Basic <encoded-value>"
],
]);
$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 := "http://localhost:3000/chat/{chat_jid}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/chat/{chat_jid}/messages")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/chat/{chat_jid}/messages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"code": "SUCCESS",
"message": "Success get chat messages",
"results": {
"data": [
{
"id": "3EB0B430B6F8F1D0E053AC120E0A9E5C",
"chat_jid": "6289685028129@s.whatsapp.net",
"sender_jid": "6289685028129@s.whatsapp.net",
"sender_display_name": "Saved Contact",
"content": "Hello, how are you?",
"timestamp": "2024-01-15T10:30:00Z",
"is_from_me": false,
"media_type": "image",
"reactions": [
{
"emoji": "👍",
"sender_jid": "628123456789@s.whatsapp.net",
"sender_display_name": "Saved Contact",
"is_from_me": false,
"timestamp": "2024-01-15T10:31:00Z"
}
],
"call_metadata": "{\"call_id\":\"ABC\",\"auto_rejected\":false}",
"referral_metadata": "{\"ctwa_clid\":\"clid_123\",\"source_app\":\"whatsapp\"}",
"context_metadata": "{\"replied_to_id\":\"AC625C65EA7143E71D784176C4A90A93\"}",
"filename": "photo.jpg",
"url": "https://media.example.com/file.jpg",
"file_length": 1024768,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"limit": 50,
"offset": 0,
"total": 1250
},
"chat_info": {
"jid": "6289685028129@s.whatsapp.net",
"name": "John Doe",
"last_message_time": "2024-01-15T10:30:00Z",
"ephemeral_expiration": 0,
"created_at": "2024-01-10T08:00:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"archived": false
}
}
}{
"code": 400,
"message": "field cannot be blank",
"results": null
}{
"code": 401,
"message": "Unauthorized access",
"results": null
}{
"code": 404,
"message": "Chat not found",
"results": null
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "you are not loggin",
"results": null
}Autorizaciones
Encabezados
Parámetros de ruta
Chat JID (por ejemplo, phone@s.whatsapp.net para individual o groupid@g.us para grupo). Los valores codificados por porcentaje (por ejemplo,%40g.us) son aceptados.
