# E-commerce & CRM

## Overview

WaDesk turns Shopify and WooCommerce into a full WhatsApp marketing CRM. Things that happen in your store — an order, a refund, a sold-out product coming back — automatically send the right WhatsApp message. Your orders, products, and customers are kept in sync inside WaDesk, and a set of revenue tools (COD confirmation, abandoned-cart recovery, offers, win-back, analytics) all run on that data. HubSpot CRM is also supported for pushing contacts and deals. You'll find each integration under the More menu, and each one is set up separately per workspace.

- Shopify — order, shipping, refund, and cart automations; COD double-confirmation; back-in-stock alerts; multi-step abandoned-cart recovery; offers and smart-segment broadcasts; analytics.
- WooCommerce — the same CRM for self-hosted WordPress stores, plus WooCommerce-only extras: turning COD orders into prepaid, return-risk scoring, a self-serve customer concierge, and an optional add-on plugin (abandoned-cart phone capture and subscription payment reminders).
- HubSpot CRM — push contacts and deals into HubSpot when a conversation reaches an interesting point.

> Plan limits: Each integration is a paid-plan feature. If your plan doesn't include it, connecting is blocked. An administrator must also switch the integration on platform-wide before any workspace can connect.

> Works with any channel: every message these commerce features send goes out through whatever WhatsApp connection your workspace uses — the Unofficial API, the WhatsApp Cloud API, or Twilio. On the Cloud API and Twilio, the template must be approved and a channel must be connected for the message to actually deliver.

## Prerequisites at a glance

Integration | What the administrator sets up once | How each store connects
--- | --- | ---
Shopify | Client ID + Client Secret (from a Shopify app), scopes, redirect URI | Owner clicks Connect and approves — nothing to paste by hand
WooCommerce | Just turn the Enable toggle on | Owner generates API keys in their own WordPress admin and pastes them in
HubSpot | Client ID + Client Secret (from a HubSpot app), redirect URI | Owner clicks Connect and approves — nothing to paste by hand

> Secrets are encrypted. Every secret you enter — both the admin app credentials and each store's keys and tokens — is encrypted before it's saved and only unlocked at the moment it's needed. The admin Shopify secret field stays hidden after saving; leave it blank when you save to keep the value already stored.

## Shopify: admin app setup

Done once for the platform. Since January 2026 legacy custom apps from the Shopify Admin can no longer be created — use the Shopify Dev Dashboard (or Shopify CLI).

1. Sign in at partners.shopify.com (free), then open the Dev Dashboard → Apps → Create app and pick Public app.
2. In the app's Configuration → URLs, set the App URL to `https://YOUR-DOMAIN/shopify` and add the Allowed redirection URL: `https://YOUR-DOMAIN/shopify/oauth/callback`
3. Open Configuration → Client credentials and copy the Client ID and Client Secret (shown once).
4. Add Shopify's required privacy/compliance webhooks (`customers/data_request`, `customers/redact`, `shop/redact`) pointing at the webhook address shown in the next section.
5. In WaDesk, go to Admin → Settings → Shopify: paste the Client ID and Client Secret, keep or edit the default scopes, confirm the Redirect URI, tick Enable Shopify, and Save. The Client Secret is encrypted and hidden after saving.

Default scopes: `read_products, read_orders, write_orders, read_customers, read_checkouts, read_inventory`.

> The Redirect URI must match exactly — same protocol, host, and path, with no slash at the end — or the connection fails with a `redirect_uri mismatch` error. The admin page has copy buttons for the App URL, redirect URI, and webhook address to make this easy.

## Shopify: connecting a store

1. Open More → Shopify, enter your store name (e.g. `my-store`, or the full address — WaDesk fills in the rest), and connect.
2. Approve the access on Shopify. You're sent back to WaDesk, which securely stores the connection and automatically registers the webhooks it needs.
3. WaDesk then imports your products, orders, and customers, so every CRM feature works right away.

WaDesk sets up everything Shopify needs automatically. Each incoming Shopify webhook is signature-checked and rejected if it doesn't match, so only genuine Shopify events are processed.

> Reconnecting removes the old webhooks and re-registers fresh ones. Your automation settings and logs are kept.

## Shopify: automations

The dashboard's Automations tab groups every trigger into easy-to-read cards. For each one you choose an approved template, who to send it to (the customer, an admin, or both), a delay, an optional admin number, and an optional variable map. The triggers:

Automation | Fires when
--- | ---
Order placed / paid / shipped / cancelled | The order reaches that stage in Shopify
Order delivered | The shipment is marked delivered
Refund issued | A refund is created on the order
COD double-confirmation | A new cash-on-delivery order comes in — asks the buyer to confirm Yes/No
COD → Prepaid nudge | A COD order — offers a pay-online link (use `{{order_url}}` in the template)
Back in stock | A sold-out product comes back in stock — messages everyone on its waitlist
Abandoned cart (steps 1–3) | A checkout is started but not completed — step 1 sends right away, steps 2 and 3 follow on a schedule
Welcome | A new customer is created
App uninstalled | The Shopify app is removed — clears the stored connection

