HARPA.AI
LIBRARYUSE CASESGUIDESAI COMMANDSBLOG

Connect HARPA to Make.com

CONTENTS
NAVIGATE

Make.com (previously Integromat) is a powerful cloud-based IFTTT automation and integration platform. It enables everyone to connect various web applications, data sources, and services to automate workflows and streamline data processing.

You can trigger Make.com scenarios from HARPA AI using webhooks. HARPA monitors changes on websites and sends events to Make.com.

# How to Create a Make.com Account

  1. Navigate to Make.com.

  2. Click Get started free button. You'll be directed to a page where you can either sign up with your email address or your Google or Facebook account.

  1. If you choose to sign up with your email address, enter your name, email address, and a strong password. Select your country and a data hosting region.

  1. Click Sign Up.

# Data Export to Google Sheets

  1. Create a new scenario in Make.com

  1. Click "+" and add a Webhook to your scenario

  1. Select the Webhook trigger option for receiving data

  1. Click "Create a webhook"

  1. Name it, like "Data from HARPA AI", and save.

  1. Copy the webhook URL to use in HARPA AI.

# HARPA AI Connection

  1. Open HARPA AI by clicking its icon in the top right corner or pressing Alt+A (on Windows) and ^+A (on Mac).

  2. Type / in chat and click CREATE button at the top.

  1. You'll see an example of a simple custom command. Delete all steps as you won't need them.

  2. Сlick the ADD STEP button and pick the REQUEST step.

  1. Paste your webhook URL into the appropriate field in the request step. In the "Body content" field, enter the parameter {{json}}. We'll explain why this is necessary later.

  1. Now let's create a prompt that will analyze the webpage data ({{page}} parameter) and extract the information we need in JSON format with fields: product, description, price, url.

Add the GPT step and move it to the first position.

Please note that:

  • The GPT step has been moved to the first position, before the REQUEST step.
  • "Isolated Mode" has been enabled in the GPT step, allowing the AI query to be executed in isolation, without sending message history. This helps save tokens and prevents confusing the AI.
  • No output parameter was specified in the GPT step. Therefore, by default, the result will be stored in the {{gpt}} parameter.

We suggest formulating this prompt as follows:

You are a Data Research AI Agent.

Your task is to extract data from a web page and respond with JSON text as requested. 

Follow these instructions:
- Analyze the product web page and find its name, price, and formulate a brief description of the product (maximum 200 characters).
- Provide the price as a number without currency symbols.
- Respond in {{language}}.
- Be concise and to the point.
- Respond with a JSON array containing objects with 4 fields: 1 - product, 2 - description, 3 - price, 4 - url.
- Write nothing other than the JSON.
- Wrap your JSON response in a code block.

Example JSON response:
{
	"product": "Product name",
	"description": "Brief product description",
	"price": 1000,
	"url": "page url"
}


Product URL: {{url}}

Product webpage data: {{page}}

JSON response:
  1. Add a CALC step after the GPT step and use the "Extract Code from Text" option. Code is extracted from the {{gpt}} parameter and saved to the {{json}} parameter, which will be sent to Make.com

  1. Save the command.

INTERMEDIATE TESTING №1

  • In Make.com, right-click on the Webhook module and then select "Run this module only".

  • Open HARPA on any webpage that fits your scenario. For example, in our case, it's an Amazon product page. Then run your command.

If everything worked correctly, a JSON object containing data should have been sent to Make.com.

# Google Sheets module

  1. Add a Parse JSON module to your scenario.

  1. Click on the JSON string field in the "Parse JSON" module and select 'value' from the Webhook module.

INTERMEDIATE TESTING #2

  • In Make.com, click "Run once".

  • Run the command on the same Amazon product page and verify that the second Module received the JSON and was able to extract data from it.

  1. Add a Google Sheets module with the "Add a row" option.

  1. OPTIONAL: If you have never used Google Sheets with Make.com before, you need to create a connection

Connect Make.com to your Google account. This needs to be done only once.

  1. Open your Google Drive and create a spreadsheet in Google Sheets to store the extracted data. Of course, it's possible to set up automatic creation of Google Sheets, but that would only complicate this explanation.

  1. Name the Google Sheets file and add column headers in the first row: Product, Description, Price and URL.

  1. Return to Make.com, and in the Google Sheets module, you can select your file by its name.

  1. Specify the JSON fields in the Google Sheets columns.

  1. Save your scenario.

  1. Your scenario is ready. Try running it and check the result in Google Sheets.

# Bulk data extraction

There are two options for obtaining a list of links to process:

  1. If you already have a list of links and can send it to HARPA

  2. If you don't have a list of links and want to automate the search

# Option 1: Using a list of URLs

You can find the command template at this link

  1. Open HARPA and create a new custom command, let's call it "Automate information parsing"

  2. Delete all example steps and add the ASK step that will request a comma-separated list of links from the user and save it in the {{urls}} parameter

  1. Add the RUN JS step that will contain code to extract links from {{urls}} and convert them into an array {{links}}. Here's a JS code that can help you solve this task:
let links = [];
const linkRegex = /(https?:\/\/\S+?)(?=[,;\n\s\]]|$)/gi;

try {
  // any data to string
  const urlString = String(urls);
  // split string
  const urlParts = urlString.split(/[,;\n\s]+/);
  urlParts.forEach(part => {
    const matchedLinks = part.match(linkRegex) || [];
    links = links.concat(matchedLinks);
  });

  // delete "
  links = links.map(link => link.replace(/^"|"$/g, ''));

  // delete duplicates
  links = [...new Set(links.filter(Boolean))];

} catch (error) {
    return false;
}

return links;

INTERMEDIATE TESTING №3

  • Save the command and run it.

  • Send any links in response to the ASK step.

  • If JS works correctly, you will see it.

  1. Add the LOOP step over the {{links}} parameter data.

  1. Open the contents of the LOOP step and let's modify it.
  • Add a NAVIGATE step that will open the link {{item}}

  • Add a CONTROL step that will "Show Frame" HARPA AI (this is not a mandatory step, but it's added for convenience)

  • Add a COMMAND step that will run your command for extracting product data and sending it to Make.com.

# First Scenario Testing

  1. Open Make.com, find your scenario, and run it.

  1. Open HARPA and send it your product links.

  1. Check Google Sheets to confirm all link content is there.

# Option 2: Searching for URLs in SERP

You can find the command template at this link

  1. Open HARPA and create a new custom command, let's call it "Find and export product info"

  2. Delete all example steps and add the ASK step that will request the product search query text and save it in the {{query}} parameter.

Note that in the example we used the "inurl:" search operator, which helps find websites with URLs containing a specific word. In our case - Amazon.

Click here to learn more about Search options in HARPA.

  1. Add the CALC: Set Parameter step to save the SERP results to the {{search}} parameter.

  1. Add the CALC:Extract SERP links step to extract URLs to the {{links}} parameter.

  1. Add the LOOP step over the {{links}} parameter data.

  1. Open the contents of the LOOP step and let's modify it.
  • Add a NAVIGATE step that will open the link {{item.url}}

  • Add a CONTROL step that will "Show Frame" HARPA AI (this is not a mandatory step, but it's added for convenience)

  • Add a COMMAND step that will run your command for extracting product data and sending it to Make.com.

# Second Scenario Testing

  1. Open Make.com, find your scenario, and run it.

  1. Open HARPA, run your command and enter the search query.

  1. Check Google Sheets to confirm all link content is there.

NEXT POST
Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service