Enviar uma mensagem de evento
curl --request POST \
--url https://{host}/api/{session}/events \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data @- <<EOF
{
"chatId": "5511999999999@c.us",
"event": {
"name": "John's Nail Appointment 💅",
"startTime": 2063137000,
"description": "It's time for your nail care session! 🌟\\n\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\n\\n📍 *Location:* Luxe Nail Studio\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\n\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊",
"endTime": null,
"extraGuestsAllowed": false
},
"reply_to": null
}
EOFimport requests
url = "https://{host}/api/{session}/events"
payload = {
"chatId": "5511999999999@c.us",
"event": {
"name": "John's Nail Appointment 💅",
"startTime": 2063137000,
"description": "It's time for your nail care session! 🌟\n\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\n\n📍 *Location:* Luxe Nail Studio\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\n\nFeel free to arrive *5–10 mins early* so we can get started on time 😊",
"endTime": None,
"extraGuestsAllowed": False
},
"reply_to": None
}
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',
event: {
name: 'John\'s Nail Appointment 💅',
startTime: 2063137000,
description: 'It\'s time for your nail care session! 🌟\n\nYou\'ll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\n\n📍 *Location:* Luxe Nail Studio\nWe\'re on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\n\nFeel free to arrive *5–10 mins early* so we can get started on time 😊',
endTime: null,
extraGuestsAllowed: false
},
reply_to: null
})
};
fetch('https://{host}/api/{session}/events', 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}/events",
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',
'event' => [
'name' => 'John\'s Nail Appointment 💅',
'startTime' => 2063137000,
'description' => 'It\'s time for your nail care session! 🌟\\n\\nYou\'ll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\n\\n📍 *Location:* Luxe Nail Studio\\nWe\'re on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\n\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊',
'endTime' => null,
'extraGuestsAllowed' => false
],
'reply_to' => null
]),
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/{session}/events"
payload := strings.NewReader("{\n \"chatId\": \"5511999999999@c.us\",\n \"event\": {\n \"name\": \"John's Nail Appointment 💅\",\n \"startTime\": 2063137000,\n \"description\": \"It's time for your nail care session! 🌟\\\\n\\\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\\\n\\\\n📍 *Location:* Luxe Nail Studio\\\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\\\n\\\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊\",\n \"endTime\": null,\n \"extraGuestsAllowed\": false\n },\n \"reply_to\": null\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/{session}/events")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"5511999999999@c.us\",\n \"event\": {\n \"name\": \"John's Nail Appointment 💅\",\n \"startTime\": 2063137000,\n \"description\": \"It's time for your nail care session! 🌟\\\\n\\\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\\\n\\\\n📍 *Location:* Luxe Nail Studio\\\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\\\n\\\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊\",\n \"endTime\": null,\n \"extraGuestsAllowed\": false\n },\n \"reply_to\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/events")
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 \"event\": {\n \"name\": \"John's Nail Appointment 💅\",\n \"startTime\": 2063137000,\n \"description\": \"It's time for your nail care session! 🌟\\\\n\\\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\\\n\\\\n📍 *Location:* Luxe Nail Studio\\\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\\\n\\\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊\",\n \"endTime\": null,\n \"extraGuestsAllowed\": false\n },\n \"reply_to\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageId": "3EB0XXXXXX"
}
Eventos
Enviar Mensagem de Evento
Enviar mensagem de evento para um contato ou grupo com informações de data, hora e localização
POST
/
api
/
{session}
/
events
Enviar uma mensagem de evento
curl --request POST \
--url https://{host}/api/{session}/events \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data @- <<EOF
{
"chatId": "5511999999999@c.us",
"event": {
"name": "John's Nail Appointment 💅",
"startTime": 2063137000,
"description": "It's time for your nail care session! 🌟\\n\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\n\\n📍 *Location:* Luxe Nail Studio\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\n\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊",
"endTime": null,
"extraGuestsAllowed": false
},
"reply_to": null
}
EOFimport requests
url = "https://{host}/api/{session}/events"
payload = {
"chatId": "5511999999999@c.us",
"event": {
"name": "John's Nail Appointment 💅",
"startTime": 2063137000,
"description": "It's time for your nail care session! 🌟\n\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\n\n📍 *Location:* Luxe Nail Studio\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\n\nFeel free to arrive *5–10 mins early* so we can get started on time 😊",
"endTime": None,
"extraGuestsAllowed": False
},
"reply_to": None
}
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',
event: {
name: 'John\'s Nail Appointment 💅',
startTime: 2063137000,
description: 'It\'s time for your nail care session! 🌟\n\nYou\'ll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\n\n📍 *Location:* Luxe Nail Studio\nWe\'re on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\n\nFeel free to arrive *5–10 mins early* so we can get started on time 😊',
endTime: null,
extraGuestsAllowed: false
},
reply_to: null
})
};
fetch('https://{host}/api/{session}/events', 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}/events",
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',
'event' => [
'name' => 'John\'s Nail Appointment 💅',
'startTime' => 2063137000,
'description' => 'It\'s time for your nail care session! 🌟\\n\\nYou\'ll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\n\\n📍 *Location:* Luxe Nail Studio\\nWe\'re on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\n\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊',
'endTime' => null,
'extraGuestsAllowed' => false
],
'reply_to' => null
]),
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/{session}/events"
payload := strings.NewReader("{\n \"chatId\": \"5511999999999@c.us\",\n \"event\": {\n \"name\": \"John's Nail Appointment 💅\",\n \"startTime\": 2063137000,\n \"description\": \"It's time for your nail care session! 🌟\\\\n\\\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\\\n\\\\n📍 *Location:* Luxe Nail Studio\\\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\\\n\\\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊\",\n \"endTime\": null,\n \"extraGuestsAllowed\": false\n },\n \"reply_to\": null\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/{session}/events")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"5511999999999@c.us\",\n \"event\": {\n \"name\": \"John's Nail Appointment 💅\",\n \"startTime\": 2063137000,\n \"description\": \"It's time for your nail care session! 🌟\\\\n\\\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\\\n\\\\n📍 *Location:* Luxe Nail Studio\\\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\\\n\\\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊\",\n \"endTime\": null,\n \"extraGuestsAllowed\": false\n },\n \"reply_to\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/events")
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 \"event\": {\n \"name\": \"John's Nail Appointment 💅\",\n \"startTime\": 2063137000,\n \"description\": \"It's time for your nail care session! 🌟\\\\n\\\\nYou'll be getting a *classic gel manicure* – clean, polished, and long-lasting. 💖\\\\n\\\\n📍 *Location:* Luxe Nail Studio\\\\nWe're on the *2nd floor of the Plaza Mall*, next to the flower shop. Look for the *pink neon sign*!\\\\n\\\\nFeel free to arrive *5–10 mins early* so we can get started on time 😊\",\n \"endTime\": null,\n \"extraGuestsAllowed\": false\n },\n \"reply_to\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageId": "3EB0XXXXXX"
}
Descrição
Este endpoint permite enviar mensagens de evento para contatos individuais ou grupos no WhatsApp. Eventos podem incluir informações sobre nome, descrição, horários, localização e permissão para convidados extras.Parâmetros de URL
Body
{
"jid": "5511999999999@s.whatsapp.net",
"event": {
"name": "Meu Grupo",
"description": "Descrição",
"startTime": 0,
"endTime": 0,
"location": {
"name": "Meu Grupo",
"latitude": -23.5505,
"longitude": -46.6333
},
"extraGuestsAllowed": true
}
}
Parâmetros do Body
| Propriedade | Tipo | Obrigatório | Descrição |
|---|---|---|---|
jid | string | ✅ Sim | Identificador do destinatário (JID do WhatsApp). Formato: 5511999999999@s.whatsapp.net para contatos ou 120363XXXXX@g.us para grupos |
event | object | ✅ Sim | Objeto contendo as informações do evento |
event.name | string | ✅ Sim | Nome do evento |
event.description | string | ❌ Não | Descrição do evento |
event.startTime | number | ✅ Sim | Timestamp Unix (em milissegundos) indicando o horário de início do evento |
event.endTime | number | ❌ Não | Timestamp Unix (em milissegundos) indicando o horário de término do evento |
event.location | object | ✅ Sim | Informações sobre a localização do evento |
event.location.name | string | ✅ Sim | Nome ou endereço da localização |
event.location.latitude | number | ❌ Não | Latitude da localização |
event.location.longitude | number | ❌ Não | Longitude da localização |
event.extraGuestsAllowed | boolean | ✅ Sim | Define se convidados extras são permitidos no evento |
{
"success": true,
"messageId": "3EB0XXXXXX"
}
Códigos de Status
200- Evento 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/my-session/events \
-H "Content-Type: application/json" \
-d '{
"jid": "5511999999999@s.whatsapp.net",
"event": {
"name": "Reunião de Equipe",
"description": "Discussão sobre o projeto Q1",
"startTime": 1704034800000,
"endTime": 1704038400000,
"location": {
"name": "Sala de Conferências A, Av. Paulista 1000",
"latitude": -23.561684,
"longitude": -46.655981
},
"extraGuestsAllowed": true
}
}'
const response = await fetch('https://api.wappfy.com.br/api/my-session/events', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
jid: '5511999999999@s.whatsapp.net',
event: {
name: 'Reunião de Equipe',
description: 'Discussão sobre o projeto Q1',
startTime: 1704034800000,
endTime: 1704038400000,
location: {
name: 'Sala de Conferências A, Av. Paulista 1000',
latitude: -23.561684,
longitude: -46.655981
},
extraGuestsAllowed: true
}
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.wappfy.com.br/api/my-session/events',
json={
'jid': '5511999999999@s.whatsapp.net',
'event': {
'name': 'Reunião de Equipe',
'description': 'Discussão sobre o projeto Q1',
'startTime': 1704034800000,
'endTime': 1704038400000,
'location': {
'name': 'Sala de Conferências A, Av. Paulista 1000',
'latitude': -23.561684,
'longitude': -46.655981
},
'extraGuestsAllowed': True
}
}
)
data = response.json()
print(data)
Notas Importantes
- Os timestamps devem estar em formato Unix (milissegundos)
- A localização é obrigatória, mas latitude e longitude são opcionais
- Se
extraGuestsAllowedfortrue, os convidados poderão trazer pessoas adicionais - O evento será exibido no WhatsApp com um card especial contendo todas as informações fornecidas
Body
application/json
Response
201 - application/json
