Skip to content

Conversation

@lcaresia
Copy link
Collaborator

@lcaresia lcaresia commented Dec 12, 2025

WHY

Summary by CodeRabbit

  • New Features
    • Create customer charges to process billing transactions
    • Create and track customer events for analytics
    • Create or update customer records with custom attributes support
  • Improvements
    • Added Crowdpower integration with configurable inputs and API support for charges, customers, and events

✏️ Tip: You can customize this high-level summary in your review settings.

@lcaresia lcaresia self-assigned this Dec 12, 2025
@vercel
Copy link

vercel bot commented Dec 12, 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 Dec 12, 2025 0:52am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

Adds three Crowdpower action modules (create charge, create event, upsert customer), extends the Crowdpower app with HTTP request helpers and API wrapper methods, and updates package metadata (version and dependency).

Changes

Cohort / File(s) Summary
New Action Modules
components/crowdpower/actions/create-customer-charge/create-customer-charge.mjs, components/crowdpower/actions/create-customer-event/create-customer-event.mjs, components/crowdpower/actions/upsert-customer/upsert-customer.mjs
Three new action descriptors exporting metadata, props (bound to app propDefinitions), and async run methods that call corresponding this.app API wrapper methods, export a $summary based on response fields, and return the API response.
App Module Enhancement
components/crowdpower/crowdpower.app.mjs
Populated propDefinitions (userId, amount, email, name, customAttributes, action); added _baseUrl(), _makeRequest(opts) (uses Bearer token from this.$auth.application_key), and API wrapper methods createCustomerCharge, upsertCustomer, and createCustomerEvent that POST to Crowdpower endpoints. Removed prior authKeys() logic.
Package Configuration
components/crowdpower/package.json
Bumped version 0.0.40.1.0; added dependencies with @pipedream/platform set to ^3.1.1.

Sequence Diagram(s)

mermaid
sequenceDiagram
autonumber
participant Action as Action Module
participant App as Crowdpower App
participant API as Crowdpower API
participant Runtime as Platform Runtime
Note over Action,Runtime: action invoked by runtime
Runtime->>Action: invoke run({ $ })
Action->>App: call createCustomer*(payload)
App->>API: POST /charges or /customers or /events (Authorization: Bearer ...)
API-->>App: HTTP response (JSON: success, code, ...)
App-->>Action: return response object
Action->>Runtime: $.export("$summary", ...) and return response

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas to focus review on:
    • _makeRequest (axios usage, header/auth handling, error propagation and status handling).
    • API wrapper methods: endpoint paths, payload field mappings (e.g., user_id, custom_attributes), and expected response shape (success, code).
    • Action modules: propDefinition bindings match propDefinitions in the app and correct propagation of props into API calls.
    • package.json bump and added dependency for compatibility with runtime.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is incomplete; the required 'WHY' section contains only a placeholder comment with no actual explanation of the changes or rationale. Complete the 'WHY' section with a clear explanation of what was changed and why these Crowdpower API actions were added.
