Skip to content

Conversation

martechdev
Copy link

@martechdev martechdev commented Oct 7, 2025

Summary

Adds a new Screenshotbase integration with one app and four actions powered by the Take endpoint.

Website: https://screenshotbase.com
Docs: https://screenshotbase.com/docs/take


What’s included

  • App: screenshotbase
  • Auth: API Key via apikey header
  • Test: GET https://api.screenshotbase.com/status
  • Actions (all call GET /v1/take)
    • Take Screenshot (basic)
    • Take PDF (format=pdf)
    • Take from HTML (render from raw HTML)
    • Take Screenshot (Advanced)format, quality, full_page, viewport_width, viewport_height

Files added

  • components/screenshotbase/screenshotbase.app.mjs
  • components/screenshotbase/actions/capture/capture.mjs (Take Screenshot)
  • components/screenshotbase/actions/take_pdf/take_pdf.mjs (Take PDF)
  • components/screenshotbase/actions/take_html/take_html.mjs (Take from HTML)
  • components/screenshotbase/actions/take_advanced/take_advanced.mjs (Advanced)

Endpoint usage (Take)

  • Required:
    • url
  • Optional:
    • viewport_width (default 1280)
    • viewport_height (default 800)
    • full_page (0/1)
    • format (jpg, jpeg, png, gif)
    • quality (for jpg/jpeg only)
  • Response: JSON with a URL to the rendered asset

Testing instructions

  1. Connect Screenshotbase app (provide API key).
  2. Run “Take Screenshot” with e.g.:
    url=https://example.com, viewport_width=1280, viewport_height=800, full_page=1, format=png
  3. Verify JSON output includes an asset URL.

Example (Pipedream Code step):

import { axios } from "@pipedream/platform";
export default defineComponent({
  props: { api_key: { type: "string" }, url: { type: "string", default: "https://example.com" } },
  async run({ $ }) {
    const res = await axios($, {
      method: "GET",
      url: "https://api.screenshotbase.com/v1/take",
      headers: { apikey: this.api_key },
      params: { url: this.url, viewport_width: 1280, viewport_height: 800, full_page: 1, format: "png" },
    });
    $.export("result", res);
  },
});

Notes for reviewers

  • Uses axios from @pipedream/platform and query params to match docs.
  • Auth via apikey header; app test uses /status.
  • Advanced action exposes the full parameter set; others provide simplified UX.

Checklist

  • App auth + passing test
  • Actions validate required input and map to documented params
  • Uses axios($) and handles JSON responses
  • Links to site and docs
  • Manually tested in a Pipedream workflow

Attribution

Author: Everapi ([email protected])
Committer: martechdev

Summary by CodeRabbit

  • New Features
    • Added Screenshotbase integration with API key connection.
    • Introduced actions: Take Screenshot, Take Screenshot (Advanced), Take Screenshot from HTML, and Take PDF.
    • Configurable options: URL or HTML input, format (image/PDF), viewport width/height, full-page capture, quality, wait-for-selector, and transparent background.
    • Action outputs include the captured file in the workflow step result.

Copy link

vercel bot commented Oct 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 7, 2025 9:21am

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Oct 7, 2025
@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds a new Screenshotbase app integration with auth, base URL helper, and connection test, plus four new actions to capture screenshots: basic capture, advanced capture, HTML-to-image, and URL-to-PDF. Each action builds params, calls GET {base}/v1/take with apikey header, exports "result", and returns the response.

Changes

