• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

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