Title check ❓ Inconclusive The title '[Components] crowdpower #13454' is vague and generic, using only an issue number without describing the actual changes made in the pull request. Replace with a descriptive title that summarizes the main changes, such as 'Add Crowdpower customer charge, event, and upsert actions'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-13454

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7246007 and 1bec5cc.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • components/crowdpower/package.json (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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/crowdpower/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components

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

@lcaresia lcaresia linked an issue Dec 12, 2025 that may be closed by this pull request
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: 6

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3317f40 and 8264853.

📒 Files selected for processing (5)
  • components/crowdpower/actions/create-customer-charge/create-customer-charge.mjs (1 hunks)
  • components/crowdpower/actions/create-customer-event/create-customer-event.mjs (1 hunks)
  • components/crowdpower/actions/upsert-customer/upsert-customer.mjs (1 hunks)
  • components/crowdpower/crowdpower.app.mjs (1 hunks)
  • components/crowdpower/package.json (2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 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/crowdpower/package.json
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".

Applied to files:

  • components/crowdpower/actions/create-customer-charge/create-customer-charge.mjs
  • components/crowdpower/actions/create-customer-event/create-customer-event.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.

Applied to files:

  • components/crowdpower/crowdpower.app.mjs
📚 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/crowdpower/crowdpower.app.mjs
🧬 Code graph analysis (2)
components/crowdpower/actions/upsert-customer/upsert-customer.mjs (2)
components/crowdpower/actions/create-customer-charge/create-customer-charge.mjs (1)
  • response (30-36)
components/crowdpower/actions/create-customer-event/create-customer-event.mjs (1)
  • response (37-44)
components/crowdpower/actions/create-customer-charge/create-customer-charge.mjs (2)
components/crowdpower/actions/create-customer-event/create-customer-event.mjs (1)
  • response (37-44)
components/crowdpower/actions/upsert-customer/upsert-customer.mjs (1)
  • response (43-51)
🪛 GitHub Actions: Components Checks
components/crowdpower/package.json

[error] 1-1: Lockfile specifiers do not match package.json: the lockfile has {} while package.json requires "@pipedream/platform":"^1.6.8".

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pnpm publish
🔇 Additional comments (3)
components/crowdpower/package.json (1)

3-3: Version bump OK, but ensure it matches your release intent (0.0.4 → 0.1.0).

Confirm this is intended as a minor bump (new actions + app surface). Also confirm any internal component registry/versioning expectations for Pipedream components.

components/crowdpower/crowdpower.app.mjs (1)

42-57: Confirm @pipedream/platform axios behavior (return shape + non-2xx errors) matches action expectations.

Actions rely on response.success / response.code. Please verify axios($, config) returns the API JSON body (not an AxiosResponse wrapper), and whether it throws on non-2xx (in which case action summaries won’t run unless wrapped).

components/crowdpower/actions/upsert-customer/upsert-customer.mjs (1)

16-22: The current implementation is correct as-is. The userId parameter cannot be optional because it is embedded in the API endpoint path: PUT /customers/${user_id}. Without userId, the API call would fail with an invalid endpoint (e.g., /customers/undefined).

The review comment misunderstands the action's purpose. This action is designed for updating/upserting an existing customer identified by their userId. If the Crowdpower API supports true create-or-update semantics via the PUT /customers/{userId} endpoint, then userId remains required. If the intended use case is to create customers without pre-existing IDs, a separate endpoint or action logic would be needed, but the current implementation correctly uses the endpoint as designed.

Comment on lines +39 to +56
_baseUrl() {
return "https://beacon.crowdpower.io/";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
"Authorization": `Bearer ${this.$auth.application_key}`,
...headers,
},
});
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

Avoid https://...//path (double slash) by fixing base URL / path join.

Right now _baseUrl() ends with / and path begins with /, producing // in the final URL. Safer to join with new URL() (and drop the trailing slash).

 _baseUrl() {
-  return "https://beacon.crowdpower.io/";
+  return "https://beacon.crowdpower.io";
 },
 async _makeRequest(opts = {}) {
   const {
     $ = this,
     path,
     headers,
     ...otherOpts
   } = opts;
+  if (!path) {
+    throw new Error("Missing required `path` in _makeRequest()");
+  }
   return axios($, {
     ...otherOpts,
-    url: this._baseUrl() + path,
+    url: new URL(path, this._baseUrl()).toString(),
     headers: {
       "Authorization": `Bearer ${this.$auth.application_key}`,
       ...headers,
     },
   });
 },
📝 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
_baseUrl() {
return "https://beacon.crowdpower.io/";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
"Authorization": `Bearer ${this.$auth.application_key}`,
...headers,
},
});
_baseUrl() {
return "https://beacon.crowdpower.io";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
if (!path) {
throw new Error("Missing required `path` in _makeRequest()");
}
return axios($, {
...otherOpts,
url: new URL(path, this._baseUrl()).toString(),
headers: {
"Authorization": `Bearer ${this.$auth.application_key}`,
...headers,
},
});
},
🤖 Prompt for AI Agents
In components/crowdpower/crowdpower.app.mjs around lines 39 to 56, the
_baseUrl() returns a string with a trailing slash and _makeRequest concatenates
it with path which may start with a leading slash, producing a double-slash in
the final URL; fix by returning the base URL without the trailing slash or by
normalizing the join using new URL(path, this._baseUrl()) so the path and base
are combined safely (or strip a leading slash from path before concatenation)
and ensure axios receives a single well-formed URL.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Btw the CodeRabbit comment here is correct, please fix the base URL or the endpoints, they're generating a double slash.

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

Looks good to me. But I did leave one comment regarding summaries that may need to be improved.

Comment on lines +37 to +39
$.export("$summary", response.success
? `Request succeeded with code ${response.code}`
: `Request failed with code ${response.code}`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are the summaries intended to be like this? Usually we use more specific wording in each action, rather than a generic "request succeeded" or "request failed"

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Components] crowdpower

3 participants