Customer replies handled automatically: a Yes/No to a COD confirmation updates the order in both Shopify and WaDesk; a reply like “notify me” about a sold-out product adds the customer to that product's back-in-stock waitlist. Both happen automatically when the customer replies on WhatsApp.

## WooCommerce: connecting a store

WooCommerce has no central app — an administrator just turns the Enable toggle on under Admin → Settings → WooCommerce. Each store owner then generates their own API keys and pastes them into WaDesk.

1. In your WordPress admin: WooCommerce → Settings → Advanced → REST API → Add key, set permissions to Read/Write, and Generate. Copy the consumer key (starts with `ck_`) and secret (starts with `cs_`) — the secret is shown only once.
2. In WaDesk open More → WooCommerce, enter your Store URL and both keys. A Test button checks the connection without saving anything.
3. On save, WaDesk stores the keys encrypted, sets up the webhooks it needs, reads back your store name, currency, country, and WooCommerce version, and imports your products, orders, and customers.

WaDesk registers the webhooks automatically, and each incoming WooCommerce webhook is signature-checked so only genuine events from your store are processed.

> HTTPS required. The API keys are only safe over an `https://` store address. Reconnecting removes the old webhooks and registers fresh ones, keeping your settings and logs.

## WooCommerce: automations

The Automations tab works just like Shopify's, grouped into Order lifecycle, Revenue recovery, and Lifecycle marketing. Each card lets you set a template, who to send it to, a delay, a variable map, and on/off.

Group | Automations
--- | ---
Order lifecycle | Order placed, confirmed (processing), delivered (completed), on-hold, cancelled, and refunded — each fires when the order reaches that status
Revenue recovery | COD double-confirmation, COD→Prepaid nudge, abandoned cart (3 steps), back in stock, and subscription payment-failed reminders
Lifecycle marketing | Welcome new customer, and a coupon sent in exchange for a review

The order, customer, and product triggers fire from the standard WooCommerce events WaDesk listens for. The extra triggers (COD steps, cart steps, subscription reminders) come either from those standard events or from the optional companion plugin.

Customer replies handled automatically: a Yes/No to a COD confirmation updates the order in both WooCommerce and WaDesk; a back-in-stock keyword adds the customer to the product's waitlist.

## WooCommerce: the WaDesk companion plugin

WooCommerce on its own can't see a few high-value moments. The optional WaDesk for WooCommerce plugin captures them and securely forwards them to WaDesk. Download it from the WooCommerce integration's Settings tab — the file comes already filled in with your store's connection details. Install it in WordPress via Plugins → Add New → Upload, then confirm under Settings → WaDesk WhatsApp.

It unlocks:

- Abandoned-cart recovery — captures the shopper's phone and email at checkout (before an order even exists), then starts the cart follow-ups for carts left idle past your chosen time. If the order completes, the pending follow-ups are cancelled.
- Subscription payment reminders — when a subscription renewal payment fails, it sends a pay-now link so you can recover the renewal right in the chat.

> The classic checkout is fully supported. If your store uses the newer Checkout Block, the phone/email capture may not work — but the order and COD automations still work normally either way.

## Marketing CRM: offers, win-back & analytics

Both Shopify and WooCommerce dashboards add these tools, all built from your synced store data:

- Products storefront — a styled Products tab (search, brand chips, percent-off badges, new arrivals) with per-product Send and Offer buttons.
- Offer broadcast (Offers tab) — send an approved template to every opted-in customer in a group, featuring a product and a coupon code.
- Win-back broadcast — target customers by their order history: not seen for more than a set number of days, a minimum number of orders, or a minimum total spend — while skipping anyone who unsubscribed. Set the days to 0 to target regardless of how long ago they ordered.
- Customer import — your store's customers are synced into Contacts (in a “Shopify/WooCommerce Customers” group) so broadcasts and flows can reach them.
- Analytics tab — revenue, average order value, messages sent, offer broadcasts, a 14-day revenue chart, plus impact figures: COD revenue protected, returns avoided, and how many recovery messages went out — all real numbers from your own data.

## COD confirmation, COD→Prepaid & RTO risk

The biggest way to cut failed deliveries (returns to origin, or RTO) in cash-on-delivery markets:

- COD double-confirmation — a new COD order messages the buyer to confirm. Yes moves the order forward; No cancels it. Either way the order is updated in your store and in WaDesk, and the customer gets a confirmation reply.
- COD → Prepaid nudge — an optional follow-up offering a pay-online link. On WooCommerce your template can use the `{{order_pay_url}}` variable for the pay link; on Shopify it uses the order status link.
- Return-risk score (WooCommerce) — each COD order gets a 0–100 risk score from your own order history (first-time buyer, past cancellations from that number, order value versus your store average, missing contact details). The score and the reasons are logged, so you can route high-risk orders to the prepaid nudge.

