Skip to content

Conversation

@SumitYewale-Thalia
Copy link

@SumitYewale-Thalia SumitYewale-Thalia commented Nov 7, 2025

WHY

Resolves #18697

Summary

This PR introduces a new Csvbox component to the Pipedream components library.

Csvbox allows users to collect CSV data through hosted importers and send it directly into their applications.
This component connects to a user’s Csvbox account, retrieves available sheets, provides sample data for mapping with subsequent components, and listens for import events once deployed.

Functionality

  • Authentication: Uses the user’s Csvbox API key for authorization and fetches all available sheets from the user’s account after successful connection.
  • Sample Data: Provides a sample row of the sheet to help users map fields to other components.
  • Trigger: After deployment, the component continuously listens for new imports.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added CSVBox New Row source to trigger automations when rows are added to sheets.
    • Sheet selection interface now uses a dropdown menu for easier navigation.
  • Improvements

    • Enhanced authentication and API request handling.

@vercel
Copy link

vercel bot commented Nov 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 Nov 7, 2025 10:49am

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Nov 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.

@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:

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds a new CSVBox webhook-based source component for detecting new rows, introduces a shared constants module with BASE_URL, and refactors the CSVBox app module with standardized request helpers and new public methods for webhook and sheet management. Version downgraded to 0.0.1 with updated dependencies.

Changes

Cohort / File(s) Summary
Shared Constants
components/csvbox/common/constants.mjs
New ES module exporting BASE_URL constant for CSVBox API endpoint.
New Row Source
components/csvbox/csvbox-new-row/csvbox-new-row.mjs
New webhook-based source component emitting events on new CSVBox rows. Includes activation (webhook registration), deactivation (webhook cleanup), deployment (sample emit), and run logic (webhook body forwarding) with sample events.
App Module Refactoring
components/csvbox/csvbox.app.mjs
Replaced sheetLicenseKey prop with sheetId featuring dynamic sheet selection. Added internal helpers (_getAuthKeys, _getSecretAuthKeys, _getUrl, _getHeaders, _makeRequest) for standardized API requests. Introduced public methods: createHook, deleteHook, listSheets.
Dependencies & Metadata
components/csvbox/package.json
Version downgraded from 0.1.0 to 0.0.1. Updated @pipedream/platform dependency to ^3.0.3. Removed form-data dependency.

Sequence Diagram

sequenceDiagram
    participant User
    participant Source as csvbox-new-row
    participant App as csvbox.app
    participant CSVBox as CSVBox API
    participant DB as Database
    
    rect rgb(200, 220, 240)
    Note over Source,DB: Activation Phase
    User->>Source: Enable source
    Source->>App: createHook(data)
    App->>App: _getAuthKeys() & _getHeaders()
    App->>CSVBox: POST /register-webhook
    CSVBox-->>App: { hookId }
    App-->>Source: Response with hookId
    Source->>DB: Store hookId & sample row
    end
    
    rect rgb(220, 240, 220)
    Note over Source,CSVBox: Webhook Reception Phase
    CSVBox->>Source: POST webhook body (new row)
    Source->>Source: Extract id & summary
    Source->>User: Emit row event
    end
    
    rect rgb(240, 220, 220)
    Note over Source,DB: Deactivation Phase
    User->>Source: Disable source
    Source->>App: deleteHook({ hookId })
    App->>CSVBox: DELETE /delete-webhook
    CSVBox-->>App: Success
    Source->>DB: Clear hookId & sample row
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Areas requiring extra attention:

  • Error handling in csvbox-new-row.mjs: Verify robust error handling during webhook registration/deactivation and validate sample row persistence logic
  • Authentication header flow: Confirm _getAuthKeys() and _getSecretAuthKeys() properly extract and pass authentication credentials across all API calls
  • Webhook lifecycle management: Validate that stored hookId and sampleRow are correctly managed during activate/deactivate/deploy transitions
  • Dynamic sheet options: Ensure listSheets() properly maps responses to label/value pairs for prop rendering
  • _makeRequest abstraction: Verify the new helper correctly handles response formats and config merging for all three new endpoints

Pre-merge checks and finishing touches