Cohort / File(s) Summary of Changes
Screenshotbase App
components/screenshotbase/screenshotbase.app.mjs
New app definition with api_key and optional base_url auth, status test request, connection label, and baseUrl() helper method.
Screenshot Actions
components/screenshotbase/actions/capture/capture.mjs, components/screenshotbase/actions/take_advanced/take_advanced.mjs, components/screenshotbase/actions/take_html/take_html.mjs, components/screenshotbase/actions/take_pdf/take_pdf.mjs
Added four actions to call Screenshotbase /v1/take via axios with apikey header. Each defines metadata and props; constructs query params (URL/HTML, viewport, format, flags); exports "result" and returns response.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User (Pipedream)
  participant A as Action (Capture/Advanced/HTML/PDF)
  participant APP as Screenshotbase App (baseUrl)
  participant API as Screenshotbase API

  U->>A: Provide props (url/html, viewport, format, flags)
  A->>APP: baseUrl()
  APP-->>A: https://api.screenshotbase.com or custom
  A->>API: GET {base}/v1/take<br/>headers: apikey<br/>query: params
  API-->>A: Response (image/pdf bytes or JSON)
  A-->>U: $.export("result", res) and return
  note over A,API: No explicit error handling in actions
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws—new shots to take,
From URL or HTML we bake.
A PDF nibble, a viewport tweak,
API keys tucked in, neat and sleek.
Hop, click, snap—result in sight,
Screenshot moons glow crisp and bright. 🐇📸

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description does not follow the required template, as it omits the “## WHY” section mandated by the repository template and instead uses custom headings without explaining the motivation for this integration. Please add a “## WHY” section per the repository template to clearly explain the motivation for introducing the Screenshotbase integration and ensure the description matches the required structure.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes adding the Screenshotbase integration and associated take actions against the GET /v1/take endpoint, matching the primary changeset without extra noise or ambiguity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
components/screenshotbase/screenshotbase.app.mjs (1)

32-34: Consider validating the base URL format.

The baseUrl() method trims whitespace but doesn't validate that the result is a well-formed URL. While axios will throw if the URL is invalid, adding validation here would provide clearer error messages to users.

Consider adding URL validation:

     baseUrl() {
-      return this.$auth.base_url?.trim() || "https://api.screenshotbase.com";
+      const url = this.$auth.base_url?.trim() || "https://api.screenshotbase.com";
+      try {
+        new URL(url);
+        return url;
+      } catch (e) {
+        throw new Error(`Invalid base_url: ${url}`);
+      }
     },
components/screenshotbase/actions/capture/capture.mjs (1)

53-53: Remove unused steps parameter.

The steps parameter is declared but never used in the function body.

Apply this diff:

-  async run({ steps, $ }) {
+  async run({ $ }) {
components/screenshotbase/actions/take_html/take_html.mjs (1)

12-12: Consider validating the HTML input.

The html prop is marked as required but doesn't validate that the input contains actual HTML content. Users could accidentally submit empty or whitespace-only strings, leading to API errors.

Add validation in the prop definition:

-    html: { label: "HTML", type: "string", optional: false },
+    html: { 
+      label: "HTML", 
+      type: "string", 
+      optional: false,
+      description: "Raw HTML to render as a screenshot",
+    },

Or add validation in the run method:

   async run({ $ }) {
+    if (!this.html?.trim()) {
+      throw new Error("HTML content cannot be empty");
+    }
     const base = this.screenshotbase.baseUrl();
components/screenshotbase/actions/take_pdf/take_pdf.mjs (1)

12-12: Consider validating the URL input.

The url prop is required but doesn't validate that it's a well-formed URL. This could lead to confusing API errors if users provide invalid input.

Add validation:

-    url: { label: "URL", type: "string", optional: false },
+    url: { 
+      label: "URL", 
+      type: "string", 
+      optional: false,
+      description: "Website URL to render as PDF (must include protocol, e.g., https://)",
+    },

Or validate in the run method:

   async run({ $ }) {
+    try {
+      new URL(this.url);
+    } catch (e) {
+      throw new Error(`Invalid URL: ${this.url}`);
+    }
     const base = this.screenshotbase.baseUrl();
components/screenshotbase/actions/take_advanced/take_advanced.mjs (2)

12-12: Consider validating the URL input.

Same as other actions: the url prop doesn't validate that it's well-formed. See the comment on take_pdf.mjs for suggested validation approaches.


14-14: Document quality parameter constraints.

The quality prop is labeled "jpg/jpeg only" but doesn't enforce this constraint or document the valid range (typically 1-100). Consider adding validation or at least a clearer description.

-    quality: { label: "Quality (jpg/jpeg only)", type: "integer", optional: true },
+    quality: { 
+      label: "Quality (jpg/jpeg only)", 
+      type: "integer", 
+      optional: true,
+      description: "Quality setting 1-100 (only applies when format is jpg or jpeg)",
+      min: 1,
+      max: 100,
+    },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c1a754 and 66e0e16.

📒 Files selected for processing (5)
  • components/screenshotbase/actions/capture/capture.mjs (1 hunks)
  • components/screenshotbase/actions/take_advanced/take_advanced.mjs (1 hunks)
  • components/screenshotbase/actions/take_html/take_html.mjs (1 hunks)
  • components/screenshotbase/actions/take_pdf/take_pdf.mjs (1 hunks)
  • components/screenshotbase/screenshotbase.app.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
components/screenshotbase/actions/take_advanced/take_advanced.mjs (3)
components/screenshotbase/actions/capture/capture.mjs (3)
  • base (54-54)
  • params (55-61)
  • res (62-67)
components/screenshotbase/actions/take_html/take_html.mjs (3)
  • base (18-18)
  • params (19-24)
  • res (25-30)
components/screenshotbase/actions/take_pdf/take_pdf.mjs (3)
  • base (17-17)
  • params (18-23)
  • res (24-29)
components/screenshotbase/actions/take_pdf/take_pdf.mjs (3)
components/screenshotbase/actions/capture/capture.mjs (3)
  • base (54-54)
  • params (55-61)
  • res (62-67)
components/screenshotbase/actions/take_advanced/take_advanced.mjs (3)
  • base (20-20)
  • params (21-28)
  • res (29-34)
components/screenshotbase/actions/take_html/take_html.mjs (3)
  • base (18-18)
  • params (19-24)
  • res (25-30)
components/screenshotbase/actions/take_html/take_html.mjs (3)
components/screenshotbase/actions/capture/capture.mjs (3)
  • base (54-54)
  • params (55-61)
  • res (62-67)
components/screenshotbase/actions/take_advanced/take_advanced.mjs (3)
  • base (20-20)
  • params (21-28)
  • res (29-34)
components/screenshotbase/actions/take_pdf/take_pdf.mjs (3)
  • base (17-17)
  • params (18-23)
  • res (24-29)
components/screenshotbase/actions/capture/capture.mjs (3)
components/screenshotbase/actions/take_advanced/take_advanced.mjs (3)
  • base (20-20)
  • params (21-28)
  • res (29-34)
components/screenshotbase/actions/take_html/take_html.mjs (3)
  • base (18-18)
  • params (19-24)
  • res (25-30)
components/screenshotbase/actions/take_pdf/take_pdf.mjs (3)
  • base (17-17)
  • params (18-23)
  • res (24-29)
🔇 Additional comments (1)
components/screenshotbase/actions/take_html/take_html.mjs (1)

13-13: Verify inconsistent viewport width default.

The default viewport_width is 800 here, while other actions (take_pdf, take_advanced) use 1280. If this difference is intentional for HTML rendering, consider adding a comment explaining the rationale; otherwise, align the defaults for consistency.

Comment on lines +42 to +51
waitForSelector: {
type: "string",
label: "Wait for CSS Selector",
optional: true,
},
omitBackground: {
type: "boolean",
label: "Transparent Background",
optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Declared props are not sent to the API.

The waitForSelector and omitBackground props are declared but never included in the params object (lines 55-61), meaning users who configure these options will expect them to work but they won't be sent to the Screenshotbase API.

Apply this diff to include the missing parameters:

     const params = {
       url: this.url,
       viewport_width: this.width,
       viewport_height: this.height,
       format: this.format,
       full_page: this.fullPage ? 1 : undefined,
+      wait_for_selector: this.waitForSelector,
+      omit_background: this.omitBackground ? 1 : undefined,
     };

Verify the correct parameter names with the Screenshotbase API documentation, as I've assumed snake_case naming convention based on other parameters.


🏁 Script executed:

#!/bin/bash
grep -nR "const params" -n components/screenshotbase/actions/capture/capture.mjs
sed -n '1,200p' components/screenshotbase/actions/capture/capture.mjs | sed -n '50,80p'

Length of output: 550


Pass declared props to the API

Add the missing wait_for_selector and omit_background parameters so user‐configured options are sent:

   const params = {
     url: this.url,
     viewport_width: this.width,
     viewport_height: this.height,
     format: this.format,
     full_page: this.fullPage ? 1 : undefined,
+    wait_for_selector: this.waitForSelector,
+    omit_background: this.omitBackground ? 1 : undefined,
   };

Verify the exact parameter names against the Screenshotbase API docs.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
waitForSelector: {
type: "string",
label: "Wait for CSS Selector",
optional: true,
},
omitBackground: {
type: "boolean",
label: "Transparent Background",
optional: true,
},
const params = {
url: this.url,
viewport_width: this.width,
viewport_height: this.height,
format: this.format,
full_page: this.fullPage ? 1 : undefined,
wait_for_selector: this.waitForSelector,
omit_background: this.omitBackground ? 1 : undefined,
};
🤖 Prompt for AI Agents
In components/screenshotbase/actions/capture/capture.mjs around lines 42-51, the
declared action props waitForSelector and omitBackground are defined but not
passed to the Screenshotbase API; update the code that builds the API request
payload to include wait_for_selector (from waitForSelector) and omit_background
(from omitBackground) using the exact parameter names from the Screenshotbase
docs, ensuring optional props are only added when present and mapping camelCase
to snake_case.

Comment on lines +21 to +28
test: {
request: {
url: "https://api.screenshotbase.com/status",
headers: {
apikey: "{{auth.api_key}}",
},
},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Test ignores custom base_url.

The test block hardcodes https://api.screenshotbase.com/status even when the user provides a custom base_url in the auth configuration. This will cause false negatives for users with custom base URLs, as the connection test will always validate against the default endpoint rather than their configured one.

Apply this diff to respect the user's base_url configuration:

     test: {
       request: {
-        url: "https://api.screenshotbase.com/status",
+        url: "{{auth.base_url || 'https://api.screenshotbase.com'}}/status",
         headers: {
           apikey: "{{auth.api_key}}",
         },
       },
     },

Note: If the test endpoint path differs between environments, you may need to adjust the template accordingly.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test: {
request: {
url: "https://api.screenshotbase.com/status",
headers: {
apikey: "{{auth.api_key}}",
},
},
},
test: {
request: {
url: "{{auth.base_url || 'https://api.screenshotbase.com'}}/status",
headers: {
apikey: "{{auth.api_key}}",
},
},
},
🤖 Prompt for AI Agents
In components/screenshotbase/screenshotbase.app.mjs around lines 21 to 28, the
test request currently hardcodes the default status URL; change it to build the
URL from the user's configured base_url with a fallback to the default (e.g. use
auth.base_url if present otherwise https://api.screenshotbase.com, then append
the /status path, taking care to avoid double slashes), leaving the apikey
header intact so the connection test runs against the user's base_url when
provided.

@lcaresia lcaresia moved this from Ready for PR Review to Ready for QA in Component (Source and Action) Backlog Oct 7, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Oct 8, 2025
@vunguyenhung vunguyenhung moved this from In QA to Changes Required in Component (Source and Action) Backlog Oct 8, 2025
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Add-Screenshotbase-app-and-Take-actions-GET-v1-take-285bf548bb5e810eadd3fc4932007417

@martechdev
Copy link
Author

test cases should be fixed now.

@michelle0927 michelle0927 moved this from Changes Required to Ready for QA in Component (Source and Action) Backlog Oct 9, 2025
@vunguyenhung
Copy link
Collaborator

vunguyenhung commented Oct 10, 2025

@martechdev I still see the same error when publishing on my side

image

@vunguyenhung vunguyenhung moved this from Ready for QA to Changes Required in Component (Source and Action) Backlog Oct 10, 2025
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Add-Screenshotbase-app-and-Take-actions-GET-v1-take-285bf548bb5e810eadd3fc4932007417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

User submitted Submitted by a user

Projects

Development

Successfully merging this pull request may close these issues.

5 participants