```python
The [`WebhooksServer`] class lets you create an instance of a Gradio app that can receive Huggingface webhooks.
These webhooks can be registered using the [`~WebhooksServer.add_webhook`] decorator. Webhook endpoints are added to
the app as a POST endpoint to the FastAPI router. Once all the webhooks are registered, the `launch` method has to be
called to start the app.

It is recommended to accept [`WebhookPayload`] as the first argument of the webhook function. It is a Pydantic
model that contains all the information about the webhook event. The data will be parsed automatically for you.

Check out the [webhooks guide](../guides/webhooks_server) for a step-by-step tutorial on how to setup your
WebhooksServer and deploy it on a Space.

<Tip warning={true}>

`WebhooksServer` is experimental. Its API is subject to change in the future.

</Tip>

<Tip warning={true}>

You must have `gradio` installed to use `WebhooksServer` (`pip install --upgrade gradio`).

</Tip>

Args:
ui (`gradio.Blocks`, optional):
A Gradio UI instance to be used as the Space landing page. If `None`, a UI displaying instructions
about the configured webhooks is created.
webhook_secret (`str`, optional):
A secret key to verify incoming webhook requests. You can set this value to any secret you want as long as
you also configure it in your [webhooks settings panel](https://huggingface.co/settings/webhooks). You
can also set this value as the `WEBHOOK_SECRET` environment variable. If no secret is provided, the
webhook endpoints are opened without any security.

Example:

```python
import gradio as gr
from huggingface_hub import WebhooksServer, WebhookPayload  
with gr.Blocks() as ui:
...  
app = WebhooksServer(ui=ui, webhook_secret="my_secret_key")  
@app.add_webhook("/say_hello")
async def hello(payload: WebhookPayload):
return {"message": "hello"}  
app.launch()
```
```