Atualizar status de presença da instância
curl --request POST \
--url https://api.wppfy.com/instance/presence \
--header 'Content-Type: application/json' \
--header 'token: <api-key>' \
--data '
{
"presence": "available"
}
'import requests
url = "https://api.wppfy.com/instance/presence"
payload = { "presence": "available" }
headers = {
"token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({presence: 'available'})
};
fetch('https://api.wppfy.com/instance/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://api.wppfy.com/instance/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([
'presence' => 'available'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"token: <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://api.wppfy.com/instance/presence"
payload := strings.NewReader("{\n \"presence\": \"available\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("token", "<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://api.wppfy.com/instance/presence")
.header("token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"presence\": \"available\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wppfy.com/instance/presence")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"presence\": \"available\"\n}"
response = http.request(request)
puts response.read_body{
"response": "Presence updated successfully"
}{
"error": "<string>"
}{
"error": "client not found"
}{
"error": "No session"
}Instancia
Atualizar status de presença da instância
Atualiza o status de presença global da instância do WhatsApp. Este endpoint permite:
- Definir se a instância está disponível (Aparece “online”) ou indisponível
- Controlar o status de presença para todos os contatos
- Salvar o estado atual da presença na instância
Tipos de presença suportados:
- available: Marca a instância como disponível/online
- unavailable: Marca a instância como indisponível/offline
Atenção:
- O status de presença pode ser temporariamente alterado para “available” (online) em algumas situações internas da API, e com isso o visto por último também pode ser atualizado.
- Caso isso for um problema, considere alterar suas configurações de privacidade no WhatsApp para não mostrar o visto por último e/ou quem pode ver seu status “online”.
⚠️ Importante - Limitação do Presence “unavailable”:
- Quando a API é o único dispositivo ativo: Confirmações de entrega/leitura (ticks cinzas/azuis) não são enviadas nem recebidas
- Impacto: Eventos
message_updatecom status de entrega podem não ser recebidos - Solução: Se precisar das confirmações, mantenha WhatsApp Web ou aplicativo móvel ativo ou use presence “available”
Exemplo de requisição:
{
"presence": "available"
}
Exemplo de resposta:
{
"response": "Presence updated successfully"
}
Erros comuns:
- 401: Token inválido ou expirado
- 400: Valor de presença inválido
- 500: Erro ao atualizar presença
POST
/
instance
/
presence
Atualizar status de presença da instância
curl --request POST \
--url https://api.wppfy.com/instance/presence \
--header 'Content-Type: application/json' \
--header 'token: <api-key>' \
--data '
{
"presence": "available"
}
'import requests
url = "https://api.wppfy.com/instance/presence"
payload = { "presence": "available" }
headers = {
"token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({presence: 'available'})
};
fetch('https://api.wppfy.com/instance/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://api.wppfy.com/instance/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([
'presence' => 'available'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"token: <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://api.wppfy.com/instance/presence"
payload := strings.NewReader("{\n \"presence\": \"available\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("token", "<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://api.wppfy.com/instance/presence")
.header("token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"presence\": \"available\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wppfy.com/instance/presence")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"presence\": \"available\"\n}"
response = http.request(request)
puts response.read_body{
"response": "Presence updated successfully"
}{
"error": "<string>"
}{
"error": "client not found"
}{
"error": "No session"
}Autorizações
Corpo
application/json
Status de presença da instância
Opções disponíveis:
available, unavailable Exemplo:
"available"
Resposta
Presença atualizada com sucesso
Mensagem de confirmação
Exemplo:
"Presence updated successfully"
