Configurar mensagens temporárias em chat privado

POST /chat/ephemeral

Define o temporizador de mensagens temporárias (disappearing messages) de um chat privado.

Valores aceitos para a duração:

  • 0 ou off para desativar
  • 1d
  • 7d
  • 90d

Observações:

  • este endpoint é apenas para chats privados
  • se o identificador informado for de grupo, a API retorna erro orientando usar /group/ephemeral
  • a resposta inclui o chat com wa_ephemeralExpiration atualizado

Autenticação

[
  {
    "token": []
  }
]
{
  "token": {
    "name": "token",
    "type": "apiKey",
    "in": "header"
  }
}

Corpo da requisição

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "number",
          "duration"
        ],
        "properties": {
          "number": {
            "type": "string",
            "description": "Identificador do chat privado",
            "example": "5511999999999@s.whatsapp.net"
          },
          "duration": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ],
            "description": "Duração desejada para mensagens temporárias",
            "example": "7d"
          }
        }
      },
      "examples": {
        "ativar_7_dias": {
          "summary": "Ativar por 7 dias",
          "value": {
            "number": "5511999999999@s.whatsapp.net",
            "duration": "7d"
          }
        },
        "desativar": {
          "summary": "Desativar mensagens temporárias",
          "value": {
            "number": "5511999999999@s.whatsapp.net",
            "duration": "off"
          }
        }
      }
    }
  }
}

Respostas

{
  "200": {
    "description": "Temporizador atualizado com sucesso",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "response": {
              "type": "string",
              "example": "Ephemeral timer updated successfully"
            },
            "chat": {
              "$ref": "#/components/schemas/Chat"
            },
            "ephemeral": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean",
                  "example": true
                },
                "seconds": {
                  "type": "integer",
                  "format": "int64",
                  "example": 604800
                },
                "label": {
                  "type": "string",
                  "example": "7d"
                }
              }
            }
          }
        },
        "examples": {
          "sucesso": {
            "summary": "Timer atualizado",
            "value": {
              "response": "Ephemeral timer updated successfully",
              "chat": {
                "wa_chatid": "5511999999999@s.whatsapp.net",
                "wa_ephemeralExpiration": 604800,
                "wa_isGroup": false
              },
              "ephemeral": {
                "enabled": true,
                "seconds": 604800,
                "label": "7d"
              }
            }
          }
        }
      }
    }
  },
  "400": {
    "description": "Payload inválido, chat inválido ou duração não suportada",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "invalid duration. Allowed values: 0, off, 1d, 7d, 90d"
            }
          }
        }
      }
    }
  },
  "401": {
    "description": "Token inválido ou ausente"
  },
  "500": {
    "description": "Erro interno ao atualizar o temporizador",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "Error updating chat ephemeral timer: connection closed"
            }
          }
        }
      }
    }
  }
}

#/components/schemas/Chat

