Webhooks
Configure HTTP endpoints to receive real-time notifications when events occur in your AS2 partners.
POST
/api/v1/webhooks/configure
Configure the webhook for a specific partner.
Request Body
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
| partner_id | integer | Sí | Partner for which the webhook is configured |
| webhook_url | string | Webhook target URL | |
| webhook_secret | string | Shared secret used to validate deliveries | |
| webhook_enabled | boolean | Enable or disable the webhook | |
| webhook_events | array | Subscribed events |
Legacy aliases also accepted: webhook_activo, webhook_eventos.
Available events
message.receivedmessage.sentmdn.receivedsend.error
Python example
response = requests.post(
f"{BASE_URL}/webhooks/configure",
headers=headers,
json={
"partner_id": 123,
"webhook_url": "https://myapp.com/webhook/as2",
"webhook_secret": "my_secret",
"webhook_enabled": True,
"webhook_events": ["message.received", "mdn.received"]
}
)
Response
{
"status": "success",
"msg": "Webhook configured"
}
Read and test
POST
/api/v1/webhooks/get
Get the persisted webhook configuration for a partner.
| Campo | Tipo | Requerido |
|---|---|---|
| partner_id | integer | Sí |
POST
/api/v1/webhooks/test
Trigger a test delivery using the first configured event for the partner, or message.received if no explicit event is configured.
| Campo | Tipo | Requerido |
|---|---|---|
| partner_id | integer | Sí |
Response
{
"status": "success",
"http_code": 200,
"requested_event_name": "mensaje.recibido",
"event_name": "mensaje.recibido",
"event": "message.received"
}
POST
/api/v1/webhooks/logs
List webhook delivery logs for a partner.
| Campo | Tipo | Descripción |
|---|---|---|
| partner_id | integer | Required |
| limit | integer | Limit, default 50 |
| offset | integer | Offset |
Real error cases
{"status":"error","msg":"Campo requerido: socio_id"}if the partner identifier is missing.{"status":"error","msg":"Socio no encontrado"}if the partner does not exist in the current site.{"status":"error","msg":"Webhook no activo"}if you try to test a disabled webhook.