# Webhook

> Base URL: `https://pos.pages.fm/api/v1`. Authenticate with the `api_key` query parameter.

## Webhook configuration

`PUT /shops/{SHOP_ID}`

Configure webhook settings. Go to **Setting -> Advance -> Third-party connection -> Webhook/API** to configure:
- Webhook URL (Required)
- Email error message
- Request Headers
- Webhook types: `orders`, `customers`, `products`, `variations_warehouses`, or `auto_call`

## Webhook Response Types

When webhook is enabled, the system sends POST requests to the configured URL. Response schema:

- **`orders`**: See [WebhookOrderResponse](#model/WebhookOrderResponse) schema
- **`customers`**: See [WebhookCustomerResponse](#model/WebhookCustomerResponse) schema
- **`products`**: See [WebhookProductResponse](#model/WebhookProductResponse) schema
- **`variations_warehouses`**: See [WebhookInventoryResponse](#model/WebhookInventoryResponse) schema
- **`auto_call`**: See [WebhookAutoCallResponse](#model/WebhookAutoCallResponse) schema

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |

### Request body

Request body containing information to update

- `shop` (object, required): 
  - `webhook_enable` (boolean): Enable/Disable Webhook
  - `webhook_url` (string (uri)): Link URL
  - `webhook_email` (string (email)): Error message email
  - `webhook_types` (string[]): Webhook data
  - `webhook_partner` (string): Partner
  - `webhook_headers` (object): Webhook headers

```json
{
  "shop": {
    "webhook_enable": true,
    "webhook_url": "https://test.com",
    "webhook_email": "1234@gmail.com",
    "webhook_types": [
      "orders",
      "customers",
      "variations_warehouses"
    ],
    "webhook_partner": "",
    "webhook_headers": {
      "X-API-KEY": "elqsF9ERiFWGacWQO9Gg5XC4kXojot"
    }
  }
}
```

### Responses

- `200` Success (object)

```json
{
  "success": true
}
```
