Preview channel messages
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 channel!",
"timestamp": 1672531200
},
{
"id": "msg_124",
"content": "Confira as novidades desta semana",
"timestamp": 1672617600
}
]
}
Channels
Visualizar Mensagens of the Channel
Visualizar prévia das messages of um channel antes of segui-lo
GET
/
api
/
{session}
/
channels
/
{id}
/
messages
/
preview
Preview channel messages
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 channel!",
"timestamp": 1672531200
},
{
"id": "msg_124",
"content": "Confira as novidades desta semana",
"timestamp": 1672617600
}
]
}
Description
This endpoint allows you to preview messages of um channel without needing to follow it. It is useful to see the content of the channel before deciding whether to follow it.URL Parameters
string
required
WhatsApp unique authenticated session ID
string
required
ID único of the channel que deis visualizar as messages
Parâmetros of Query
string
required
Code of invite of the channel
number
default:"10"
Número maximum of messages a retornar (default: 10)
Response
array
{
"messages": [
{
"id": "msg_123",
"content": "Bem-vindo ao nosso channel!",
"timestamp": 1672531200
},
{
"id": "msg_124",
"content": "Confira as novidades desta semana",
"timestamp": 1672617600
}
]
}
Status Codes
200- Prévia obtained successfully400- Invalid parameters or faltandthe code of invite401- Unauthorized404- Channel not found500- Internal server error
Usage Example
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'])
Authorizations
Your Wappfy API key (get it at dash.wappfy.com.br)
Path Parameters
Session name (instanceName)