## WooCommerce self-serve concierge

Keyword-driven helpers that reply automatically, and only for customers WaDesk recognises from WooCommerce:

- One-tap reorder — a customer who texts “reorder” gets a fresh checkout link for the items in their last order.
- Loyalty / points — “points” or “balance” replies with their order count and total spend (and a points balance if a points plugin provides one).
- Review-gated coupon — a positive review (a high rating or a reply like “great”) from someone whose order was recently delivered automatically sends your reward template with a coupon. Three conditions apply: the order was recently delivered, the reward automation is switched on, and the same customer hasn't already been rewarded in the last 30 days.
- Change shipping address — “change address” finds the customer's order while it can still be edited, opens a 15-minute window, and saves their next message as the new shipping address. (Changing quantities or product options is intentionally not allowed, since that affects price and stock.)

## Template variables

Order automations give your template these fields to use: `name`, `first_name`, `order_number`, `order_name`, `total`, `currency`, `order_url` / `order_pay_url`, `tracking_number`, `tracking_url`, and `store_name`. Each automation also has an advanced variable order field — a comma-separated list that tells WaDesk which field goes into each numbered placeholder in your template. Leave it blank to use the sensible default (name, order, total).

## Commerce in flows

Both platforms also connect to the flow builder's commerce node. When a flow creates a draft order or cart, it links that order to the flow. When the order is then placed in your store, WaDesk picks the paused flow back up and continues it down its “purchased” path — perfect for thank-you, upsell, or fulfilment follow-ups. This is handled safely, so it can never cause your store to duplicate an order.

## Store dashboard, logs & sync

A connected store has tabbed views: Overview (counts, 30-day revenue), Orders, Products, Offers, Customers, Automations, Analytics, Activity (logs), and Settings. A Sync button re-imports your store data whenever you want.

Every event that comes in and every message that goes out is logged with its type, status (`sent` / `processed` / `skipped` / `failed`), recipient, and details — so you can confirm events arrive and templates fire. Disconnecting removes the registered webhooks and the connection; reconnecting sets up a fresh one.

> For a message to actually send you need three things: a connected store, at least one automation switched on with an approved template chosen, and a connected WhatsApp channel. If any of these is missing, the event is logged as `skipped` — it never throws an error.

## HubSpot: admin app setup

Done once for the platform. Create a HubSpot public app in your developer account.

1. In the app's Auth settings add the Redirect URL: `https://YOUR-DOMAIN/hubspot/oauth/callback`
2. Add the scopes (below), copy the Client ID + Client Secret.
3. In WaDesk go to Admin → Settings → HubSpot: paste both, confirm the redirect URI, enable, and Save. The secret is encrypted.

Scopes: `crm.objects.contacts.read`, `crm.objects.contacts.write`, `crm.objects.deals.read`, `crm.objects.deals.write`.

## HubSpot: connecting & what it does

Open More → HubSpot → Connect and approve the access. WaDesk securely stores the connection and keeps it renewed automatically, so you don't have to reconnect. From then on it can push contacts when a new conversation starts, create deals linked to the contact, and avoid duplicates by matching on email. The dashboard shows your HubSpot account name and a recent-activity log.

## Troubleshooting

Symptom | Cause | Fix
--- | --- | ---
Connect screen shows "isn't enabled / configured yet" | The administrator hasn't enabled it (or, for Shopify/HubSpot, hasn't pasted the app credentials). | Administrator enables it under Admin → Settings and saves.
Connecting is blocked even though the admin enabled it | Your plan doesn't include this integration. | Upgrade to a plan that includes the Shopify / WooCommerce / HubSpot integration.
Connection fails with `redirect_uri mismatch` (Shopify/HubSpot) | The app's redirect URL doesn't match the one WaDesk uses. | Register the redirect URL exactly (no slash at the end), and confirm the Redirect URI field in WaDesk admin matches it.
WooCommerce: "Could not reach WooCommerce" | Wrong store URL, keys aren't Read/Write, the store blocks API access, or the store isn't on HTTPS. | Use the Test button; confirm the URL, the Read/Write permission, that the store API is reachable, and that the store uses HTTPS.
Automation logged as `skipped` | No active template is set for that trigger. | On the Automations tab, switch it on and select an approved template.
Events rejected for a bad signature | The signature is missing or doesn't match. | Reconnect the store to set up fresh webhooks; for Shopify, also confirm the app's Client Secret in admin is current.
Abandoned-cart never fires (WooCommerce) | Carts have no phone number until checkout — this needs the companion plugin. | Install the WaDesk companion plugin from the Settings tab and set up the abandoned-cart templates.
Store shows disconnected after working (Shopify) | The store owner uninstalled the app, which clears the connection. | Reconnect from More → Shopify; your logs and settings are kept.