Responder status
POST
/v1/instances/{id}/status/{msg_id}/replydesde M10token da instância ou adminQuando usar
Manda um texto ao autor de um status recebido, citando o status (como responder pelo app). Vai pela fila; aceita ?wait=true.
Autenticação
Aceita o token da instância (só a própria instância) ou o token admin. Um token de outra instância recebe 403 forbidden (ou 404 not_found em webhooks de outra instância).
Parâmetros
Caminho
| Nome | Tipo | Descrição |
|---|---|---|
idobrigatório | string | Id da instância (inst_...). |
msg_idobrigatório | string | Id do LiteZap (ou wa_message_id) do status do contato. |
Corpo (JSON)
| Nome | Tipo | Descrição |
|---|---|---|
textobrigatório | string | |
client_message_id | string |
Exemplo
curl -s -X POST "$LITEZAP_URL/v1/instances/$ID/status/$MSG_ID/reply" \ -H "Authorization: Bearer $LITEZAP_TOKEN" \ -d '{"text":"Que lindo!"}'const res = await fetch("http://localhost:8787/v1/instances/inst_7f3a9c2e5b1d4086/status/msg_a41c9e07d2b35f68/reply", { method: "POST", headers: { Authorization: `Bearer ${process.env.LITEZAP_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ "text": "Que lindo!" }),});console.log(res.status, res.status === 204 ? "" : await res.json());import osimport requests
r = requests.post( "http://localhost:8787/v1/instances/inst_7f3a9c2e5b1d4086/status/msg_a41c9e07d2b35f68/reply", headers={"Authorization": f"Bearer {os.environ['LITEZAP_TOKEN']}"}, json={ "text": "Que lindo!", }, timeout=150,)print(r.status_code, r.json() if r.content else "")package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { req, _ := http.NewRequest("POST", "http://localhost:8787/v1/instances/inst_7f3a9c2e5b1d4086/status/msg_a41c9e07d2b35f68/reply", strings.NewReader(`{"text":"Que lindo!"}`)) req.Header.Set("Authorization", "Bearer "+os.Getenv("LITEZAP_TOKEN")) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, _ := io.ReadAll(resp.Body) fmt.Println(resp.Status, string(out))}<?phprequire 'vendor/autoload.php'; // composer require guzzlehttp/guzzle
$client = new GuzzleHttp\Client(['base_uri' => 'http://localhost:8787']);$res = $client->request('POST', '/v1/instances/inst_7f3a9c2e5b1d4086/status/msg_a41c9e07d2b35f68/reply', [ 'headers' => ['Authorization' => 'Bearer ' . getenv('LITEZAP_TOKEN')], 'json' => [ 'text' => 'Que lindo!', ], 'http_errors' => false,]);echo $res->getStatusCode(), ' ', $res->getBody(), PHP_EOL;Nos exemplos, LITEZAP_URL é a URL base (ex.: http://localhost:8787) e o token vem deLITEZAP_TOKEN (instância) ou LITEZAP_ADMIN_TOKEN.
Resposta
200 Enviada.
Campos de Message
id | string | |
client_message_id | string | |
wa_message_id | string | |
chat | string | |
sender | string | |
from_me | boolean | |
source | "contact" | "api" | "device" | "history" | |
type | string | |
text | string | |
media | MediaInfo | |
media.id | string | Id da mídia recebida. |
media.kind | string | |
media.mime | string | |
media.size | integer | |
media.file_name | string | |
media.seconds | integer | |
media.ptt | boolean | |
media.url | string | Caminho da API para baixar (mídia recebida). |
reaction_to | string | |
status | "queued" | "in_flight" | "sent" | "delivered" | "read" | "played" | "failed" | "received" | "pending" | |
attempts | integer | |
error | string | Último erro (codigo: detalhe) de item não enviado. |
timestamp | string |
202 Na fila.
Campos de Message
id | string | |
client_message_id | string | |
wa_message_id | string | |
chat | string | |
sender | string | |
from_me | boolean | |
source | "contact" | "api" | "device" | "history" | |
type | string | |
text | string | |
media | MediaInfo | |
media.id | string | Id da mídia recebida. |
media.kind | string | |
media.mime | string | |
media.size | integer | |
media.file_name | string | |
media.seconds | integer | |
media.ptt | boolean | |
media.url | string | Caminho da API para baixar (mídia recebida). |
reaction_to | string | |
status | "queued" | "in_flight" | "sent" | "delivered" | "read" | "played" | "failed" | "received" | "pending" | |
attempts | integer | |
error | string | Último erro (codigo: detalhe) de item não enviado. |
timestamp | string |
Erros
| Código | HTTP | Retentável | O que fazer |
|---|---|---|---|
validation_failed | 400 | não | Corrija o corpo ou os parâmetros; a message diz o campo. |
unauthorized | 401 | não | Envie Authorization: Bearer <token> válido. |
forbidden | 403 | não | Use o token certo (admin, ou o da própria instância). |
not_found | 404 | não | Confira o id do recurso (mensagem, chat, contato, mídia ou webhook). |
instance_not_found | 404 | não | Confira o id da instância. |
Todo erro usa o envelope {"error":{"code","message","retryable"}}. Tabela completa em Erros.
Eventos gerados
Equivalente na Z-API: Responder status com texto. Veja Migrar da Z-API.
Outras operações de Status: Status recentes · Publicar status · Privacidade do status · Apagar status

