N8n, puppeteer, javascript and webhooks

I’m creating some puppeteer scripts and its all javascript and very similar to some of the stuff we use in the function nodes.

One question I have is when my script in puppeteer is finishing iterating its array the output I want to send to n8n webhook or something to get the results, but not sure how to output into a webhook

an example of the end of the script is like this

const url = [ingest n8n array output here]
   const results = await bluebird.map(urls, async (url) => {
   const page = await browser.newPage();
   await page.goto('{{$parameter["values"]["string"][0]["value"].toString().replace('=','')}}'+url);
   
   // You would add additional code to do stuff... 
   await page.setViewport({width: 1920,height: 1080,deviceScaleFactor: 1,});
   // await sleep(10000);
	// await page.screenshot({path: 'xyz-screenshot.png'});
   const html = await page.content();
   //fs.writeFileSync('xyz-source.htm', html); // create a random name here for each url output
   console.log(colors.green.bold('Script Completed'));
   return html;
   });```




the return html should have the array output results, I want to send this to a webhook for n8n to ingest (as the puppeteer host is not the same host as n8n)

any thoughts?

You can make an HTTP request to the webhook and include the HTML in the body.

Do you have any code I can borrow?

aha think i have solved it now, webhook works