Skip to content

Conversation

@luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Jun 2, 2025

Resolves #13273.

Summary by CodeRabbit

  • New Features

    • Introduced actions to create posts, retrieve user profiles, and send messages to group chats in Beekeeper.
    • Added instant event sources for new chat messages, new comments, and new user creation, enabling real-time event detection.
    • Enhanced Beekeeper integration with advanced property selection and extended API support for chats, streams, users, posts, and webhooks.
  • Chores

    • Updated package version and dependencies for improved compatibility.
  • Utilities

    • Added new utility functions and constants to support data processing and configuration.

@luancazarine luancazarine added the ai-assisted Content generated by AI, with human refinement and modification label Jun 2, 2025
@vercel
Copy link

vercel bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 3, 2025 2:51pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 3, 2025 2:51pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 3, 2025 2:51pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 2, 2025

Walkthrough

This update introduces a new Beekeeper integration, adding comprehensive support for actions and instant webhook sources. It implements actions for sending group chat messages, creating posts, and retrieving user profiles, along with sources for instant events such as new chat messages, new users, and new comments. Supporting utilities, constants, and extensive API method implementations are included.

Changes

File(s) Change Summary
components/beekeeper/actions/create-post/create-post.mjs New action: Create Post in a stream with various options and scheduling support.
components/beekeeper/actions/get-profile/get-profile.mjs New action: Get User Profile with optional activity/totals.
components/beekeeper/actions/send-message-group-chat/send-message-group-chat.mjs New action: Send Message to Group Chat with validation and flexible message content.
components/beekeeper/beekeeper.app.mjs Full implementation of app methods, property definitions, and API interactions for Beekeeper.
components/beekeeper/common/constants.mjs Added LIMIT constant (100).
components/beekeeper/common/utils.mjs Added parseObject utility for safe JSON parsing of strings/arrays.
components/beekeeper/package.json Updated package version to 0.7.0 and upgraded @pipedream/platform dependency to ^3.0.3.
components/beekeeper/sources/common/base.mjs New common base for webhook lifecycle and event handling for sources.
components/beekeeper/sources/new-chat-message-instant/new-chat-message-instant.mjs New source: Emits event instantly for new chat messages (CHATS.MESSAGE.CREATED, CHATS_V2.MESSAGE.CREATED).
components/beekeeper/sources/new-chat-message-instant/test-event.mjs Test event fixture for new chat message webhook.
components/beekeeper/sources/new-comment-created-instant/new-comment-created-instant.mjs New source: Emits event instantly for new comments (POSTS.COMMENT.CREATED).
components/beekeeper/sources/new-comment-created-instant/test-event.mjs Test event fixture for new comment webhook.
components/beekeeper/sources/new-user-created-instant/new-user-created-instant.mjs New source: Emits event instantly for new users (USER.CREATED).
components/beekeeper/sources/new-user-created-instant/test-event.mjs Test event fixture for new user webhook.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action
    participant BeekeeperApp
    participant BeekeeperAPI

    User->>Action: Trigger action (e.g., Create Post, Send Message)
    Action->>BeekeeperApp: Call corresponding method with props
    BeekeeperApp->>BeekeeperAPI: Make API request
    BeekeeperAPI-->>BeekeeperApp: Return API response
    BeekeeperApp-->>Action: Return processed result
    Action-->>User: Return summary and data
