# Webhooks

Incoming webhooks are a simple way to let Beans know about new events in your shop, such as when a customer completes an order so that they can be rewarded for their loyalty. They are simple URLs to which you send a JSON payload with the message text and some options.&#x20;

### Customer Webhook

Customer Webhook is to let Beans know when a new customer registers in your shop. To post new customer information to Beans just use an HTTP POST request like this one:&#x20;

#### Customer data

```javascript
{
    "id": 1847,
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "is_newsletter": True,
    "tags": ["loyal", "paying"],
    "created_at": "2020-02-06T12:49:47-05:00",
    "updated_at": "2022-02-06T12:49:47-05:00",
}
```

#### Create or update a customer

```bash
curl https://hooks.radix.trybeans.com/v3/hook/radix/vanilla/customer/hook_created \
  --request POST \
  --user :sk_xxxxxxxxxxxxxxxxx \
  --header "Content-Type: application/json" \
  --data '<<customer_data>>'
```

#### Delete a customer

```bash
curl https://hooks.radix.trybeans.com/v3/hook/radix/vanilla/customer/hook_deleted \
  --request POST \
  --user :sk_xxxxxxxxxxxxxxxxx \
  --header "Content-Type: application/json" \
  --data '<<customer_data>>'
```

### Order Webhook

Order Webhook is to let Beans know when a new order is placed in your shop. To post new order information to Beans just use an HTTP POST request like this one:&#x20;

#### Order data

An order can contain a customer object.

```javascript
order_data = {
    "id": 13207,
    "currency": "USD",
    "email": "john.doe@example.com",
    "ref": "13207",
    "total": "53.00",
    "subtotal": "33.00",
    "amount_shipping": "20.00",
    "amount_giftcard": "0.00",
    "amount_tax": "0.00",
    "cancelled_at": None,
    "processed_at": "2022-02-06T12:49:47-05:00",
    "is_fulfilled": False,
    "is_refunded": True,
    "is_paid": True,
    "customer": {
        "id": 1847,
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@example.com",
        "is_newsletter": True,
        "tags": ["loyal", "paying"],
        "created_at": "2020-02-06T12:49:47-05:00",
        "updated_at": "2022-02-06T12:49:47-05:00",
    }
}
```

#### Create or update an order

```bash
curl https://hooks.radix.trybeans.com/v3/hook/radix/vanilla/order/hook_created \
  --request POST \
  --user :sk_xxxxxxxxxxxxxxxxx \
  --header "Content-Type: application/json" \
  --data '<<order_data>>'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.trybeans.com/integrations/api/webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
