Definir presença da sessão
curl --request POST \
--url https://{host}/api/{session}/presence \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"chatId": "5511999999999@c.us"
}
'import requests
url = "https://{host}/api/{session}/presence"
payload = { "chatId": "5511999999999@c.us" }
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'})
};
fetch('https://{host}/api/{session}/presence', 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}/presence",
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'
]),
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}/presence"
payload := strings.NewReader("{\n \"chatId\": \"5511999999999@c.us\"\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}/presence")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"5511999999999@c.us\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/presence")
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}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Presença atualizada com sucesso",
"status": "AVAILABLE"
}
Presença
Definir Presença da Sessão
Definir o status de presença (online/offline) da sessão WhatsApp
POST
/
api
/
{session}
/
presence
Definir presença da sessão
curl --request POST \
--url https://{host}/api/{session}/presence \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"chatId": "5511999999999@c.us"
}
'import requests
url = "https://{host}/api/{session}/presence"
payload = { "chatId": "5511999999999@c.us" }
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'})
};
fetch('https://{host}/api/{session}/presence', 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}/presence",
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'
]),
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}/presence"
payload := strings.NewReader("{\n \"chatId\": \"5511999999999@c.us\"\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}/presence")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"5511999999999@c.us\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/presence")
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}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Presença atualizada com sucesso",
"status": "AVAILABLE"
}
Descrição
Este endpoint permite definir o status de presença da sessão WhatsApp, controlando se a conta aparece como disponível (online) ou indisponível (offline) para outros usuários.Parâmetros de URL
string
required
ID único da sessão WhatsApp
Body
{
"status": "valor"
}
Parâmetros do Body
| Propriedade | Tipo | Obrigatório | Descrição |
|---|---|---|---|
status | string | ✅ Sim | Status de presença a ser definido. Valores aceitos: - AVAILABLE - Aparece como disponível/online - UNAVAILABLE - Aparece como indisponível/offline |
Resposta
{
"success": true,
"message": "Presença atualizada com sucesso",
"status": "AVAILABLE"
}
Códigos de Status
200- Presença atualizada com sucesso400- Parâmetros inválidos (status deve ser AVAILABLE ou UNAVAILABLE)401- Não autorizado404- Sessão não encontrada
Exemplo de Uso
curl -X POST https://api.wappfy.com.br/api/my-session/presence \
-H "Content-Type: application/json" \
-d '{
"status": "AVAILABLE"
}'
const session = 'my-session';
const response = await fetch(`https://api.wappfy.com.br/api/${session}/presence`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
status: 'AVAILABLE'
})
});
const data = await response.json();
console.log(data);
import requests
session = 'my-session'
response = requests.post(
f'https://api.wappfy.com.br/api/{session}/presence',
json={'status': 'AVAILABLE'}
)
data = response.json()
print(data)
Notas
- O status
AVAILABLEfará com que a conta apareça como online para outros usuários - O status
UNAVAILABLEfará com que a conta apareça como offline - Esta configuração pode ser útil para controlar a visibilidade da presença da automação
Authorizations
Sua chave de API do Wappfy (obtenha em dash.wappfy.com.br)
Path Parameters
Nome da sessão (instanceName)
Body
application/json
Response
201 - undefined
