Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Dec 4, 2025

Resolves #19353

Summary by CodeRabbit

  • New Features

    • Add “New Private Channel Created” Slack source to emit events when a private channel is created.
    • Introduce a reusable Slack polling base to power polling-style sources and initial deployment processing.
  • Chores

    • Bump Slack v2 component version to 0.1.0.

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

@vercel
Copy link

vercel bot commented Dec 4, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Dec 4, 2025 9:41pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Dec 4, 2025 9:41pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

Adds a reusable base polling source and a new "New Private Channel Created" Slack v2 source that polls Slack's conversations.list API, filters private channels by creation timestamp, persists last-processed timestamp to DB, and emits events for new private channels.

Changes

Cohort / File(s) Summary
Version metadata
components/slack_v2/package.json
Updated package version from 0.0.1 to 0.1.0.
Base polling infrastructure
components/slack_v2/sources/common/base-polling.mjs
New polling base module: provides _getLastTs / _setLastTs, abstract getResources and generateMeta (throw ConfigurationError by default), processEvents(max) to fetch and emit events, deploy hook (initial run with max 10), and run() for regular execution.
New private channel source
components/slack_v2/sources/new-private-channel-created/new-private-channel-created.mjs
New source extending base polling: implements getResources(max) using Slack conversations.list with pagination and timestamp filtering, updates last-ts, and generateMeta(channel) producing event metadata (id, summary, ts).

Sequence Diagram

