1. Home
  2. Plugins
  3. WP Webhooks Pro Woocommerce
  4. Get Started
  5. How to set up the Woocommerce API webhook

How to set up the Woocommerce API webhook

With the Woocommerce API webhook, you can integrate the full power of Woocommerce (and its extensions) into your website using WP Webhooks Pro.
Down below we will show you an example of the setup using the Woocommerce products webhook to retrieve a list of all products.

Basic webhook setup

Before actually checking all the available parameters, we need to define the webhook setup itself.
In my example, I’m going to use Postman.
To get started, we need to copy the webhook action URL within the Receive Data Tab of the WP Webhooks Pro settings.

Copy the webhook action URL

This URL needs to be pasted into the field from where you want to make the request. (In my example this is postman).

Now it is time to define the action within your webhook request. Therefore, we need to activate the woocommerce_api webhook. To do that, simply go to WP Webhooks Pro -> Settings and check the box of the woocommerce_api webhook and click save.

After this is done, you can head back to the “Receive Data” tab – There you will now see the webhook action woocommerce_api.
Now it is time to add this action into the webhook request. We can do that by using the default action argument.

Setup of the action request for the woocommerce_api webhook

As you can see in the screenshot above, I also set the Request type to POST and the Content-Type to x-www-form-urlencoded. For a list of all available content types, you can use to send the data through, click here.


Before setting up any kind of data, it is necessary to set up authentication using your Woocommerce REST API customer_key and customer_secret.
You will find both of these strings within your Woocommerce Settings page after you create your first credentials.
Please note: Don’t forget to save your customer_secret and your customer_key in a safe place since they won’t be accessible anymore after refreshing the site.

Steps to set up Woocommerce REST API credentials

The created keys now need to be added to the webhook call you want to make. Therefore, you can simply add them using the same names as keys (customer_key and customer_secret).

Prepare API settings

After setting up your authentication keys, it is time to prepare the API settings to let Woocommerce know what we want to do.
The first required argument we want to set is api_method.
This argument tells Woocommerce which type of request we want to make. You can set it to one of the following values: get, post, put, delete, options.
Which of the options you need to choose, depends on the API call you want to do. In our example, the Woocommerce REST API required the get method.

Screenshot from the Woocommerce REST API Documentation

The next required argument we need to define is called api_base.
This is the route of the Woocommerce API, which tells Woocommerce the exact action we want to do.
In our example, it is products. You will find that value within the Woocommerce documentation in between the two quotes as seen in the next screenshot.

Test your webhook

That’s it! Now you can trigger your action and see what comes back.
Here is again an overview of how the webhook setup looks using Postman, as well as what the response looks like.

Full setup + response of the webhook

Additional Arguments

This argument allows you to add custom options to your Woocommerce REST API call. The argument accepts JSON and all available values are listed here: https://github.com/woocommerce/wc-api-php
(In our example, we use it to deactivate the SSL validation since we are working on a local system)

Please note: In case you ever encounter the following error (Error: No route was found matching the URL and request method [rest_no_route]), it usually happens if the version of the API you try to set up is not supported by your third-party plugin like Woocommerce Subscription. You can solve that by using the correct API version using the api_options argument. As a value, simply set e.g. {“version”: “wc/v1”}

In case you want to send data using the woocommerce_api webhook, you can send through the specific data using this argument.
To give you an example, we will take a closer look at creating a product using our woocommerce_api webhook.
As you can see in the screenshot below, you need to send a second parameter (which is the api_data argument within our webhook).

The data, that is seen on the right side (as an array) is the data, you can send through using the above argument.
Important: You need to send the data through as JSON.

Down below, you will find a list with more information to certain REST integrations and more docs.

  1. Woocommerce REST API
  2. Woocommerce Subscriptions REST API
  3. Woocommerce Memberships REST API
  4. Woocommerce Bookings REST API
  5. JSON Editor Online
Updated on April 16, 2020

Was this article helpful?

Related Articles