> For the complete documentation index, see [llms.txt](https://docs.violetlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes.md).

# Webhooks salientes

Haz que Violet llame a tu endpoint HTTPS cuando cambien las entidades que te interesan.

Con los webhooks salientes, tus sistemas se enteran de los cambios a medida que ocurren en lugar de sondear la [API de Violet](https://docs.violetlabs.com/es/funciones/api.md).

Cada solicitud es una solicitud POST JSON firmada y por lotes que lleva solo IDs: qué entidad cambió, cómo y en qué integración. Luego, tu receptor lee los detalles que necesita a través de la API con una [clave de API](https://docs.violetlabs.com/es/funciones/api/genere-una-clave-de-api.md).

Hay dos formas de elegir qué vigila un webhook:

* **Vinculado a una exploración (recomendado).** Una exploración guardada de [Data Explorer](https://docs.violetlabs.com/es/funciones/explorador-de-datos.md) decide qué entidades cuentan, en vivo: sus filtros guardados y la búsqueda seleccionan las entidades, y sus columnas son las propiedades vigiladas, a menos que las personalices.
* **Manual.** Elige los tipos de entidad que quieres vigilar en cada integración y, opcionalmente, las propiedades que quieres vigilar por tipo.

**Quién puede usarlo.** Los webhooks abarcan todo el tenant y los administran los administradores del tenant, en la app o a través de la API con la clave de API de un usuario administrador.

## Inicio rápido

Puedes pasar de cero a una entrega de prueba verificada en cinco pasos. Necesitas acceso de administrador en Violet y algún lugar donde ejecutar un endpoint HTTPS.

1. **Ejecuta un receptor.** Acepta solicitudes POST, comprueba la firma contra el cuerpo en bruto y responde con un 2xx en un plazo de 10 segundos. Aquí tienes una versión mínima en Node.js. Usa la función verify de [Verificar firmas](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/verificar-firmas.md):

   ```javascript
   import express from 'express';
   import { verify } from './verify.js'; // la función bajo "Verificar firmas"

   const app = express();
   const secret = process.env.VIOLET_WEBHOOK_SECRET;

   app.post('/hooks/violet', express.raw({ type: 'application/json' }), (req, res) => {
     const rawBody = req.body.toString('utf8');
     if (!verify(rawBody, req.get('Violet-Signature') ?? '', secret)) {
       return res.sendStatus(401);
     }
     res.sendStatus(204); // reconoce en 10 segundos, luego haz el trabajo
     const { events } = JSON.parse(rawBody);
     for (const event of events) {
       console.log(event.type, event.entityId ?? ''); // evita duplicados por eventId, luego lee la entidad
     }
   });

   app.listen(3000);
   ```
2. **Crea el webhook.** En Violet, abre **Webhooks › Salientes** desde el menú debajo de tu nombre y haz clic en **Crear webhook saliente**. Introduce un nombre y la URL HTTPS de tu endpoint, elige **Vincular una exploración** y elige una exploración guardada, deja los eventos predeterminados y haz clic en **Crear webhook**. Los detalles están en [Configurar un webhook](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/configura-un-webhook.md).
3. **Guarda el secreto de firma.** Copia el secreto que muestra Violet en la configuración de tu receptor, aquí `VIOLET_WEBHOOK_SECRET`. Solo se muestra una vez.
4. **Envía una prueba.** En el menú de kebab del webhook (**⋮**), haz clic en **Enviar prueba**. Tu receptor registra un evento ping (`subscription.ping`), y **Ver entregas** muestra la solicitud como **Entregada**.
5. **Carga tu conjunto inicial.** Vincular no envía eventos para entidades que ya coinciden. Recórrelas una vez con `POST /api/explore/{explorationId}/results`, como en [Re-sincroniza un webhook vinculado](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/entrega-y-reintentos.md#resync-a-linked-webhook). A partir de entonces, cada evento nombra una entidad que leer con el [endpoint de Entidades](https://docs.violetlabs.com/es/funciones/api/puntos-de-conexion/entidades.md).

## En esta sección

* [Configurar un webhook](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/configura-un-webhook.md)
* [Eventos y cargas útiles](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/eventos-y-cargas-utiles.md)
* [Verificar firmas](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/verificar-firmas.md)
* [Entrega y reintentos](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/entrega-y-reintentos.md)
* [Administrar y supervisar](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/gestionar-y-supervisar.md)
* [Referencia de la carga útil](https://docs.violetlabs.com/features/api/outbound-webhooks/payload-reference)
* [Especificación OpenAPI](https://docs.violetlabs.com/es/funciones/api/webhooks-salientes/especificacion-openapi.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.violetlabs.com/es/funciones/api/webhooks-salientes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
