Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Dec 17, 2025

Resolves #17837

Summary by CodeRabbit

  • New Features
    • Added instant webhook-based event sources for Cloudbeds integrations: trigger workflows when guests are created, reservations are created, transactions are posted, or reservation statuses change.
    • Bumped Cloudbeds component version to 0.1.0 with new webhook management capabilities.

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

@vercel
Copy link

vercel bot commented Dec 17, 2025

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Dec 19, 2025 3:33pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Walkthrough

The PR introduces webhook support to the Cloudbeds component with API helper methods, a reusable base webhook lifecycle management class, and four concrete webhook sources (guest creation, reservation creation, transaction creation, reservation status change) with corresponding test events.

Changes

Cohort / File(s) Summary
Cloudbeds App Helpers
components/cloudbeds/cloudbeds.app.mjs, components/cloudbeds/package.json
Added _baseUrl() and _makeRequest() helper methods for API calls. Implemented createWebhook() and deleteWebhook() methods for webhook management. Removed unused authKeys() method. Version bumped from 0.0.1 to 0.1.0; added @pipedream/platform dependency.
Base Webhook Infrastructure
components/cloudbeds/sources/common/base-webhook.mjs
Created reusable base webhook component with lifecycle hooks (activate, deactivate), database persistence for webhook IDs, and standardized run flow with HTTP 200 response and event emission. Provides abstract methods for subclass implementation (getObject, getAction, generateMeta, isRelevant).
New Guest Created Webhook
components/cloudbeds/sources/new-guest-created/new-guest-created.mjs, components/cloudbeds/sources/new-guest-created/test-event.mjs
Concrete webhook source emitting events when guests are created. Implements object/action specification and metadata generation using guest ID and timestamp. Includes test event payload.
New Reservation Created Webhook
components/cloudbeds/sources/new-reservation-created/new-reservation-created.mjs, components/cloudbeds/sources/new-reservation-created/test-event.mjs
Concrete webhook source for new reservation events. Extracts reservation ID and timestamp for event metadata. Includes test event payload with reservation details.
New Transaction Created Webhook
components/cloudbeds/sources/new-transaction-created/new-transaction-created.mjs, components/cloudbeds/sources/new-transaction-created/test-event.mjs
Concrete webhook source for transaction creation events. Parses transaction ID and datetime for metadata. Includes test event payload with accounting-related fields.
Reservation Status Changed Webhook
components/cloudbeds/sources/reservation-status-changed/reservation-status-changed.mjs, components/cloudbeds/sources/reservation-status-changed/test-event.mjs
Concrete webhook source for reservation status changes with optional status filtering via a configurable statuses prop. Implements isRelevant() to filter by selected statuses. Includes test event with canceled status example.
Minor Formatting
components/browser_use/browser_use.app.mjs, components/gusto/gusto.app.mjs
Added trailing newlines at EOF.

Sequence Diagram

sequenceDiagram
    participant User
    participant Source as Webhook Source
    participant App as cloudbeds.app
    participant API as Cloudbeds API
    participant DB as Database
    participant HTTP as HTTP Response

    User->>Source: activate()
    activate Source
    Source->>App: createWebhook({endpoint, object, action})
    App->>API: POST /postWebhook with API key
    API-->>App: {subscriptionID, ...}
    App->>DB: setWebhookId(subscriptionID)
    DB-->>Source: webhookId stored
    deactivate Source

    API->>Source: Incoming webhook event
    activate Source
    Source->>HTTP: 200 OK (immediate)
    Source->>Source: isRelevant(body)?
    alt relevant
        Source->>Source: generateMeta(body)
        Source->>User: emit event with body + metadata
    else not relevant
        Source->>Source: exit
    end
    deactivate Source

    User->>Source: deactivate()
    activate Source
    Source->>DB: getWebhookId()
    DB-->>Source: webhookId
    Source->>App: deleteWebhook({webhookId})
    App->>API: DELETE /deleteWebhook with API key
    API-->>App: success
    deactivate Source
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Base webhook lifecycle logic: The activate/deactivate hooks and webhook ID persistence require careful review to ensure proper resource cleanup and error handling.
  • Multiple webhook implementations: Four concrete sources with distinct metadata generation logic; verify each implements the abstract methods correctly and handles timestamps/IDs appropriately.
  • API helper pattern: Validate that _makeRequest() and _baseUrl() correctly compose URLs, inject headers, and pass through authentication.
  • Test event data consistency: Ensure all test events match expected Cloudbeds API payloads for each webhook type.

