Models and examples

Model body of webhook

Every message is structured like this

{
  "type": "type_event",
   "entity_name": "entity_name",
   "time": "2022-02-22T11:13:04.892Z", // sending date time
   "notification_uuid": "6e766951-7578-4083-81b3-d0082c215d9e", //uuid4 of the notification    
   "environment_id": shop_id",
   "client_id": "clientId_that_generated_the_event",
   "from_user": "user_email_that_generated_the_event",
   "entities": [
        ARRAY ENTITY, //each row has the structure of the entity specified from entity_name. You can find that schema in the documentation api  or for some specific entity at the bottom of this document.
    ],
    "nRetry": 0 // number of the retry.
}

For the DELETE event_type the entities row will be structure with the primary key of entity_name and the uuid field if it's present in the schema.


Entities models exceptions

Daily Closing

{
            "date": "2022-02-23T10:16:01.000Z",
            "created_at": "2022-02-23T10:20:44.000Z",
            "updated_at": "2022-02-23T10:20:44.000Z",
            "id": row_id,
            "uuid": "uuidv4 unique",
            "sequential_number": number,
            "printer_serial": "serial of the printer",
            "printer_id": number_id,
            "printer_name": "name printer",
            "document_content": "xml got from printer",
            "total": float(2 cifre), // totale of the day, can be null
            "unclaimed":float(2 cifre), // can be null, it is the total unclaimed amount
            "vat_amount_1": null,
            "vat_amount_2": null,
            "vat_amount_3": null,
            "vat_amount_4": null,
            "vat_taxable_1": null,
            "vat_taxable_2": null,
            "vat_taxable_3": null,
            "vat_taxable_4": null,
            "vat_tot_1": null,
            "vat_tot_2": null,
            "vat_tot_3": null,
            "vat_tot_4": null,
            "vat_value_1": null,
            "vat_value_2": null,
            "vat_value_3": null,
            "vat_value_4": null
        }

Stock

{
        "id":"",
        "item_id":"",
        "item_on_sale":"",
        "combination_id":"",
        "raw_material_id":"",
        "stock_quantity":"",
        "available":"",
        "unit":"",
        "name":"",
        "barcode":"",
        "options_values":"",
        "combination":"",
        "code":"",
        "lastupdate_at":""
}

Departments

{
            "not_discountable": boolean,
            "display": boolean,
            "id": int,
            "name": "",
            "sales_type": int,// can be null
            "law_ref": null,// can be null
            "vat_id": int,
            "activity_code_id": int, //can be null
            "vat": {
                "id": int,
                "code": "",
                "value": int
            },
            "activity_code": int // can be null
}

Categories

{
            "display": boolean,
            "display_kiosk": boolean,
            "display_website": boolean,
            "created_at": "2022-04-14T11:36:36.000Z",
            "updated_at": "2022-04-14T11:36:36.000Z",
            "id": int,
            "name": ""
 }

Prepaid Movements

{ 
   "customer_uuid": "5aff9c52-9da5-4ff6-ba64-b62a317cf935", // uuid of the customer
   "credit": 119, // total amount available for the customer
   "ticket_credit": 4, // total ticket amount available for the customer
   "lastupdate_at": "2023-05-30T12:54:46.845Z" // ISO string of the last updated made on the customer's prepaid amount
}

Examples

CREATED event

{
    "type": "CREATED",
    "entity_name": "sales",
    "time": "2022-03-24T10:25:03.499Z",
    "notification_uuid": "625bd8dc-f13c-4d43-9ca7-39c9a26c8f9c",
    "environment_id": "s3_e2e_restaurant",
    "client_id": "SclobyElectron3",
    "from_user": "[email protected]",
    "entities": [
        {
            "open_at": "2022-03-24T10:25:07.000Z",
            "lastupdate_at": "2022-03-24T10:25:07.000Z",
            "created_at": "2022-03-24T10:25:03.000Z",
            "updated_at": "2022-03-24T10:25:03.000Z",
            "id": 12388,
            "uuid": "58332b8f-a8b6-4e35-b598-4ea6ad08cb7d",
            "name": "Vendita 3",
            "external_id": null,
            "channel": "pos",
            "sale_number": 3,
            "is_summary": false,
            "notes": null,
            "sale_parent_id": null,
            "sale_parent_uuid": null,
            "order_id": null,
            "order_type": null,
            "order_uuid": null,
            "scloby_shop_id": null,
            "assigned_id": null,
            "assigned_name": null,
            "seller_id": 669,
            "seller_name": "Roberto Scherma",
            "customer_tax_code": null,
            "lottery_code": null,
            "lastupdate_by": 669,
            "status": "open",
            "amount": null,
            "change": null,
            "change_type": null,
            "final_amount": null,
            "final_net_amount": null,
            "currency": "EUR",
            "sale_customer": null,
            "e_invoice": null,
            "price_changes": [],
            "sale_items": [],
            "payments": [],
            "sale_documents": []
        }
    ],
    "nRetry": 0
}