❌ Failed checks (2 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title '[Component] CSVBox components' is generic and vague, not clearly identifying the specific change or feature being introduced. Consider a more specific title that highlights the main change, such as '[Component] Add CSVBox source trigger for new row imports' or similar.
Linked Issues check ❓ Inconclusive The PR implements core objectives from #18697: a CSVBox source trigger for new row imports with sample data provision. However, the linked issue also requests an action 'test-sample-row' which is not addressed. Verify if 'test-sample-row' action is intended for this PR or a future one. The trigger 'import-new-row' is implemented as 'csvbox-new-row' source component.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description comprehensively covers the WHY section with context, summary, functionality details, and clear objectives aligned with the linked issue.
Out of Scope Changes check ✅ Passed All changes are within scope: new constants module, new csvbox-new-row source component, updates to csvbox.app.mjs for API integration, and package.json version/dependency updates are all necessary for the CSVBox integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@SumitYewale-Thalia SumitYewale-Thalia marked this pull request as draft November 7, 2025 10:39
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/csvbox/package.json (1)

3-17: Avoid decreasing the published package version.

The version rollback from 0.1.0 to 0.0.1 will be rejected by the npm registry: once a version is published it cannot be reused, so the publish step will fail. Please bump the version forward (e.g., 0.1.1) instead of decrementing it.(docs.npmjs.com)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cacd514 and b099d8b.

📒 Files selected for processing (4)
  • components/csvbox/common/constants.mjs (1 hunks)
  • components/csvbox/csvbox-new-row/csvbox-new-row.mjs (1 hunks)
  • components/csvbox/csvbox.app.mjs (1 hunks)
  • components/csvbox/package.json (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.

Applied to files:

  • components/csvbox/package.json
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.

Applied to files:

  • components/csvbox/package.json
  • components/csvbox/csvbox.app.mjs

Comment on lines +112 to +123
async run(event) {
const { body } = event;
if (!body) {
console.error("Received empty webhook body");
return;
}

this.$emit(body, {
id: body[0].import_id || `${body[0].sheet_id}_${Date.now()}`,
summary: `New data imported to sheet ${body[0].sheet_name}`,
ts: Date.now(),
});
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

Guard against empty or non-array webhook payloads.

CSVBox sends webhook payloads as JSON arrays of rows, but chunking and configuration can yield empty arrays; dereferencing body[0] without checking will throw and drop the delivery. Add a shape check and iterate the rows (or at least guard the first element) before emitting.(help.csvbox.io)

   async run(event) {
     const { body } = event;
-    if (!body) {
-      console.error("Received empty webhook body");
-      return;
-    }
-
-    this.$emit(body, {
-      id: body[0].import_id || `${body[0].sheet_id}_${Date.now()}`,
-      summary: `New data imported to sheet ${body[0].sheet_name}`,
-      ts: Date.now(),
-    });
+    if (!Array.isArray(body) || body.length === 0) {
+      console.error("Received webhook payload without row data");
+      return;
+    }
+
+    for (const row of body) {
+      this.$emit(row, {
+        id: row.import_id || `${row.sheet_id}_${Date.now()}`,
+        summary: `New data imported to sheet ${row.sheet_name}`,
+        ts: Date.now(),
+      });
+    }
   },
📝 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
async run(event) {
const { body } = event;
if (!body) {
console.error("Received empty webhook body");
return;
}
this.$emit(body, {
id: body[0].import_id || `${body[0].sheet_id}_${Date.now()}`,
summary: `New data imported to sheet ${body[0].sheet_name}`,
ts: Date.now(),
});
async run(event) {
const { body } = event;
if (!Array.isArray(body) || body.length === 0) {
console.error("Received webhook payload without row data");
return;
}
for (const row of body) {
this.$emit(row, {
id: row.import_id || `${row.sheet_id}_${Date.now()}`,
summary: `New data imported to sheet ${row.sheet_name}`,
ts: Date.now(),
});
}
}

@SumitYewale-Thalia SumitYewale-Thalia deleted the feature/csvbox-app-integration branch November 7, 2025 10:53
@SumitYewale-Thalia
Copy link
Author

I have created a new PR #18982, so closing this one.

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

None yet

Development

Successfully merging this pull request may close these issues.

[Components] Csvbox Integration

3 participants