How Can I Use Puppeteer to Take a Screenshot and Add It to a Discord Alert on Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

How can I use puppeteer on pipedream? I want to use some code that takes a screenshot of a specific page after the trigger is set off, and add the screenshot to a discord alert

Hello ,

Unfortunately Pipedream haven’t support puppeteer yet. We have an issue tracking here https://github.com/PipedreamHQ/pipedream/issues/209

You can follow the tutorials in this thread to proceed with some alternatives for this usecase https://pipedream.com/community/t/does-pipedream-work-for-a-puppeteer-nodejs-app/1975/2

Here’s a short video on how to use Browerless with Pipedream to take screenshots of a webpage:

Okay I’ve got to where I have base64 picture from browserless, but now how do I use it to send the picture to something like discord that require a url?

Hello , you can store the base64 image to the /tmp dir (using Node.js/Python code step) and upload it to a Cloud Storage provider such as Google Drive, Box, AWS, etc…
• Google Drive
• Box
• AWS S3
Finally, you can pass the public link to Discord

How do I save the image to /TMP?

When using the download to TMP it says invalid URL when I try to paste the base64 step code

Hello , apologize for the late response.

You can convert a base64 string to a file with a Node.js code step using a library like this. Then Pipedream provides a /tmp dir that allow you to save file

If you need more help, the Pipedream Team plan will provide you an access to a dedicated support channel.

Also if you’d like to hire an expert, you’re welcome to use this link: Connect with a Pipedream Partner

I’ve got to the part where I can save the file a d everything to the drive, but it’s now allowing me to use the base64 code from the previous step this way? How do I fix that

you can use Javascript’s string interpolation. For example, your base64String constant can be
data:image/png;base64,${steps.browserless.screenshot}

Finally got everything working :), thanks a lot for all your help Leo

So now my problem is that discord webhook doesn’t allow using drive url for images in the embed, but I can use the discord attach image, so how do I get around that? I want the image as a part of the embed

Hello , I’m not sure I understand your issue. Could you elaborate? Is it related to Pipedream discord action?

Sure, so basically I have it working like this, but when you attach file it doesn’t become part of the embed, unless you use url, so im trying to send the picture to url to use in the embed

I recommend that you store your image in a service that provides a publicly accessible URL. I’m not sure if Google Drive allows public accessible URLs by default via uploads to their API

Yeah, I was trying that with imgbb, but apparently the website was down for over 2 days, but now it’s back and everything is working great!