A step-by-step tutorial that leaves out all the extras and walks you through exactly how to setup your Instagram Post automation.

The Need for Business Process Automation in Small Businesses

In today's fast-paced digital landscape, efficiency is the name of the game. Whether you're a startup or an established small business, automating your business processes is no longer a luxury—it's a critical necessity.

Why is this so important? Automation frees up valuable time, reduces the margin for error, and allows you to focus on strategic tasks that require human ingenuity. It's not just about working harder; it's about working smarter. And when it comes to digital marketing, one of the smartest moves you can make is to automate your social media posts.

That's why today, we're zeroing in on a specific, high-impact form of automation: using Make.com to automate Instagram posts whenever you mark a product on sale in WooCommerce. This not only streamlines your marketing efforts but also maximizes your product visibility, giving you a competitive edge.So, if you're looking to elevate your small business through automation and streamlined operations, you're in the right place.


Understanding Business Process Automation

Business process automation (BPA) is the technology-enabled automation of complex business processes and functions. It's designed to streamline operations, reduce costs, and improve efficiency. In the context of small businesses, BPA can be a game-changer, offering a competitive edge in a crowded marketplace.

Woman with back to camera facing wall of images and logos for software services.

Why Small Businesses Need Business Process Automation

For small businesses, resources are often limited. Whether it's time, manpower, or capital, you need to make the most out of what you have. That's where business process automation comes in. By automating repetitive tasks, you free up human resources to focus on more strategic, revenue-generating activities.

Key Benefits of Business Process Automation

  1. Cost-Effectiveness: Automation can significantly reduce operational costs, if done correctly. Done incorrectly, well, you'll have engineers running around like caffeinated squirrels on a trampoline.
  2. Efficiency: Automated processes are faster and more accurate than manual ones. Remove human error is critical.
  3. Scalability: As your business grows, your automated processes can easily scale with it.

The Role of Webhooks in Business Process Automation

What Are Webhooks?

Webhooks are a powerful tool in the automation toolkit. They act as messengers that notify other software or services when a specific event occurs. In our case, marking an item on sale in WooCommerce triggers a webhook, which then notifies Make.com to post on Instagram.

Webhook process - server event is triggered and send a request with a payload to a URL for further event processing.
Server creates an event and sends a request to a URL with a Payload for additional processing. Credit: Fikayo Adepoju @ Hookdeck 

How Webhooks Power Automation

Webhooks are the linchpin that connects different platforms and allows them to communicate with each other. They are crucial in automating workflows because they initiate the action. For example, when a product goes on sale in WooCommerce, a webhook can trigger an automated Instagram post, thereby increasing product visibility instantly.

Webhooks in WooCommerce and Make.com

WooCommerce and Make.com offer robust support for webhooks, making them ideal choices for small businesses looking to automate their operations. WooCommerce allows you to set specific triggers, like a product going on sale, while Make.com provides the automation logic to post this update on Instagram.

Setting Up Your WooCommerce for Automation

Installing WP Code for Customization

To maximize WooCommerce product visibility, you'll need to add custom code. This is because the default product updated webhook does not include the information we need to make this task efficient. To overcome that, we're going to create our own, new webhook.

Viewing WPCode in the Wordpress Plugin Marketplace
Viewing WPCode in the Wordpress Plugin Marketplace

WPCode is a WordPress plugin that allows you to safely add this code. Here's how to set it up:

  1. Navigate to Plugins in your WordPress dashboard and Add New.
  2. Search for WPCode.
  3. Install and activate the plugin.
  4. Create a new snippet and add the custom code.
add_action('woocommerce_update_product', 'custom_product_update_webhook', 10, 1);

function custom_product_update_webhook($product_id) {
    // Debugging
    // error_log("Webhook triggered for Product ID: $product_id");

    // Get the product object and data
    $product = wc_get_product($product_id);
    $new_data = $product->get_data();

    // Get and add the featured image URL
    $image_id  = $product->get_image_id();
    $image_url = wp_get_attachment_image_url($image_id, 'full');
    $new_data['image'] = array('src' => $image_url);

    // Retrieve old data
    $old_data = get_transient("old_product_data_{$product_id}");

    // Debugging
    // error_log("Old Data: " . json_encode($old_data));
    // error_log("New Data: " . json_encode($new_data));

    // Determine changed data
    $changed_data = get_changed_data($old_data, $new_data);

    // Debugging
    // error_log("Changed Data: " . json_encode($changed_data));

    // Store new data for next comparison
    set_transient("old_product_data_{$product_id}", $new_data, DAY_IN_SECONDS);

	// Prepare the payload
	$payload = array(
    'product_data' => $new_data,
    'changed_data' => $changed_data,
	);

	// Serialize changed_data to match the structure of product_data
	$payload['changed_data'] = json_decode(json_encode($changed_data), true);

    // Send webhook
    wp_remote_post('YOUR-WEBHOOK-URL-FROM-MAKE-COM', array(
        'body' => json_encode($payload),
        'headers' => array('Content-Type' => 'application/json'),
    ));
}

function get_changed_data($old_data, $new_data) {
    $changed_data = array();
    if (is_array($old_data) && is_array($new_data)) {
        foreach ($new_data as $key => $value) {
            if (isset($old_data[$key]) && $old_data[$key] !== $value) {
                $changed_data[$key] = array(
                    'old' => $old_data[$key],
                    'new' => $value
                );
            }
        }
    }
    return $changed_data;
}

Automating Instagram Posts with Make.com

0:00
/
  1. Open Make.com and click Create Scenario.
  2. Add a Webhook node.
  3. Name it something like Product Sale to IG.
  4. Copy the generated URL.
  5. Paste this URL into your WPCode snippet in WordPress.
  6. Activate & save the snippet to establish the new webhook.
💡
Consider using this link to signup for Make.com. Your support helps make walkthrough videos and articles like this possible.

Data Structure and Filters

Defining Data Structure in WooCommerce

  1. Go back to the Webhook node in Make.com and click Determine Data Structure.
  2. Go to your WooCommerce products.
  3. Select a product and edit its Sale Price.
  4. This action sends data to Make.com, setting the stage for future automated posts.

Setting Filters in Make.com

  1. Add a HTML to Text text parser.
  2. Click Run Once in Make.com.
  3. Edit a product's Sale Price in WooCommerce.
  4. In Make.com, click the 🔧 between the Webhook and  HTML to Text to specify when the automation should run.
  5. changed_data: sale_price: old should be set to Does not exist AND changed_data: sale_price: new should be set to Exists.
Setting up make.com filters on the webhook payload to prevent all products running through the workflow.
Setting up the filters on the Webhook payload is critical to prevent all product updates running through the workflow.

Preparing and Testing Instagram Posts

Setting up the Instagram post in Make.com with WooCommerce data
Setting up the Instagram post with WooCommerce data.
  1. Add an Instagram for Business node in Make.com.
  2. Connect your Instagram account.
  3. Use the product_data: image: src value from the Webhook payload for the Photo URL.
  4. Use the text from an HTML to Text Parser for the caption. You can write in anything else you want or include more data from the Webhook payload.

Final Testing

  1. Click "Run Once" in Make.com.
  2. Add a sale price to a product in WooCommerce.
  3. Check Instagram to see your new post.
Saving and making Make.com workflow/scenario active.
Don't forget to SAVE your workflow and make it active! 

If you found this guide useful, don't forget to share it with a friend.

Share this post