Reenviar entrega
POST
/v1/webhooks/{wid}/deliveries/{delivery_id}/retrydesde M3token da instância ou adminQuando usar
Recoloca uma entrega da dead-letter (failed) na fila, com mais 24 horas de prazo. Só entregas failed podem ser reenviadas.
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 |
|---|---|---|
widobrigatório | string | Id do webhook (wh_...). |
delivery_idobrigatório | string | Id da entrega (dlv_...). |
Exemplo
curl -s -X POST "$LITEZAP_URL/v1/webhooks/$WEBHOOK_ID/deliveries/$DELIVERY_ID/retry" \ -H "Authorization: Bearer $LITEZAP_TOKEN"const res = await fetch("http://localhost:8787/v1/webhooks/wh_3c7e1a9f5b2d4806/deliveries/dlv_8b1f4e2a6c9d3075/retry", { method: "POST", headers: { Authorization: `Bearer ${process.env.LITEZAP_TOKEN}` },});console.log(res.status, res.status === 204 ? "" : await res.json());import osimport requests
r = requests.post( "http://localhost:8787/v1/webhooks/wh_3c7e1a9f5b2d4806/deliveries/dlv_8b1f4e2a6c9d3075/retry", headers={"Authorization": f"Bearer {os.environ['LITEZAP_TOKEN']}"}, timeout=150,)print(r.status_code, r.json() if r.content else "")package main
import ( "fmt" "io" "net/http" "os")
func main() { req, _ := http.NewRequest("POST", "http://localhost:8787/v1/webhooks/wh_3c7e1a9f5b2d4806/deliveries/dlv_8b1f4e2a6c9d3075/retry", nil) req.Header.Set("Authorization", "Bearer "+os.Getenv("LITEZAP_TOKEN")) 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/webhooks/wh_3c7e1a9f5b2d4806/deliveries/dlv_8b1f4e2a6c9d3075/retry', [ 'headers' => ['Authorization' => 'Bearer ' . getenv('LITEZAP_TOKEN')], '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 A entrega, de volta a pending.
Campos de Delivery
id | string | |
webhook_id | string | |
event_id | string | |
event_type | string | |
instance_id | string | |
status | "pending" | "delivered" | "failed" | |
attempts | integer | |
next_attempt_at | string | |
expires_at | string | Prazo para entregar antes de ir para a dead-letter. |
last_status_code | integer | |
last_error | string | Ex.: http 503, timeout: ..., blocked: .... |
created_at | string | |
updated_at | string | |
delivered_at | string | |
event | Envelope | |
event.id | string | Id do evento (evt_...). Use para deduplicar. |
event.type | string | |
event.version | 1 | |
event.instance_id | string | |
event.timestamp | string | |
event.data | object | Varia por tipo de evento. |
Erros
| Código | HTTP | Retentável | O que fazer |
|---|---|---|---|
unauthorized | 401 | não | Envie Authorization: Bearer <token> válido. |
not_found | 404 | não | Confira o id do recurso (mensagem, chat, contato, mídia ou webhook). |
conflict | 409 | não | O recurso está num estado que não permite a operação; veja a message. |
shutting_down | 503 | sim | O servidor está reiniciando; tente de novo em alguns segundos. |
Todo erro usa o envelope {"error":{"code","message","retryable"}}. Tabela completa em Erros.
Equivalente na Z-API: (sem equivalente). Veja Migrar da Z-API.
Outras operações de Webhooks: Listar webhooks · Criar webhook · Consultar webhook · Atualizar webhook · Apagar webhook · Listar entregas

