Visualizar mensagens do canal
curl --request GET \
--url https://{host}/api/{session}/channels/{id}/messages/preview \
--header 'apikey: <api-key>'import requests
url = "https://{host}/api/{session}/channels/{id}/messages/preview"
headers = {"apikey": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {apikey: '<api-key>'}};
fetch('https://{host}/api/{session}/channels/{id}/messages/preview', 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://{host}/api/{session}/channels/{id}/messages/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"apikey: <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://{host}/api/{session}/channels/{id}/messages/preview"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("apikey", "<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://{host}/api/{session}/channels/{id}/messages/preview")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/channels/{id}/messages/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"messages": [
{
"id": "msg_123",
"content": "Bem-vindo ao nosso canal!",
"timestamp": 1672531200
},
{
"id": "msg_124",
"content": "Confira as novidades desta semana",
"timestamp": 1672617600
}
]
}
Canais
Visualizar Mensagens do Canal
Visualizar prévia das mensagens de um canal antes de segui-lo
GET
/
api
/
{session}
/
channels
/
{id}
/
messages
/
preview
Visualizar mensagens do canal
curl --request GET \
--url https://{host}/api/{session}/channels/{id}/messages/preview \
--header 'apikey: <api-key>'import requests
url = "https://{host}/api/{session}/channels/{id}/messages/preview"
headers = {"apikey": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {apikey: '<api-key>'}};
fetch('https://{host}/api/{session}/channels/{id}/messages/preview', 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://{host}/api/{session}/channels/{id}/messages/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"apikey: <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://{host}/api/{session}/channels/{id}/messages/preview"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("apikey", "<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://{host}/api/{session}/channels/{id}/messages/preview")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/channels/{id}/messages/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"messages": [
{
"id": "msg_123",
"content": "Bem-vindo ao nosso canal!",
"timestamp": 1672531200
},
{
"id": "msg_124",
"content": "Confira as novidades desta semana",
"timestamp": 1672617600
}
]
}
Descrição
Este endpoint permite visualizar uma prévia das mensagens de um canal sem precisar segui-lo. É útil para ver o conteúdo do canal antes de decidir se deseja segui-lo.Parâmetros de URL
Parâmetros de Query
Resposta
{
"messages": [
{
"id": "msg_123",
"content": "Bem-vindo ao nosso canal!",
"timestamp": 1672531200
},
{
"id": "msg_124",
"content": "Confira as novidades desta semana",
"timestamp": 1672617600
}
]
}
Códigos de Status
200- Prévia obtida com sucesso400- Parâmetros inválidos ou faltando código de convite401- Não autorizado404- Canal não encontrado500- Erro interno do servidor
Exemplo de Uso
curl -X GET "https://api.wappfy.com.br/api/my-session/channels/123456789@newsletter/messages/preview?invite=ABC123&limit=10"
const session = 'my-session';
const channelId = '123456789@newsletter';
const invite = 'ABC123';
const limit = 10;
const response = await fetch(
`https://api.wappfy.com.br/api/${session}/channels/${channelId}/messages/preview?invite=${invite}&limit=${limit}`
);
const data = await response.json();
console.log(data.messages);
import requests
session = 'my-session'
channel_id = '123456789@newsletter'
invite = 'ABC123'
limit = 10
response = requests.get(
f'https://api.wappfy.com.br/api/{session}/channels/{channel_id}/messages/preview',
params={'invite': invite, 'limit': limit}
)
data = response.json()
print(data['messages'])
