> For the complete documentation index, see [llms.txt](https://docs.opencityitalia.it/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opencityitalia.it/stanza-del-cittadino/sviluppatori-e-partner-tecnologici/integrazioni/integrazioni-con-il-flusso-delle-pratiche/webhooks.md).

# Webhooks

Sono un meccanismo di comunicazione tra sistemi che consentono una comunicazione in tempo reale tra due API

Le API non sono sufficienti per realizzare una buona integrazione tra due sistemi. Se due o più sistemi si devono aggiornare reciprocamente in base agli eventi che avvengono al proprio interno, è necessario che periodicamente ogni sistema interroghi gli altri per sapere se il loro stato è cambiato: questo approccio si chiama anche *polling*. Questo è molto oneroso e introduce un ritardo nell'aggiornamento che è tanto maggiore quanto maggiore è l'intervallo con cui un sistema interroga gli altri. D'altra parte se di intensifica la frequenza del polling si avranno maggiori costi a fronte di aggiornamenti magari poco frequenti.

Un modo più efficiente di far dialogare due sistemi è avviare una comunicazione in occasione di cambiamenti rilevanti per il sistema in ascolto e per ottenere questo, eliminando del tutto la necessità di fare *polling*, è possibile usare i Webhook.

Ogni webhook consente di inviare un aggiornamento a una API di un altro sistema che sta ascolto, in base agli eventi che si desidera comunicare.

<figure><img src="https://lh4.googleusercontent.com/e8exe7gAkCIrDo_juCe8vuZ5pE7gZgMFWfK_fROBlBNIkfKD0yZ65HMrklHda34nrUp0L3DH8yBkKbmpHOw54zGvHwSOgkknOxLqtQX70WLZAsWHKqh2h2eKLvJaH-8owANzR1yOLPDGRYw5ye6YcxuBkQ=s2048" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh6.googleusercontent.com/UtwPk5jvScC-tzrIp7qJPOeaQO0XYcnzfCZduBeuMYgHXEKXrSaE_URtx_lGNIUo-3itJ1xB1H0T8b17plvQeA4G3_gzJzLahxOS9rc55yIXOQT4Z8eylLSoJ2Cyjt3ISXVSH9fKeWsPMwtXb5qDOj6zRQ=s2048" alt=""><figcaption></figcaption></figure>

Per fare test sui webhook si consiglia di utilizzare un servizio come [Request Inspector](https://link.opencitylabs.it/request-inspector?utm_source=opencitylabs\&utm_medium=gitbook).


---

# 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.opencityitalia.it/stanza-del-cittadino/sviluppatori-e-partner-tecnologici/integrazioni/integrazioni-con-il-flusso-delle-pratiche/webhooks.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.