{
  "type": "object",
  "description": "Representa uma conversa/chamado no sistema",
  "properties": {
    "id": {
      "type": "string",
      "description": "ID único da conversa (r + 7 bytes aleatórios em hex)"
    },
    "wa_fastid": {
      "type": "string",
      "description": "Identificador rápido do WhatsApp"
    },
    "wa_chatid": {
      "type": "string",
      "description": "ID completo do chat no WhatsApp"
    },
    "wa_chatlid": {
      "type": "string",
      "description": "LID do chat no WhatsApp (quando disponível)"
    },
    "wa_archived": {
      "type": "boolean",
      "description": "Indica se o chat está arquivado",
      "default": false
    },
    "wa_contactName": {
      "type": "string",
      "description": "Nome salvo na agenda do celular deste número (vazio: não está salvo). A conversa nasce com ele (por LID, pelo número ligado) e ele muda quando o contato é salvo ou apagado no celular.\n",
      "default": ""
    },
    "wa_name": {
      "type": "string",
      "description": "Nome definido pelo usuário no perfil do WhatsApp (\"push name\").\nVem do perfil do contato e pode não estar disponível dependendo do contexto ou da origem dos dados.\n",
      "default": ""
    },
    "name": {
      "type": "string",
      "description": "Nome resolvido pelo sistema como fallback.\nNormalmente consolida o melhor valor disponível entre dados internos, nome vindo do WhatsApp e nome salvo nos contatos.\nPor isso, costuma ter maior chance de vir preenchido.\n",
      "default": ""
    },
    "image": {
      "type": "string",
      "description": "URL da imagem do chat",
      "default": ""
    },
    "imagePreview": {
      "type": "string",
      "description": "URL da miniatura da imagem",
      "default": ""
    },
    "parent_community": {
      "type": "object",
      "description": "Comunidade pai do chat quando ele representa um subgrupo",
      "properties": {
        "jid": {
          "type": "string",
          "format": "jid"
        },
        "name": {
          "type": "string"
        },
        "image_url": {
          "type": "string"
        },
        "image_preview_url": {
          "type": "string"
        },
        "default_subgroup_jid": {
          "type": "string",
          "format": "jid"
        }
      }
    },
    "wa_ephemeralExpiration": {
      "type": "integer",
      "format": "int64",
      "description": "Tempo de expiração de mensagens efêmeras",
      "default": 0
    },
    "wa_isBlocked": {
      "type": "boolean",
      "description": "Indica se o contato está bloqueado",
      "default": false
    },
    "wa_isGroup": {
      "type": "boolean",
      "description": "Indica se é um grupo",
      "default": false
    },
    "wa_isGroup_admin": {
      "type": "boolean",
      "description": "Indica se o usuário é admin do grupo",
      "default": false
    },
    "wa_isGroup_announce": {
      "type": "boolean",
      "description": "Indica se é um grupo somente anúncios",
      "default": false
    },
    "wa_isGroup_community": {
      "type": "boolean",
      "description": "Indica se é uma comunidade",
      "default": false
    },
    "wa_isGroup_member": {
      "type": "boolean",
      "description": "Indica se é membro do grupo",
      "default": false
    },
    "wa_isPinned": {
      "type": "boolean",
      "description": "Indica se o chat está fixado",
      "default": false
    },
    "wa_label": {
      "type": "array",
      "description": "Labels do chat",
      "items": {
        "type": "string"
      }
    },
    "wa_notes": {
      "type": "string",
      "description": "Anotações internas do chat sincronizadas via app state",
      "default": ""
    },
    "wa_lastMessageTextVote": {
      "type": "string",
      "description": "Texto/voto da última mensagem",
      "default": ""
    },
    "wa_lastMessageType": {
      "type": "string",
      "description": "Tipo da última mensagem",
      "default": ""
    },
    "wa_lastMsgTimestamp": {
      "type": "integer",
      "format": "int64",
      "description": "Timestamp da última mensagem",
      "default": 0
    },
    "wa_lastMessageSender": {
      "type": "string",
      "description": "Remetente da última mensagem",
      "default": ""
    },
    "lead_awaitingReply": {
      "type": "boolean",
      "readOnly": true,
      "description": "`true` quando o contato espera resposta: a última mensagem é dele e ninguém concluiu a conversa (`POST /lead/resolve`). A mensagem do contato liga; a nossa (você, a IA, um fluxo ou uma integração) desliga. Nas conversas anteriores a este campo, a api decide pelo remetente (o número ou o LID da instância). Só em conversas com pessoas: ausente em grupos e canais, que não entram em nenhum dos dois filtros, e quando a conversa não tem última mensagem conhecida (só a data). Filtrável no `/chat/find`."
    },
    "wa_muteEndTime": {
      "type": "integer",
      "format": "int64",
      "description": "Timestamp do fim do silenciamento",
      "default": 0
    },
    "owner": {
      "type": "string",
      "description": "Dono da instância",
      "default": ""
    },
    "wa_unreadCount": {
      "type": "integer",
      "format": "int64",
      "description": "Contador de mensagens não lidas",
      "default": 0
    },
    "phone": {
      "type": "string",
      "description": "Número de telefone",
      "default": ""
    },
    "common_groups": {
      "type": "string",
      "description": "Grupos em comum separados por vírgula, formato: (nome_grupo)id_grupo",
      "default": "",
      "example": "Grupo Família(120363123456789012@g.us),Trabalho(987654321098765432@g.us)"
    },
    "lead_name": {
      "type": "string",
      "description": "Nome do lead",
      "default": ""
    },
    "lead_fullName": {
      "type": "string",
      "description": "Nome completo do lead",
      "default": ""
    },
    "lead_email": {
      "type": "string",
      "description": "Email do lead",
      "default": ""
    },
    "lead_personalid": {
      "type": "string",
      "description": "Documento de identificação",
      "default": ""
    },
    "lead_status": {
      "type": "string",
      "description": "Status livre do lead",
      "default": ""
    },
    "lead_tags": {
      "type": "array",
      "description": "Tags do lead. Tags configuradas com `kanban=true` também determinam as\ncolunas em que o cartão aparece no Kanban.\n",
      "items": {
        "type": "string"
      }
    },
    "lead_notes": {
      "type": "string",
      "description": "Anotações sobre o lead",
      "default": ""
    },
    "lead_isTicketOpen": {
      "type": "boolean",
      "description": "Indica se tem ticket aberto",
      "default": false
    },
    "lead_assignedAttendant_id": {
      "type": "string",
      "description": "ID do atendente responsável",
      "default": ""
    },
    "lead_kanbanOrder": {
      "type": "integer",
      "format": "int64",
      "description": "Ordem no kanban",
      "default": 0
    },
    "lead_field01": {
      "type": "string",
      "default": ""
    },
    "lead_field02": {
      "type": "string",
      "default": ""
    },
    "lead_field03": {
      "type": "string",
      "default": ""
    },
    "lead_field04": {
      "type": "string",
      "default": ""
    },
    "lead_field05": {
      "type": "string",
      "default": ""
    },
    "lead_field06": {
      "type": "string",
      "default": ""
    },
    "lead_field07": {
      "type": "string",
      "default": ""
    },
    "lead_field08": {
      "type": "string",
      "default": ""
    },
    "lead_field09": {
      "type": "string",
      "default": ""
    },
    "lead_field10": {
      "type": "string",
      "default": ""
    },
    "lead_field11": {
      "type": "string",
      "default": ""
    },
    "lead_field12": {
      "type": "string",
      "default": ""
    },
    "lead_field13": {
      "type": "string",
      "default": ""
    },
    "lead_field14": {
      "type": "string",
      "default": ""
    },
    "lead_field15": {
      "type": "string",
      "default": ""
    },
    "lead_field16": {
      "type": "string",
      "default": ""
    },
    "lead_field17": {
      "type": "string",
      "default": ""
    },
    "lead_field18": {
      "type": "string",
      "default": ""
    },
    "lead_field19": {
      "type": "string",
      "default": ""
    },
    "lead_field20": {
      "type": "string",
      "default": ""
    },
    "chatbot_agentResetMemoryAt": {
      "type": "integer",
      "format": "int64",
      "description": "Início da memória da IA (ms): o agente só lê as mensagens da conversa a partir daqui. 0: sem corte (vale a janela do agente). Grave pelo `/chat/editLead`.",
      "default": 0
    },
    "chatbot_lastTrigger_id": {
      "type": "string",
      "description": "ID do último gatilho executado",
      "default": ""
    },
    "chatbot_lastTriggerAt": {
      "type": "integer",
      "format": "int64",
      "description": "Timestamp do último gatilho",
      "default": 0
    },
    "chatbot_disableUntil": {
      "type": "integer",
      "format": "int64",
      "description": "Automação (IA, gatilhos e fluxos) pausada nesta conversa até este horário, em milissegundos. `-1`: até alguém religar; `0`: ligada.",
      "default": 0
    },
    "chatbot_summary": {
      "type": "string",
      "description": "Motivo da pausa feita pela automação: pedido de humano (IA ou fluxo; pausa até alguém religar) ou limite de respostas da IA (pausa de 1 hora). Vazio quando não há pausa ou depois que ela acaba. Religar (`chatbot_disableUntil: 0` no `/chat/editLead`) ou concluir (`POST /lead/resolve`) limpa.",
      "default": ""
    }
  }
}

Guias relacionados

Autenticação · Erros e retries · Server URL