UPDATED event

{
    "client_id": "SclobyElectron3",
    "entities": [
        {
            "amount": 20,
            "channel": "pos",
            "checkout_at": "2022-03-22T16:35:56.000Z",
            "covers": 2,
            "created_at": "2022-03-22T16:35:50.000Z",
            "external_id": null,
            "id": 8348,
            "last_sent_by": null,
            "lastupdate_at": "2022-03-22T16:35:56.927Z",
            "lastupdate_by": 669,
            "name": "Comanda 1",
            "net_amount": 18.18,
            "notes": "",
            "open_at": "2022-03-22T16:35:52.000Z",
            "operator_id": 669,
            "operator_name": "Roberto Scherma",
            "order_customer": null,
            "order_items": [
                {
                    "added_at": "2022-03-22T16:35:52.000Z",
                    "category_id": 381,
                    "category_name": "Categoria 3",
                    "cost": 60.2,
                    "created_at": "2022-03-22T16:35:55.000Z",
                    "department_id": 3,
                    "department_name": "IVA 10% - Servizi",
                    "exit": null,
                    "final_net_price": 9.09,
                    "final_price": 10,
                    "half_portion": null,
                    "id": 46114,
                    "ingredients": [],
                    "item_id": 45557,
                    "lastupdate_at": "2022-03-22T16:35:52.684Z",
                    "name": "Prodotto 61",
                    "net_price": 9.09,
                    "notes": "",
                    "operator_id": 669,
                    "operator_name": "Roberto Scherma",
                    "order_id": 8348,
                    "order_name": "prod 61",
                    "prebilled": false,
                    "price": 10,
                    "quantity": 1,
                    "unit": null,
                    "updated_at": "2022-03-22T16:35:55.000Z",
                    "uuid": "278801ea-3e11-4d92-b2fe-0d4209b49c09",
                    "variations": [],
                    "vat_perc": 10
                },
                {
                    "added_at": "2022-03-22T16:35:53.000Z",
                    "category_id": 409,
                    "category_name": "Cibo Surgelato",
                    "cost": 0,
                    "created_at": "2022-03-22T16:35:55.000Z",
                    "department_id": 3,
                    "department_name": "IVA 10% - Servizi",
                    "exit": null,
                    "final_net_price": 9.09,
                    "final_price": 10,
                    "half_portion": null,
                    "id": 46115,
                    "ingredients": [],
                    "item_id": 47470,
                    "lastupdate_at": "2022-03-22T16:35:53.240Z",
                    "name": "Amatriciana",
                    "net_price": 9.09,
                    "notes": "",
                    "operator_id": 669,
                    "operator_name": "Roberto Scherma",
                    "order_id": 8348,
                    "order_name": null,
                    "prebilled": false,
                    "price": 10,
                    "quantity": 1,
                    "unit": null,
                    "updated_at": "2022-03-22T16:35:55.000Z",
                    "uuid": "fb4a45a1-d59f-4b95-ba55-81bfe3e65a98",
                    "variations": [],
                    "vat_perc": 10
                }
            ],
            "order_number": 1,
            "order_parent_id": null,
            "order_parent_uuid": null,
            "paid": false,
            "room_id": 7,
            "room_name": "Sala1",
            "status": "checkout",
            "table_id": 732,
            "table_name": "sedia 1",
            "type": "normal",
            "updated_at": "2022-03-22T16:35:55.000Z",
            "uuid": "dea37b54-3196-4c40-a00e-20e2f452462f"
        }
    ],
    "entity_name": "orders",
    "environment_id": "s3_e2e_restaurant",
    "from_user": "[email protected]",
    "nRetry": 0,
    "notification_uuid": "2af13f98-a672-49d4-8acf-1748866feaba",
    "time": "2022-03-22T16:35:55.134Z",
    "type": "UPDATED"
}

DELETED event

{
    "client_id": "SclobyApp3",
    "entities": [
        {
            "id": 2147,
            "uuid": "4a3a6ff4-5117-4eaf-bc3b-459668ac3a9d"
        }
    ],
    "entity_name": "items",
    "environment_id": "s3_e2e_restaurant",
    "from_user": "[email protected]",
    "nRetry": 0,
    "notification_uuid": "e42ff27a-e9ef-4eb9-a0b9-79aaef6e2460",
    "time": "2022-03-25T10:38:44.473Z",
    "type": "DELETED"
}

Sale CLOSED event

