• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer
    • 🔥 Pabbly Chatflow — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

Build HTTP module (Make) with Code action (Pabbly) ?

Hey Guys,

I’m really missing the HTTP module that Make offers, so figured that with a little help of LLMs I could easily build this with the Code action in Pabbly.
Guess not.

Has anyone achieved this, or is it impossible?

This is what I came up with

JavaScript:
async function fetchHTMLContent(url) {
  try {
    const response = await fetch(url);
    if (!response.ok) {
      throw new Error(`Failed to fetch: ${response.status} ${response.statusText}`);
    }
    const htmlContent = await response.text();
    return htmlContent;
  } catch (error) {
    console.error('Error:', error);
    return 'Error';
  }
}

// Example usage:
const url = 'https://example.com'; // Replace with the URL of the webpage you want to fetch
fetchHTMLContent(url)
  .then(htmlContent => {
    if (htmlContent && htmlContent !== 'Error') {
      console.log('HTML content:', htmlContent);
    } else {
      console.log('Failed to fetch HTML content.');
    }
  });
 
Use case is having a Code action with aforemention javascript code fetch the HTML source code of a given url.
Problem the action returns a blank output
 

ArshilAhmad

Moderator
Staff member
We attempted to execute this code in an online JS compiler and encountered an error. Please verify whether the code is correct or not.
1714166924209.png
 
Top