Loading
sequenceDiagram
    participant BeekeeperAPI
    participant Webhook
    participant SourceBase
    participant SourceComponent

    BeekeeperAPI-->>Webhook: Triggers webhook on event (e.g., new message)
    Webhook->>SourceBase: POST event payload
    SourceBase->>SourceComponent: Emit event with summary and data
    SourceComponent-->>User: Event available for workflow
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement new-chat-message-instant source for CHATS.MESSAGE.CREATED, CHATS_V2.MESSAGE.CREATED (#13273)
Implement new-user-created-instant source for USER.CREATED (#13273)
Implement new-comment-created-instant source for POSTS.COMMENT.CREATED (#13273)
Implement send-message-group-chat action with required/optional props and async chatId options (#13273)
Implement create-post action with required/optional props and async streamId options (#13273)
Implement get-profile action with userId and optional props, async userId options (#13273)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Suggested labels

action, trigger / source

Suggested reviewers

  • GTFalcao

Poem

A rabbit hops with code so bright,
Beekeeper’s world now takes flight!
New posts, new chats, new users too—
Actions and triggers, all fresh and new.
With webhooks buzzing and messages sent,
This code deploy’s a hoppy event!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f19705 and d0be72d.

📒 Files selected for processing (1)
  • components/beekeeper/package.json (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/beekeeper/package.json
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sources
 - New Chat Message (Instant)
 - New User Created (Instant)
 - New Comment Added (Instant)

Actions
 - Send Message Group Chat
 - Create Post
 - Get Profile
@luancazarine luancazarine marked this pull request as ready for review June 2, 2025 20:43
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: 8

🧹 Nitpick comments (6)
components/beekeeper/common/utils.mjs (1)

1-24: Function logic is correct but consider adding JSDoc documentation.

The parseObject utility function handles JSON parsing gracefully with proper error handling and fallback behavior. The implementation correctly handles arrays, strings, and other data types.

Consider adding JSDoc documentation to clarify the function's purpose and expected behavior:

+/**
+ * Parses JSON strings to objects with graceful fallback
+ * @param {*} obj - Input to parse (string, array, or any other type)
+ * @returns {*} Parsed object(s) or original input if parsing fails
+ */
 export const parseObject = (obj) => {
components/beekeeper/sources/new-comment-created-instant/test-event.mjs (1)

14-14: Fix typo in domain name.

There's a typo in "beekeper" - it should be "beekeeper".

-  "tenant_fqdn": "happytenant.beekeper.io",
+  "tenant_fqdn": "happytenant.beekeeper.io",
components/beekeeper/sources/new-chat-message-instant/test-event.mjs (1)

35-35: Fix typo in domain name.

There's a typo in "beekeper" - it should be "beekeeper".

-  "tenant_fqdn": "happytenant.beekeper.io",
+  "tenant_fqdn": "happytenant.beekeeper.io",
components/beekeeper/actions/send-message-group-chat/send-message-group-chat.mjs (1)

62-62: Update error message to match actual property names.

The error message mentions "Event" but the actual property is "Event Type".

-      throw new ConfigurationError("You must provide at least **Body**, **Event**, **Attachment** or **Chat State Addons**");
+      throw new ConfigurationError("You must provide at least **Body**, **Event Type**, **Attachment** or **Chat State Addons**");
components/beekeeper/sources/common/base.mjs (1)

30-33: Consider adding error handling in deactivate hook.

While the current implementation works, adding error handling would make the webhook cleanup more robust, especially if the webhook has already been deleted or the API is unavailable.

  async deactivate() {
    const webhookId = this._getHookId();
-   await this.beekeeper.deleteWebhook(webhookId);
+   try {
+     await this.beekeeper.deleteWebhook(webhookId);
+   } catch (error) {
+     console.warn(`Failed to delete webhook ${webhookId}:`, error.message);
+   }
  },
components/beekeeper/actions/create-post/create-post.mjs (1)

91-93: Improve robustness of options mapping.

The options mapping could be more defensive to handle edge cases and provide better error messages.

-        options: parseObject(this.options)?.map((item) => ({
-          text: item,
-        })),
+        options: parseObject(this.options)?.map((item) => {
+          if (typeof item !== 'string') {
+            throw new Error(`Poll option must be a string, got ${typeof item}: ${item}`);
+          }
+          return { text: item };
+        }),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87649cc and 361f718.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (14)
  • components/beekeeper/actions/create-post/create-post.mjs (1 hunks)
  • components/beekeeper/actions/get-profile/get-profile.mjs (1 hunks)
  • components/beekeeper/actions/send-message-group-chat/send-message-group-chat.mjs (1 hunks)
  • components/beekeeper/beekeeper.app.mjs (1 hunks)
  • components/beekeeper/common/constants.mjs (1 hunks)
  • components/beekeeper/common/utils.mjs (1 hunks)
  • components/beekeeper/package.json (2 hunks)
  • components/beekeeper/sources/common/base.mjs (1 hunks)
  • components/beekeeper/sources/new-chat-message-instant/new-chat-message-instant.mjs (1 hunks)
  • components/beekeeper/sources/new-chat-message-instant/test-event.mjs (1 hunks)
  • components/beekeeper/sources/new-comment-created-instant/new-comment-created-instant.mjs (1 hunks)
  • components/beekeeper/sources/new-comment-created-instant/test-event.mjs (1 hunks)
  • components/beekeeper/sources/new-user-created-instant/new-user-created-instant.mjs (1 hunks)
  • components/beekeeper/sources/new-user-created-instant/test-event.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (14)
components/beekeeper/common/constants.mjs (1)

1-1: LGTM! Clean constant definition.

The LIMIT constant is well-defined and will provide consistency across the Beekeeper integration for pagination and batch operations.

components/beekeeper/package.json (2)

3-3: Verify the version downgrade intention.

The version was downgraded from 0.6.0 to 0.1.0. Please confirm this is intentional, as version downgrades are unusual and could cause issues with existing installations.


16-16: LGTM! Platform dependency update looks good.

The update to @pipedream/platform version ^3.0.3 is appropriate for the new integration features.

components/beekeeper/sources/new-comment-created-instant/new-comment-created-instant.mjs (1)

1-22: LGTM! Well-structured source component.

The implementation correctly:

  • Extends the common base pattern
  • Defines the appropriate event type for comment creation
  • Provides meaningful summary generation
  • Follows consistent naming conventions
components/beekeeper/actions/get-profile/get-profile.mjs (1)

1-43: LGTM! Well-implemented action component.

The implementation demonstrates good practices:

  • Clear property definitions with helpful descriptions
  • Proper parameter mapping for API calls
  • Meaningful summary export
  • Clean async/await usage
  • Follows consistent component structure
components/beekeeper/sources/common/base.mjs (1)

1-42: Well-structured webhook base class.

This base class follows good architectural patterns:

  • Clean separation of webhook lifecycle management
  • Proper use of database for state persistence
  • Abstract method pattern for subclass customization

The implementation handles webhook registration/deregistration correctly and provides a solid foundation for event sources.

components/beekeeper/sources/new-user-created-instant/new-user-created-instant.mjs (1)

1-22: Clean implementation of the event source pattern.

This source component correctly extends the base class and properly implements the required abstract methods. The event type "USER.CREATED" and summary generation are appropriate for the use case.

components/beekeeper/actions/create-post/create-post.mjs (1)

78-101: Well-structured action implementation.

The overall implementation demonstrates good practices:

  • Proper use of the parseObject utility for handling JSON inputs
  • Clear API method integration
  • Good user feedback with summary export
  • Comprehensive property definitions with helpful descriptions
components/beekeeper/beekeeper.app.mjs (5)

8-21: LGTM!

The chatId prop definition is well-implemented with proper async options loading.


22-35: LGTM!

The streamId prop definition follows the same pattern as chatId and is properly implemented.


36-54: Excellent implementation with pagination support!

The userId prop definition properly handles pagination, which is essential for potentially large user lists.


73-89: Well-structured helper methods!

The private helper methods follow best practices with clear separation of concerns.


108-121: Smart implementation for fetching member profiles!

The two-step approach of fetching members then resolving their profiles ensures complete user information is returned.

components/beekeeper/sources/new-chat-message-instant/new-chat-message-instant.mjs (1)

4-12: Component configuration looks good!

The webhook source is properly configured with all required fields and appropriate settings.

Also applies to: 21-22

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

♻️ Duplicate comments (1)
components/beekeeper/beekeeper.app.mjs (1)

63-74: Previous feedback has been addressed correctly.

The "all" option for mentions has been properly implemented as requested in the previous review, allowing users to mention all chat members.

🧹 Nitpick comments (5)
components/beekeeper/sources/new-comment-created-instant/test-event.mjs (1)

14-14: Fix typo in domain name.

There's a typo in the tenant domain - "beekeper" should be "beekeeper".

-  "tenant_fqdn": "happytenant.beekeper.io",
+  "tenant_fqdn": "happytenant.beekeeper.io",
components/beekeeper/beekeeper.app.mjs (4)

114-127: Consider performance implications of the nested API calls.

The listChatMembers method makes two sequential API calls - first to get member IDs, then to get full user profiles. This could be inefficient for chats with many members, as it requires two round trips and potentially fetches more user data than needed.

Consider if the member data from the first call provides sufficient information for the use case, or if there's a more efficient API endpoint that returns complete member details in a single call.


121-121: Remove unnecessary blank line.

There's an extra blank line that should be removed for consistency.

-
 return await this.listUserProfiles({

165-170: Maintain consistency in method signatures.

The deleteWebhook method doesn't follow the same pattern as other methods - it doesn't accept an opts parameter for additional options, which could limit flexibility for future enhancements.

-deleteWebhook(webhookId) {
+deleteWebhook({
+  webhookId, ...opts
+}) {
   return this._makeRequest({
     method: "DELETE",
     path: `/webhooks/${webhookId}`,
+    ...opts,
   });
 },

87-95: Consider potential parameter override risks.

The _makeRequest method spreads opts after setting url and headers, which means callers could potentially override these critical parameters. While this might be intentional for flexibility, it could lead to unexpected behavior.

Consider if this level of flexibility is needed, or if certain parameters should be protected from override.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 361f718 and 5f19705.

📒 Files selected for processing (5)
  • components/beekeeper/actions/create-post/create-post.mjs (1 hunks)
  • components/beekeeper/actions/send-message-group-chat/send-message-group-chat.mjs (1 hunks)
  • components/beekeeper/beekeeper.app.mjs (1 hunks)
  • components/beekeeper/sources/new-comment-created-instant/test-event.mjs (1 hunks)
  • components/beekeeper/sources/new-user-created-instant/test-event.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/beekeeper/actions/create-post/create-post.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/beekeeper/sources/new-user-created-instant/test-event.mjs
  • components/beekeeper/actions/send-message-group-chat/send-message-group-chat.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
🔇 Additional comments (3)
components/beekeeper/sources/new-comment-created-instant/test-event.mjs (2)

1-16: LGTM! Well-structured test event fixture.

The overall structure of the test event is well-organized and follows appropriate webhook event patterns with payload data and metadata fields.


13-13: Great fix! Event type now correctly reflects comment creation.

The event_type has been properly corrected from the previous "CHATS.MESSAGE.CREATED" to "POSTS.COMMENT.CREATED", which accurately represents the comment creation event.

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

1-172: Overall implementation looks solid.

The Beekeeper integration provides comprehensive API coverage with consistent patterns for authentication, request handling, and data transformation. The propDefinitions are well-structured with appropriate async options for dynamic data loading.

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

LGTM!

@luancazarine luancazarine merged commit d959f07 into master Jun 4, 2025
11 checks passed
@luancazarine luancazarine deleted the issue-13273 branch June 4, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Content generated by AI, with human refinement and modification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Components] beekeeper

3 participants