WooCommerce Webhook
WooCommerce se integra de forma nativa con NicoChat para ofrecer disparadores de webhook. Estos disparadores se activan cada vez que ocurre un evento en la tienda de WooCommerce, ya sea mediante una API o directamente desde la tienda.
WooCommerce admite los siguientes disparadores nativos; aprende más sobre nuestra integración con WooCommerce aquí.
Creación de pedidos
Este disparador se activa cada vez que se crea un pedido en una tienda WooCommerce, ya sea mediante una API o directamente desde la tienda.

Se recibe el siguiente payload de respuesta.
{
"id": 4599,
"parent_id": 0,
"status": "pending",
"currency": "AUD",
"version": "6.9.4",
"prices_include_tax": false,
"date_created": "2023-04-14T18:13:13",
"date_modified": "2023-04-14T18:13:13",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "0.00",
"total": "175.00",
"total_tax": "0.00",
"customer_id": 4,
"order_key": "wc_order_yhGfOfZ0eoCYe",
"billing": {
"first_name": "",
"last_name": "",
"company": "",
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"postcode": "",
"country": "",
"email": "mark@uchat.com",
"phone": ""
},
"shipping": {
"first_name": "",
"last_name": "",
"company": "",
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"postcode": "",
"country": "",
"phone": ""
},
"payment_method": "",
"payment_method_title": "",
"transaction_id": "",
"customer_ip_address": "",
"customer_user_agent": "",
"created_via": "rest-api",
"customer_note": "",
"date_completed": null,
"date_paid": null,
"cart_hash": "",
"number": "4599",
"meta_data": [
],
"line_items": [
{
"id": 260,
"name": "DNK Black Shoes - blue",
"product_id": 375,
"variation_id": 4120,
"quantity": 1,
"tax_class": "",
"subtotal": "175.00",
"subtotal_tax": "0.00",
"total": "175.00",
"total_tax": "0.00",
"taxes": [...], // 0 items
"meta_data": [...], // 1 items
"sku": "",
"price": 175,
"image": {...}, // 2 keys
"parent_name": "DNK Black Shoes"
}
],
"tax_lines": [
],
"shipping_lines": [
],
"fee_lines": [
],
"coupon_lines": [
],
"refunds": [
],
"payment_url": "https://shop.businessautomated.io/checkout-2/order-pay/4599?pay_for_order=true&key=wc_order_yhGfOfZ0eoCYe",
"is_editable": true,
"needs_payment": true,
"needs_processing": true,
"date_created_gmt": "2023-04-14T18:13:13",
"date_modified_gmt": "2023-04-14T18:13:13",
"date_completed_gmt": null,
"date_paid_gmt": null,
"currency_symbol": "$"
}Actualización del pedido
Este disparador se activa cada vez que se actualiza un pedido en la tienda WooCommerce, ya sea mediante una API o directamente desde la propia tienda.
.webp)
Se recibe el siguiente payload de respuesta.
{
"id": 4597,
"parent_id": 0,
"status": "completed",
"currency": "AUD",
"version": "6.9.4",
"prices_include_tax": false,
"date_created": "2023-04-14T11:01:51",
"date_modified": "2023-04-14T18:16:14",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "0.00",
"total": "350.00",
"total_tax": "0.00",
"customer_id": 0,
"order_key": "wc_order_5hKQmDkxUiesi",
"billing": {
"first_name": "Hammad",
"last_name": "Siddiqui",
"company": "",
"address_1": "ABC Road, Garden City",
"address_2": "",
"city": "Karachi",
"state": "Sindh",
"postcode": "",
"country": "Pakistan",
"email": "hammadsiddiqui788@gmail.com",
"phone": "+9230302320964"
},
"shipping": {
"first_name": "Hammad",
"last_name": "Siddiqui",
"company": "",
"address_1": "ABC Road, Garden City",
"address_2": "",
"city": "Karachi",
"state": "Sindh",
"postcode": "",
"country": "Pakistan",
"phone": ""
},
"payment_method": "",
"payment_method_title": "",
"transaction_id": "",
"customer_ip_address": "",
"customer_user_agent": "",
"created_via": "rest-api",
"customer_note": "",
"date_completed": "2023-04-14T18:16:14",
"date_paid": "2023-04-14T18:16:14",
"cart_hash": "",
"number": "4597",
"meta_data": [
{
"id": 6465,
"key": "user_ns",
"value": "f12372u15376836"
},
{
"id": 6499,
"key": "_new_order_email_sent",
"value": "true"
}
],
"line_items": [
{
"id": 259,
"name": "DNK Black Shoes - blue",
"product_id": 375,
"variation_id": 4120,
"quantity": 2,
"tax_class": "",
"subtotal": "350.00",
"subtotal_tax": "0.00",
"total": "350.00",
"total_tax": "0.00",
"taxes": [...], // 0 items
"meta_data": [...], // 1 items
"sku": "",
"price": 175,
"image": {...}, // 2 keys
"parent_name": "DNK Black Shoes"
}
],
"tax_lines": [
],
"shipping_lines": [
],
"fee_lines": [
],
"coupon_lines": [
],
"refunds": [
],
"payment_url": "https://shop.businessautomated.io/checkout-2/order-pay/4597?pay_for_order=true&key=wc_order_5hKQmDkxUiesi",
"is_editable": false,
"needs_payment": false,
"needs_processing": true,
"date_created_gmt": "2023-04-14T11:01:51",
"date_modified_gmt": "2023-04-14T18:16:14",
"date_completed_gmt": "2023-04-14T18:16:14",
"date_paid_gmt": "2023-04-14T18:16:14",
"currency_symbol": "$"
}Creación de contacto usando disparadores
NicoChat identifica la información que viene en el payload del disparador y la compara con los contactos existentes. Si hay coincidencia, el flujo se ejecuta para ese contacto. Si no se encuentra el contacto, se crea con la información que viene en el payload.
Si el correo electrónico y el teléfono están disponibles, el contacto se creará en el canal Web. Si solo el correo electrónico está disponible, el contacto se creará igualmente en el canal Web. Si solo el teléfono está disponible, el contacto se creará en el canal WhatsApp.
Si la información mínima requerida arriba no viene en el payload, el disparador no podrá identificar ni crear un contacto y, por lo tanto, no se activará.

