# Webhooks

## Overview

Webhooks allow your WordPress site to receive real-time updates from Loxo when jobs are created, updated, or deleted. Instead of relying solely on scheduled synchronization, webhooks push changes to your site instantly.

## Supported Events

- **job.create** — Triggered when a new job is published in Loxo. The plugin automatically imports the job into WordPress.
- **job.update** — Triggered when a job is modified in Loxo. The plugin updates the corresponding WordPress post with the latest data.
- **job.destroy** — Triggered when a job is deleted in Loxo. The plugin removes the corresponding WordPress post.

## Setting Up Webhooks

Navigate to **Loxo Jobs → Settings** in your WordPress admin. If your API credentials are configured, you will see a **Webhooks** section. Click the **Register Webhooks** button to register all three webhook events with Loxo.

The plugin registers a callback URL at `/wp-json/loxo/v1/loxo-event` on your site. Loxo sends POST requests to this URL whenever a job event occurs.

## Managing Webhooks

From the settings page you can:

- **Check Status** — View which webhooks are registered and detect any missing ones.
- **Delete Webhooks** — Remove all registered webhooks from Loxo if you no longer want real-time updates.

## Requirements

- Your site must be publicly accessible (not localhost) for Loxo to reach the callback URL.
- API credentials (Agency Slug and API Token) must be configured in the [plugin settings](https://loxo.w4dev.com/docs/plugin-settings/).
- The WordPress REST API must be enabled and accessible.

## Webhooks vs Auto Sync

You can use webhooks and [auto sync](https://loxo.w4dev.com/docs/synchronizing-jobs/) together or independently:

- **Webhooks only** — Instant updates, but if a webhook delivery fails, the change won’t be retried automatically.
- **Auto Sync only** — Reliable but delayed. Jobs are synced on the interval you set under **Auto Sync Setting**. The interval field is blank on a new install and a blank interval is treated as one minute, so type a number — around 300 (five hours) is a sensible starting point — before switching auto sync on.
- **Both (recommended)** — Webhooks provide instant updates while auto sync acts as a safety net to catch anything missed.

## Related documentation

- [REST API](https://loxo.w4dev.com/docs/rest-api/) — register, check, and delete webhooks programmatically.
- [Synchronizing Jobs](https://loxo.w4dev.com/docs/synchronizing-jobs/) — how auto sync compares and complements webhooks.
- [Plugin Settings](https://loxo.w4dev.com/docs/plugin-settings/) — where API credentials are configured.

Source: https://loxo.w4dev.com/docs/webhooks/