Possibly related PRs

  • 13377 components encharge #19148: Introduces identical webhook lifecycle and API-wrapper patterns (app-level _makeRequest/base URL helpers and create/delete webhook methods plus a common base webhook with activate/deactivate and webhookId persistence).
  • 13382 components remote #19418: Adds the same API helper pattern and reusable webhook base plus concrete instant webhook sources using the same architecture.
  • Spotify improvements #19420: Adds a centralized _makeRequest helper and base URL helper to the app module, using the same design pattern for HTTP abstraction.

Suggested labels

ai-assisted

Suggested reviewers

  • jcortes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements 3 of 6 required webhook sources (new-guest-created, new-reservation-created, new-transaction-created), and missing implementations for new-cancelled-guest, new-checked-out-guest, and new-in-house-guest. Implement the remaining three required sources: new-cancelled-guest, new-checked-out-guest, and new-in-house-guest to fully address issue #17837.
Description check ❓ Inconclusive The description only contains 'Resolves #17837' and lacks substantive detail per the template, but links to the issue providing context. Expand description with a WHY section explaining the purpose of these new components, as specified in the template.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Cloudbeds - new components' directly reflects the main change: adding new Cloudbeds webhook source components.
Out of Scope Changes check ✅ Passed Changes are narrowly scoped to Cloudbeds components (new webhook sources, base helper, and minor formatting). Two trailing newlines in browser_use and gusto files are minor and acceptable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-17837

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 231486c and eb67655.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • components/browser_use/browser_use.app.mjs (1 hunks)
  • components/gusto/gusto.app.mjs (1 hunks)
⏰ 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: Lint Code Base
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (2)
components/gusto/gusto.app.mjs (1)

1-11: File appears unrelated to PR objectives.

This file (Gusto app) has only a trailing newline added, which is a harmless formatting change. However, the PR objectives focus on Cloudbeds component development (new-guest, new-reservation, etc.), and this file doesn't relate to that work.

Please verify whether this file was intentionally included or if it's an accidental change from editor auto-formatting.

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

1-11: File appears unrelated to PR objectives.

This file (Browser Use app) has only a trailing newline added, which is a harmless formatting change. However, like the Gusto app file, this doesn't relate to the PR's Cloudbeds component work.

Please verify whether this file was intentionally included or if it's an accidental change from editor auto-formatting.


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.

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

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e27319f and 1995b9f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • components/cloudbeds/cloudbeds.app.mjs (1 hunks)
  • components/cloudbeds/package.json (2 hunks)
  • components/cloudbeds/sources/common/base-webhook.mjs (1 hunks)
  • components/cloudbeds/sources/new-guest-created/new-guest-created.mjs (1 hunks)
  • components/cloudbeds/sources/new-guest-created/test-event.mjs (1 hunks)
  • components/cloudbeds/sources/new-reservation-created/new-reservation-created.mjs (1 hunks)
  • components/cloudbeds/sources/new-reservation-created/test-event.mjs (1 hunks)
  • components/cloudbeds/sources/new-transaction-created/new-transaction-created.mjs (1 hunks)
  • components/cloudbeds/sources/new-transaction-created/test-event.mjs (1 hunks)
  • components/cloudbeds/sources/reservation-status-changed/reservation-status-changed.mjs (1 hunks)
  • components/cloudbeds/sources/reservation-status-changed/test-event.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.

Applied to files:

  • components/cloudbeds/sources/new-guest-created/test-event.mjs
📚 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/cloudbeds/package.json
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.

Applied to files:

  • components/cloudbeds/sources/new-transaction-created/new-transaction-created.mjs
  • components/cloudbeds/cloudbeds.app.mjs
  • components/cloudbeds/sources/new-guest-created/new-guest-created.mjs
  • components/cloudbeds/sources/reservation-status-changed/reservation-status-changed.mjs
  • components/cloudbeds/sources/common/base-webhook.mjs
  • components/cloudbeds/sources/new-reservation-created/new-reservation-created.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/cloudbeds/cloudbeds.app.mjs
⏰ 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: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (14)
components/cloudbeds/package.json (1)