sequenceDiagram
    participant Runtime as Polling Runtime
    participant DB as Database
    participant Source as Private Channel Source
    participant SlackAPI as Slack API
    participant Emitter as Event Emitter

    Runtime->>Source: deploy() / run()
    Source->>DB: _getLastTs()
    DB-->>Source: lastTimestamp

    loop paginate pages
        Source->>SlackAPI: conversations.list(cursor)
        SlackAPI-->>Source: channels + next_cursor
        Source->>Source: filter channels where created > lastTimestamp
        alt has next_cursor
            Source->>Source: continue pagination
        else no more pages
            Source->>Source: end pagination
        end
    end

    Source->>DB: _setLastTs(maxTimestamp)
    DB-->>Source: ack

    loop emit events
        Source->>Source: generateMeta(channel)
        Source->>Emitter: $emit(event, metadata)
        Emitter-->>Emitter: downstream processing
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Review the new base polling file for correct error handling of unimplemented abstract methods and timestamp persistence logic (_getLastTs / _setLastTs).
  • Verify Slack API pagination and next_cursor handling in getResources.
  • Confirm timestamp filtering and max-result enforcement in getResources.
  • Check generateMeta output format and that the source correctly integrates with the base polling lifecycle (deploy/run and event emission).

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description references the linked issue (#19353) but lacks detail about the implementation and doesn't follow the template structure with a 'WHY' section explaining the rationale. Expand the description to include implementation details and populate the 'WHY' section from the template to explain the motivation and approach.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a new Slack trigger for detecting when private channels are created.
Linked Issues check ✅ Passed The PR successfully implements a new polling-based source for Slack private channel creation detection, meeting the core requirement from issue #19353 [#19353].
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the private channel creation trigger: version bump, base polling module, and the new source implementation.
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-19353

📜 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 8998327 and 68ddf75.

📒 Files selected for processing (1)
  • components/slack_v2/package.json (1 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/slack_v2/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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (1)
components/slack_v2/package.json (1)

3-3: Version bump to 0.1.0 is appropriate for the new features.

The version update aligns with the PR's addition of a reusable base polling source and the new "New Private Channel Created" Slack v2 source. All dependencies remain legitimate external packages with no built-in Node.js modules added, which is good practice.


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: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 193346e and 57c0f53.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • components/slack/package.json (2 hunks)
  • components/slack/sources/common/base-polling.mjs (1 hunks)
  • components/slack/sources/new-private-channel-created/new-private-channel-created.mjs (1 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/slack/package.json
🧬 Code graph analysis (2)
components/slack/sources/new-private-channel-created/new-private-channel-created.mjs (1)
components/zep/actions/get-threads/get-threads.mjs (1)
  • max (39-39)
components/slack/sources/common/base-polling.mjs (2)
components/slack/sources/new-private-channel-created/new-private-channel-created.mjs (1)
  • lastTs (19-19)
components/zep/actions/get-threads/get-threads.mjs (1)
  • max (39-39)
⏰ 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: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/slack/sources/new-private-channel-created/new-private-channel-created.mjs (1)

47-53: LGTM!

The generateMeta method correctly generates metadata with a unique ID, descriptive summary, and timestamp for event deduplication.

components/slack/sources/common/base-polling.mjs (1)

1-50: Overall design looks good.

The base polling class provides a clean abstraction with:

  • Lifecycle hooks for deployment and regular execution
  • Timestamp persistence via db
  • Clear extension points for subclasses
  • Appropriate use of Pipedream platform constants

The separation between deploy (limited to 10 events) and run (unlimited) is a good pattern for preventing overwhelming initial deployments.

components/slack/package.json (1)

17-17: Confirm the reason for downgrading @pipedream/platform from ^3.1.1 to ^3.1.0.

The constraint was explicitly updated to ^3.1.1 in a recent commit (138ef16) with the note "Update @pipedream/platform to latest version within major", but the current state shows it has been loosened back to ^3.1.0. While the lock file ensures 3.1.1 is still installed, clarify whether this downgrade is intentional or should be reverted to ^3.1.1.

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

♻️ Duplicate comments (4)
components/slack_v2/sources/common/base-polling.mjs (2)

18-29: Clarify abstract method signatures to match call sites.

processEvents(max) calls this.getResources(max) and this.generateMeta(result), but the default implementations declare no parameters. Updating these signatures to getResources(max) and generateMeta(result) would better document the expected contract while still throwing ConfigurationError by default.


30-40: Consider minimal error handling around processEvents for robustness.

If a subclass’s getResources or generateMeta throws unexpectedly, the whole polling cycle fails. Wrapping the body of processEvents in a small try/catch that logs and rethrows (so Pipedream can still handle the error) would make failures easier to diagnose without silently swallowing them.

components/slack_v2/sources/new-private-channel-created/new-private-channel-created.mjs (2)

13-37: Guard Slack API response shape to avoid runtime errors.

The destructuring

const {
  channels, response_metadata: { next_cursor: nextCursor },
} = await this.slack.conversationsList(params);

will throw if response_metadata is missing or null. It also assumes channels is always defined.

Consider a more defensive pattern:

-      const {
-        channels, response_metadata: { next_cursor: nextCursor },
-      } = await this.slack.conversationsList(params);
+      const {
+        channels = [],
+        response_metadata: { next_cursor: nextCursor } = {},
+      } = await this.slack.conversationsList(params);

and then keep the if (!channels.length) break; guard. This prevents hard failures if Slack omits response_metadata or channels.


29-37: Use inclusive timestamp comparison to avoid missing channels created at the boundary.

Using if (ts > lastTs) risks skipping channels whose created timestamp equals lastTs but were created after the previous poll (Slack timestamps are second‑resolution). These would never be emitted.

Switching to inclusive comparison and relying on unique dedupe by channel id avoids this:

-        const ts = channel.created;
-        if (ts > lastTs) {
+        const ts = channel.created;
+        if (ts >= lastTs) {
           privateChannels.push(channel);
           maxTs = Math.max(ts, maxTs);
         }

Given dedupe: "unique" and generateMeta using channel.id, re‑processing a boundary record is safe.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57c0f53 and 8465c24.

📒 Files selected for processing (4)
  • components/slack/package.json (1 hunks)
  • components/slack_v2/package.json (1 hunks)
  • components/slack_v2/sources/common/base-polling.mjs (1 hunks)
  • components/slack_v2/sources/new-private-channel-created/new-private-channel-created.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/slack_v2/sources/new-private-channel-created/new-private-channel-created.mjs
  • components/slack_v2/sources/common/base-polling.mjs
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.

Applied to files:

  • components/slack_v2/sources/new-private-channel-created/new-private-channel-created.mjs
📚 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/slack_v2/sources/common/base-polling.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/slack/package.json
🧬 Code graph analysis (2)
components/slack_v2/sources/new-private-channel-created/new-private-channel-created.mjs (1)
components/zep/actions/get-threads/get-threads.mjs (1)
  • max (39-39)
components/slack_v2/sources/common/base-polling.mjs (2)
components/slack_v2/sources/new-private-channel-created/new-private-channel-created.mjs (1)
  • lastTs (19-19)
components/zep/actions/get-threads/get-threads.mjs (1)
  • max (39-39)
⏰ 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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (3)
components/slack/package.json (1)

17-17: Confirm intended @pipedream/platform version (possible downgrade / mismatch).

This package now depends on @pipedream/platform "^3.1.0", while @pipedream/slack_v2 depends on "^3.1.1". Please confirm this downgrade / mismatch is intentional and that Slack components don’t rely on features or fixes only available in ^3.1.1. If not intentional, consider aligning both packages to the same version.

components/slack_v2/package.json (1)

3-3: Version bump aligns with new source and shared base.

The change to "version": "0.2.0" matches the addition of the polling base and new source; no issues from a code perspective.

components/slack_v2/sources/new-private-channel-created/new-private-channel-created.mjs (1)

47-52: Meta looks consistent with unique dedupe strategy.

generateMeta exposes id, summary, and ts based on the channel object, which works well with dedupe: "unique" and provides a clear event summary. No changes needed here.

@vunguyenhung
Copy link
Collaborator

@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 4a8ce16 into master Dec 5, 2025
10 checks passed
@GTFalcao GTFalcao deleted the issue-19353 branch December 5, 2025 20:04
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.

[TRIGGER] Slack - New Private Channel Created (Instant)

4 participants