Add Find User by ID action for slack_v2#19758
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
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:
|
WalkthroughAdds a new Slack v2 action that looks up a user by Slack user ID via users.info, optionally includes locale, exports a success/failure summary, and returns the Slack API response with user profile data. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Action as Slack v2 Action
participant SlackAPI
participant Runtime as Platform ($)
Client->>Action: invoke with `user` and `includeLocale`
Action->>SlackAPI: users.info({ user, include_locale })
SlackAPI-->>Action: response (ok + user profile) or error
alt error
Action->>Runtime: export("$summary", "Failed to find user ...")
Action-->>Client: throw Error
else success
Action->>Runtime: export("$summary", "Successfully found user <displayName>")
Action-->>Client: return response
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@components/slack_v2/actions/find-user-by-id/find-user-by-id.mjs`:
- Around line 37-44: The code only sets a success summary when response.ok is
true and returns response silently on failure; update the error path in
find-user-by-id.mjs to explicitly handle non-OK responses by exporting a clear
failure summary and including diagnostic info from the response (e.g.,
response.error, response.status, or response.body) so callers see why the lookup
failed (use $.export("$summary", `Failed to find user ${this.user}:
${response.error || response.status || 'unknown error'}`)); optionally also
throw or return a rejected error after exporting so upstream logic can handle
the failure.
components/slack_v2/actions/find-user-by-id/find-user-by-id.mjs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@components/slack_v2/actions/find-user-by-id/find-user-by-id.mjs`:
- Around line 43-46: Update the displayName selection so the success summary
uses the user's chosen display handle first: in the block assigning displayName
(the const displayName variable used in $.export("$summary", ...)), check
response.user.profile?.display_name first, then
response.user.profile?.real_name, then response.user.name, then this.user as the
final fallback; keep the $.export("$summary", `Successfully found user
${displayName}`) call unchanged.
- Around line 31-41: The response.ok check is dead because this.slack.usersInfo
already throws on non-ok responses; remove the if (!response.ok) branch and
instead wrap the this.slack.usersInfo call inside a try/catch in the run method:
call await this.slack.usersInfo({ user: this.user, include_locale:
this.includeLocale }) inside try, and in catch(err) call $.export("$summary",
`Failed to find user ${this.user}: ${err.message || err}`) then rethrow the
error; update references to response.ok and errorMessage accordingly so only the
try/catch handles failures.
components/slack_v2/actions/find-user-by-id/find-user-by-id.mjs
Outdated
Show resolved
Hide resolved
GTFalcao
left a comment
There was a problem hiding this comment.
Hey @aliaksei-v7 , thanks for your contribution!
I'm moving this forward to QA validation. We just need to increase the package.json version for this before it can be merged.
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
Hey @GTFalcao, understood. Thanks for the review! |
WHY
Resolves #19757
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.