Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WooCommerce Native Triggers

Woocommerce integrates natively with UChat to provide webhook triggers. These triggers are triggered whenever an event is carried out on the woocommerce store either via an api or directly from the store. 

WooCommerce support following native triggers, learn more about our woocommerce integration here.

Table of Contents
stylenone

 Order Creation

This trigger is fired whenever an order is created on a woocommerce store either via an api or directly from the store.

...

 

Following response payload is received.

Code Block
{
"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": "$"
}

Order Update

This trigger is fired whenever an order is updated in woocommerce store either via an api or directly from the store itself.

...

Following response payload is received.

Code Block
{
"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": "$"
}

User Creation Using Triggers

UChat identifies the information coming from the trigger payload and matches it with the existing bot users. If found , the flow is executed for that user. If the user is not found then a user is created using the information that comes within the payload.

If email and phone are both available then a user is created under Web channel, if only email is available then user is still created under Web channel. If the phone only is available then the user is created as a Whatsapp channel.

If the above required minimum information does not come with the payload, then the trigger is unable to either identify or create a user and hence the trigger is not fired.