How Gatemi Zapier Works

Gatemi Zapier does not invent its own delivery system. A connection is an ordinary WooCommerce API key, and a trigger is an ordinary WooCommerce webhook. The plugin's job is to issue the key safely, to teach WooCommerce the extra events, and (full edition) to accept actions and keep a history.

The Zapier app, "Gatemi for WooCommerce", is not yet listed in Zapier's app directory. Everything below describes what the plugin does; the Zapier side becomes available once the app is published.

1. Connecting

  1. In Zapier you type the store address and a WordPress username and password.
  2. Zapier sends them once, by POST, to https://your-store/wp-json/gatemi-zapier/v1/connect.
  3. The plugin refuses unless the request arrived over HTTPS — the request carries a login, and WooCommerce only accepts API keys over HTTPS anyway.
  4. It checks the login. An application password is tried first, then the account's normal password. The account must have manage_woocommerce.
  5. It creates a WooCommerce API key pair with read/write permission, described as Gatemi Zapier, owned by that user, and returns it to Zapier with the store's name and address.
  6. From then on Zapier signs every request with that key pair. The password is not stored anywhere.

Why read/write in the free edition too? Subscribing a Zap creates a webhook through WooCommerce's REST API, and creating a webhook is a write.

Refusals and lockout

Every failed sign-in gets the same answer — "The username or password is incorrect." — whether the name, the password or the capability was wrong, and an unknown username takes as long to refuse as a wrong password. A distinct answer, or a faster one, would tell an attacker which half was right.

Failures are counted per address and per username. Five failures from one address lock connecting from that address for 15 minutes; failures against one username lock it after 5 (free edition) or 15 (full edition). The refusal uses HTTP status 406 rather than 401, because Zapier treats a 401 as a prompt to sign in again in a loop.

The address used is REMOTE_ADDR, never a forwarded header, because a forwarded header can be set by the caller. Behind a trusted proxy, adjust it with the gmzf_connect_ip / gatemi_zapier_connect_ip filter — see the Developer reference.

Keys over time — Full edition

The full edition records when each key was issued and runs a daily clean-up (gatemi_zapier_rotate_keys) of Gatemi Zapier keys:

  • each user's most recently used key is always kept;
  • a key unused for 90 days is revoked;
  • a user with more than 5 keys has the oldest revoked, except keys issued in the last 7 days, so the key you connected with an hour ago is never the one removed.

The free edition revokes nothing on its own; revoke a key under WooCommerce → Settings → Advanced → REST API.

The full edition also serves DELETE /connect, which revokes the calling user's Gatemi Zapier keys.

2. Triggers: events going out

  1. When you publish a Zap, Zapier asks the store to create a webhook: POST /wp-json/gatemi-zapier/v1/webhooks with a topic (such as order.created) and Zapier's delivery address.
  2. The plugin names it Gatemi Zapier: <topic> and hands it to WooCommerce's own webhook controller. It appears under WooCommerce → Settings → Advanced → Webhooks.
  3. When the event happens, WooCommerce queues the delivery in its scheduled-action queue and sends the record to Zapier — as the WooCommerce REST API would show it, built with the permissions of the user who connected.
  4. When you turn the Zap off, Zapier deletes the webhook.

The free edition serves four topics — order.created, order.updated, customer.created, customer.updated — all of them WooCommerce core topics, so the delivery is entirely WooCommerce's. A request to subscribe to any other topic is refused with "This store can send these events: …".

The full edition serves every topic in Settings → Events. It registers its own topics with WooCommerce's webhook system, fires them from the right WordPress and WooCommerce actions (an order's status changing, a product's stock going below its low-stock threshold, a subscription renewing), and builds the payload for records WooCommerce cannot describe itself, such as order notes.

Getting deliveries right — Full edition

  • A record belongs to one resource. Some WooCommerce actions announce two kinds of record — a subscription note arrives on the order-note action. A delivery whose record belongs to another resource is skipped.
  • Trash moves are not updates. Moving an order to or from the trash sends order.deleted / order.restored, not an extra order.updated.
  • Collapse duplicate sends (on by default) sends one record at most once per event per request. WooCommerce already skips an exact repeat, but compares strictly, so the same product could leave twice when one hook passes the object and another its id.
  • Variations report their stock events against their parent product.
  • Each delivery carries extra headers: X-Gatemi-Zapier-Version, X-WC-Version, X-WordPress-GMT-Offset and X-WC-Webhook-Resource-ID.

Samples — Full edition

While a Zap is being built, Zapier asks GET /samples/<topic>. The plugin builds the payload that topic would send for the store's most recent matching record, through the same code a real delivery uses — so you can map fields without placing a test order. The free edition has no sample endpoint; Zapier shows a built-in example until a real event arrives.

Webhooks other plugins left behind — Full edition

A Zap subscribes to a webhook, and the webhook belongs to the store. The full edition adopts a webhook that delivers to Zapier (zapier.com or zapierstaging.com) and subscribes to a topic it serves — including ones another Zapier plugin created, once that plugin is deactivated. Existing Zaps keep running without being rebuilt. A webhook on a topic the plugin cannot serve is left alone, and nothing is adopted while another Zapier plugin is active. The Webhook owners readiness check reports what it found.

3. Actions: Zaps changing the store — Full edition

The full edition serves WooCommerce's own orders, products, customers and coupons controllers again under gatemi-zapier/v1, so whatever WooCommerce can create or update, a Zap can. Permissions are WooCommerce's: the connecting user needs, for example, edit_shop_orders to change orders, and create_users and edit_users to create customers. The connect response tells Zapier up front which of these the account has.

Four actions are purpose-built, because the useful change is small:

Action Route What it takes
Update order status POST /orders/status order_id, status, optional note
Add order note POST /order_notes order_id, note, customer_note (true sends it to the customer)
Update product price POST /products/price product_id or sku, an adjustment, an amount
Update product stock POST /products/stock product_id or sku, adjustment + quantity, and/or stock_status

Price and stock take a SKU or an id, because a supplier feed has SKUs. Stock can be increased or decreased as well as set, so a "three more arrived" feed cannot overwrite a sale that happened in between. Changing the quantity of a product that does not manage stock switches stock management on.

A few routes are removed from the plugin's namespace on purpose — batch endpoints, duplicating, suggested and related products — and the Zapier app offers no delete actions: a misconfigured Zap that deletes can run a thousand times before anybody notices.

4. Task history — Full edition

Every delivery to Zapier (Trigger) and every change Zapier makes (Action) is written as a row in the table {prefix}gatemi_zapier_task_history: when, the status, the topic, the record, the webhook and how long it took. Failures — a Zapier error, an action WooCommerce refused, a delivery that timed out in the scheduled- action queue — are recorded with their error code.

The message shown on WooCommerce → Zapier → Activity is composed when the page is displayed, not stored, so it can be translated and holds no stored markup. Rows older than Keep task history for … days are deleted by a daily event (gatemi_zapier_purge_task_history).

Send again on a failed delivery rebuilds the record as it is now and sends it to the same Zap.

Free and full editions together

Both editions answer at the same namespace, gatemi-zapier/v1, with the same /connect route and the same topic names. Installing the full edition (which makes the free one stand down) therefore keeps every connection key and every published Zap; the full edition adopts the free edition's webhooks and adds the rest of its events and the actions.

Shopping Cart
Scroll to Top