{
    "client_id": "SclobyElectron3",
    "entities": [
        {
            "amount": 10,
            "assigned_id": null,
            "assigned_name": null,
            "change": 0,
            "change_type": null,
            "channel": "pos",
            "closed_at": "2022-03-24T10:25:15.000Z",
            "created_at": "2022-03-24T10:25:03.000Z",
            "currency": "EUR",
            "customer_tax_code": null,
            "e_invoice": null,
            "external_id": null,
            "final_amount": 10,
            "final_net_amount": 9.62,
            "id": 12388,
            "is_summary": false,
            "lastupdate_at": "2022-03-24T10:25:12.000Z",
            "lastupdate_by": 669,
            "lottery_code": null,
            "name": "Vendita 3",
            "notes": null,
            "open_at": "2022-03-24T10:25:07.000Z",
            "order_id": null,
            "order_type": null,
            "order_uuid": null,
            "payments": [
                {
                    "acquirer_id": null,
                    "acquirer_name": null,
                    "amount": 10,
                    "calltrx": null,
                    "card_circuit_id": null,
                    "card_circuit_name": null,
                    "code": null,
                    "created_at": "2022-03-24T10:25:11.000Z",
                    "date": "2022-03-24T10:25:09.000Z",
                    "id": 9867,
                    "paid": false,
                    "payment_data": null,
                    "payment_method_id": 1,
                    "payment_method_name": "Contanti",
                    "payment_method_type_id": 1,
                    "payment_method_type_name": "Contanti",
                    "sale_id": 12388,
                    "ticket_circuit": null,
                    "ticket_id": null,
                    "ticket_name": null,
                    "trx": null,
                    "unclaimed": false,
                    "updated_at": "2022-03-24T10:25:11.000Z"
                }
            ],
            "price_changes": [],
            "sale_customer": null,
            "sale_documents": [
                {
                    "created_at": "2022-03-24T10:25:11.000Z",
                    "date": "2022-03-24T10:20:00.000Z",
                    "document_content": "\t\t\tVendita 3 \n\t\t\t\t\t\t DOCUMENTO COMMERCIALE \n\t\t\t di vendita o prestazione \n\t\t\tDESCRIZIONE IVA Prezzo(€)\n\t\t\tIVA 4% - Prodotti 22,00% 10,00\n\t\t\tSUBTOTALE 10,00\n\t\t\tTOTALE COMPLESSIVO 10,00\n\t\t\tdi cui IVA 1,80\n\n\t\t\t\n\t\t\t\tPagamento contante 10,00\n\t\t\tPagamento elettronico 0,00\n\t\t\tNon riscosso 0,00\n\t\t\tResto 0,00\n\t\t\tImporto pagato 10,00\n\t\t\t 24-03-2022 11:20 \n\t\t\t DOCUMENTO N. 0984-0018 \n\t\t\t 99MEX017064 \n\t\t\t\t\t\t\t\t\t DETTAGLIO FORME di PAGAMENTO \n\t\t\tContanti 10,00\n\t\t\tOperatore: Roberto \n\t\t",
                    "document_type": "commercial_doc",
                    "document_url": null,
                    "id": 8027,
                    "printer_id": 67,
                    "printer_name": "Printer test",
                    "printer_serial": "EX 99017064",
                    "sale_id": 12388,
                    "sequential_number": 9840018,
                    "updated_at": "2022-03-24T10:25:11.000Z"
                }
            ],
            "sale_items": [
                {
                    "added_at": "2022-03-24T10:25:07.000Z",
                    "barcode": null,
                    "category_id": null,
                    "category_name": null,
                    "combination_id": null,
                    "cost": null,
                    "created_at": "2022-03-24T10:25:11.000Z",
                    "department_id": 5,
                    "department_name": "IVA 4% - Prodotti",
                    "external_id": null,
                    "final_net_price": 9.6154,
                    "final_price": 10,
                    "id": 29252,
                    "item_id": null,
                    "name": "IVA 4% - Prodotti",
                    "not_discountable": false,
                    "notes": null,
                    "price": 10,
                    "price_changes": [],
                    "prize_id": null,
                    "quantity": 1,
                    "refund_cause_description": null,
                    "refund_cause_id": null,
                    "sale_id": 12388,
                    "seller_id": 669,
                    "seller_name": "Roberto Scherma",
                    "sku": null,
                    "type": "sale",
                    "updated_at": "2022-03-24T10:25:11.000Z",
                    "uuid": "16d567d8-7f60-496d-9db8-7af253cb3fc1",
                    "variations": [],
                    "vat_perc": 4
                }
            ],
            "sale_number": 3,
            "sale_parent_id": null,
            "sale_parent_uuid": null,
            "scloby_shop_id": null,
            "seller_id": 669,
            "seller_name": "Roberto Scherma",
            "status": "closed",
            "updated_at": "2022-03-24T10:25:11.000Z",
            "uuid": "58332b8f-a8b6-4e35-b598-4ea6ad08cb7d"
        }
    ],
    "entity_name": "sales",
    "environment_id": "s3_e2e_restaurant",
    "from_user": "[email protected]",
    "nRetry": 0,
    "notification_uuid": "decfc0eb-12fa-4215-839d-1da5bd3ff003",
    "time": "2022-03-24T10:25:11.958Z",
    "type": "CLOSED"
}