Enviar uma mensagem de texto com prévia de link PERSONALIZADA
curl --request POST \
--url https://{host}/api/send/link-custom-preview \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"chatId": "5511999999999@c.us",
"text": "Check this out! https://github.com/",
"preview": {
"url": "https://github.com/",
"title": "Your Title",
"description": "Check this out, amazing!",
"image": {
"url": "https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg"
}
},
"session": "my-session",
"reply_to": null,
"linkPreviewHighQuality": true
}
'import requests
url = "https://{host}/api/send/link-custom-preview"
payload = {
"chatId": "5511999999999@c.us",
"text": "Check this out! https://github.com/",
"preview": {
"url": "https://github.com/",
"title": "Your Title",
"description": "Check this out, amazing!",
"image": { "url": "https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg" }
},
"session": "my-session",
"reply_to": None,
"linkPreviewHighQuality": True
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatId: '5511999999999@c.us',
text: 'Check this out! https://github.com/',
preview: {
url: 'https://github.com/',
title: 'Your Title',
description: 'Check this out, amazing!',
image: {url: 'https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg'}
},
session: 'my-session',
reply_to: null,
linkPreviewHighQuality: true
})
};
fetch('https://{host}/api/send/link-custom-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/send/link-custom-preview",
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([
'chatId' => '5511999999999@c.us',
'text' => 'Check this out! https://github.com/',
'preview' => [
'url' => 'https://github.com/',
'title' => 'Your Title',
'description' => 'Check this out, amazing!',
'image' => [
'url' => 'https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg'
]
],
'session' => 'my-session',
'reply_to' => null,
'linkPreviewHighQuality' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/send/link-custom-preview"
payload := strings.NewReader("{\n \"chatId\": \"5511999999999@c.us\",\n \"text\": \"Check this out! https://github.com/\",\n \"preview\": {\n \"url\": \"https://github.com/\",\n \"title\": \"Your Title\",\n \"description\": \"Check this out, amazing!\",\n \"image\": {\n \"url\": \"https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg\"\n }\n },\n \"session\": \"my-session\",\n \"reply_to\": null,\n \"linkPreviewHighQuality\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://{host}/api/send/link-custom-preview")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"5511999999999@c.us\",\n \"text\": \"Check this out! https://github.com/\",\n \"preview\": {\n \"url\": \"https://github.com/\",\n \"title\": \"Your Title\",\n \"description\": \"Check this out, amazing!\",\n \"image\": {\n \"url\": \"https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg\"\n }\n },\n \"session\": \"my-session\",\n \"reply_to\": null,\n \"linkPreviewHighQuality\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/send/link-custom-preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatId\": \"5511999999999@c.us\",\n \"text\": \"Check this out! https://github.com/\",\n \"preview\": {\n \"url\": \"https://github.com/\",\n \"title\": \"Your Title\",\n \"description\": \"Check this out, amazing!\",\n \"image\": {\n \"url\": \"https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg\"\n }\n },\n \"session\": \"my-session\",\n \"reply_to\": null,\n \"linkPreviewHighQuality\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageId": "3EB0XXXXXX"
}
Mensagens
Link Preview Customizado
Enviar link com preview personalizado
POST
/
api
/
send
/
link-custom-preview
Enviar uma mensagem de texto com prévia de link PERSONALIZADA
curl --request POST \
--url https://{host}/api/send/link-custom-preview \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"chatId": "5511999999999@c.us",
"text": "Check this out! https://github.com/",
"preview": {
"url": "https://github.com/",
"title": "Your Title",
"description": "Check this out, amazing!",
"image": {
"url": "https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg"
}
},
"session": "my-session",
"reply_to": null,
"linkPreviewHighQuality": true
}
'import requests
url = "https://{host}/api/send/link-custom-preview"
payload = {
"chatId": "5511999999999@c.us",
"text": "Check this out! https://github.com/",
"preview": {
"url": "https://github.com/",
"title": "Your Title",
"description": "Check this out, amazing!",
"image": { "url": "https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg" }
},
"session": "my-session",
"reply_to": None,
"linkPreviewHighQuality": True
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatId: '5511999999999@c.us',
text: 'Check this out! https://github.com/',
preview: {
url: 'https://github.com/',
title: 'Your Title',
description: 'Check this out, amazing!',
image: {url: 'https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg'}
},
session: 'my-session',
reply_to: null,
linkPreviewHighQuality: true
})
};
fetch('https://{host}/api/send/link-custom-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/send/link-custom-preview",
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([
'chatId' => '5511999999999@c.us',
'text' => 'Check this out! https://github.com/',
'preview' => [
'url' => 'https://github.com/',
'title' => 'Your Title',
'description' => 'Check this out, amazing!',
'image' => [
'url' => 'https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg'
]
],
'session' => 'my-session',
'reply_to' => null,
'linkPreviewHighQuality' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/send/link-custom-preview"
payload := strings.NewReader("{\n \"chatId\": \"5511999999999@c.us\",\n \"text\": \"Check this out! https://github.com/\",\n \"preview\": {\n \"url\": \"https://github.com/\",\n \"title\": \"Your Title\",\n \"description\": \"Check this out, amazing!\",\n \"image\": {\n \"url\": \"https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg\"\n }\n },\n \"session\": \"my-session\",\n \"reply_to\": null,\n \"linkPreviewHighQuality\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://{host}/api/send/link-custom-preview")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"5511999999999@c.us\",\n \"text\": \"Check this out! https://github.com/\",\n \"preview\": {\n \"url\": \"https://github.com/\",\n \"title\": \"Your Title\",\n \"description\": \"Check this out, amazing!\",\n \"image\": {\n \"url\": \"https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg\"\n }\n },\n \"session\": \"my-session\",\n \"reply_to\": null,\n \"linkPreviewHighQuality\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/send/link-custom-preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatId\": \"5511999999999@c.us\",\n \"text\": \"Check this out! https://github.com/\",\n \"preview\": {\n \"url\": \"https://github.com/\",\n \"title\": \"Your Title\",\n \"description\": \"Check this out, amazing!\",\n \"image\": {\n \"url\": \"https://github.com/stgcompany/wappfy/raw/core/examples/wappfy.jpg\"\n }\n },\n \"session\": \"my-session\",\n \"reply_to\": null,\n \"linkPreviewHighQuality\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageId": "3EB0XXXXXX"
}
Descrição
Este endpoint permite enviar mensagens com links que incluem previews customizados. Você pode definir o título, descrição e imagem que aparecerão no preview do link, em vez de usar o preview automático do WhatsApp.Body
{
"sessionId": "my-session",
"jid": "5511999999999@s.whatsapp.net",
"text": "Olá, como vai?",
"preview": {
"url": "https://exemplo.com",
"title": "Título",
"description": "Descrição",
"image": "valor"
}
}
Parâmetros do Body
| Propriedade | Tipo | Obrigatório | Descrição |
|---|---|---|---|
sessionId | string | ✅ Sim | ID da sessão autenticada que enviará a mensagem |
jid | string | ✅ Sim | Identificador do destinatário (JID do WhatsApp). Formato: 5511999999999@s.whatsapp.net para contatos ou 120363XXXXX@g.us para grupos |
text | string | ✅ Sim | Texto da mensagem que acompanha o link |
preview | object | ✅ Sim | Objeto contendo as informações do preview customizado |
preview.url | string | ✅ Sim | URL do link |
preview.title | string | ✅ Sim | Título que aparecerá no preview |
preview.description | string | ✅ Sim | Descrição que aparecerá no preview |
preview.image | string | ❌ Não | Imagem do preview codificada em base64 |
{
"success": true,
"messageId": "3EB0XXXXXX"
}
Códigos de Status
200- Link com preview customizado enviado com sucesso400- Parâmetros inválidos401- Sessão não autorizada404- Sessão não encontrada
Exemplo de Uso
curl -X POST https://api.wappfy.com.br/api/send/link-custom-preview \
-H "Content-Type: application/json" \
-d '{
"sessionId": "my-session",
"jid": "5511999999999@s.whatsapp.net",
"text": "Confira nossa promoção especial!",
"preview": {
"url": "https://exemplo.com/promocao",
"title": "Promoção Especial - 50% OFF",
"description": "Aproveite descontos incríveis em todos os produtos",
"image": "iVBORw0KGgoAAAANSUhEUgA..."
}
}'
const response = await fetch('https://api.wappfy.com.br/api/send/link-custom-preview', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
sessionId: 'my-session',
jid: '5511999999999@s.whatsapp.net',
text: 'Confira nossa promoção especial!',
preview: {
url: 'https://exemplo.com/promocao',
title: 'Promoção Especial - 50% OFF',
description: 'Aproveite descontos incríveis em todos os produtos',
image: 'iVBORw0KGgoAAAANSUhEUgA...' // base64 opcional
}
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.wappfy.com.br/api/send/link-custom-preview',
json={
'sessionId': 'my-session',
'jid': '5511999999999@s.whatsapp.net',
'text': 'Confira nossa promoção especial!',
'preview': {
'url': 'https://exemplo.com/promocao',
'title': 'Promoção Especial - 50% OFF',
'description': 'Aproveite descontos incríveis em todos os produtos',
'image': 'iVBORw0KGgoAAAANSUhEUgA...' # base64 opcional
}
}
)
data = response.json()
print(data)
Authorizations
Sua chave de API do Wappfy (obtenha em dash.wappfy.com.br)
Body
application/json
Example:
"5511999999999@c.us"
Texto da mensagem. DEVE incluir a URL fornecida em preview.url
Show child attributes
Show child attributes
Nome da sessão (instanceName)
Example:
"my-session"
ID da mensagem à qual você deseja responder
Example:
null
Response
201 - application/json
The response is of type object.
⌘I