3-3: LGTM! Version bump and dependency addition are appropriate.

The version bump to 0.1.0 correctly reflects new feature additions, and the @pipedream/platform dependency is required for the axios imports used in cloudbeds.app.mjs.

Also applies to: 15-17

components/cloudbeds/sources/new-reservation-created/test-event.mjs (1)

1-10: LGTM! Test payload structure is consistent.

The test event payload structure is appropriate and consistent with the pattern used in other Cloudbeds test events.

components/cloudbeds/sources/new-reservation-created/new-reservation-created.mjs (1)

14-26: LGTM! Source implementation follows expected patterns.

The getObject/getAction pattern and generateMeta implementation are consistent with Pipedream webhook source conventions. The timestamp conversion using Math.floor is appropriate for the float timestamp format.

components/cloudbeds/sources/new-transaction-created/new-transaction-created.mjs (2)

14-26: LGTM! Source implementation follows expected patterns.

The getObject/getAction pattern and generateMeta implementation are consistent with Pipedream webhook source conventions. The use of Date.parse for the ISO datetime string is appropriate.


1-1: The base-webhook.mjs file exists at components/cloudbeds/sources/common/base-webhook.mjs in the codebase. The import path is valid and the file is already present, so there is no issue to address.

Likely an incorrect or invalid review comment.

components/cloudbeds/sources/reservation-status-changed/test-event.mjs (1)

1-13: > Likely an incorrect or invalid review comment.

components/cloudbeds/sources/new-guest-created/test-event.mjs (1)

1-9: > Likely an incorrect or invalid review comment.

components/cloudbeds/cloudbeds.app.mjs (2)

24-37: Webhook endpoint paths are correct per Cloudbeds API documentation.

The paths /postWebhook and /deleteWebhook match the official Cloudbeds API v1.3 specifications and require no changes.


8-10: The base URL uses the current API version. API version 1.3 is the current version in the Cloudbeds API documentation, so no update is needed.

components/cloudbeds/sources/common/base-webhook.mjs (2)

45-56: LGTM! Abstract method pattern is correct.

The unimplemented methods that throw ConfigurationError follow the established pattern for base classes that are meant to be extended, as confirmed by the retrieved learnings.

Based on learnings, this is the expected pattern for extensible base classes in this codebase.


14-24: No action needed—Content-Type header is correct.

The webhook creation endpoint correctly uses application/x-www-form-urlencoded. The JavaScript object payload will be properly serialized as form data by the HTTP client.

components/cloudbeds/sources/reservation-status-changed/reservation-status-changed.mjs (2)

32-36: No changes needed. The webhook values are correct: getObject() returns "reservation" and getAction() returns "status_changed", matching the Cloudbeds API specification for reservation status change webhooks.


18-26: Verify if the status options list includes "inquiry" and confirm "in_progress" is valid.

The Cloudbeds PMS documentation lists reservation statuses as "Confirmed, Confirmation Pending, Canceled, In-house, Checked out, or No Show," with "Inquiry" mentioned as a temporary status for 3DS-authorized reservations. The current code list (in_progress, confirmed, not_confirmed, canceled, checked_in, checked_out, no_show) appears to be missing the "inquiry" status. Additionally, "in_progress" does not appear in the official documentation and may not be a valid API status value. Cross-reference the current list against the Cloudbeds API reference documentation to ensure completeness.

components/cloudbeds/sources/new-guest-created/new-guest-created.mjs (1)

14-18: Verify the object and action values match the Cloudbeds webhook API.

The Cloudbeds postWebhook API endpoint uses object and action parameters, which aligns with the code structure. Documentation confirms "guest" is a valid webhook object (e.g., "guest/details_changed"), and the "created" action follows the documented pattern. Ensure these values are confirmed against the current Cloudbeds API Available Events documentation to verify support for guest/created events.

GTFalcao
GTFalcao previously approved these changes Dec 19, 2025
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.

LGTM!

@vunguyenhung
Copy link
Collaborator

For Integration QA:

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test reports

@michelle0927
Copy link
Collaborator Author

/approve

@GTFalcao GTFalcao merged commit ab796ab into master Dec 19, 2025
9 checks passed
@GTFalcao GTFalcao deleted the issue-17837 branch December 19, 2025 16:32
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] cloudbeds

4 participants