Skip to content

17712 actions for hootsuite #17982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 13, 2025
Merged

17712 actions for hootsuite #17982

merged 4 commits into from
Aug 13, 2025

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Aug 7, 2025

Resolves #17712

Summary by CodeRabbit

  • New Features

    • Create media upload jobs, check media upload status, and schedule messages with advanced Facebook/LinkedIn targeting and media attachments for Hootsuite.
  • Improvements

    • Dynamic social profile selection and improved API request/header handling.
    • Added comprehensive targeting option lists and a utility for parsing input objects.
  • Bug Fixes

    • Removed extraneous logging from the "New Post Created" source.
  • Chores

    • Bumped package and dependency versions.

Actions
 - Create Media Upload Job
 - Get Media Upload Status
 - Schedule Message
@luancazarine luancazarine linked an issue Aug 7, 2025 that may be closed by this pull request
Copy link

vercel bot commented Aug 7, 2025

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

3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored Preview Aug 12, 2025 9:00pm
pipedream-docs ⬜️ Ignored Aug 12, 2025 9:00pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored Aug 12, 2025 9:00pm

Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Walkthrough

Added three Hootsuite actions (create media upload job, get media upload status, schedule message), supporting constants/utilities and new Hootsuite app API helpers/propDefinition; bumped package version and made a minor source cleanup.

Changes

Cohort / File(s) Change Summary
New Hootsuite Actions
components/hootsuite/actions/create-media-upload-job/create-media-upload-job.mjs, components/hootsuite/actions/get-media-upload-status/get-media-upload-status.mjs, components/hootsuite/actions/schedule-message/schedule-message.mjs
Added three action components: Create Media Upload Job (initiate upload, PUT binary), Get Media Upload Status (fetch media status by file ID), Schedule Message (assemble targeting/privacy/media payload and POST to schedule).
Constants & Utilities
components/hootsuite/common/constants.mjs, components/hootsuite/common/utils.mjs
Added large targeting/audience constant arrays and parseObject utility for parsing JSON strings/arrays.
Hootsuite App API & propDefinitions
components/hootsuite/hootsuite.app.mjs
Introduced _baseUrl() and _headers(), refactored _makeRequest (supports noHeaders), added listSocialProfiles, getMediaUploadStatus, scheduleMessage, and propDefinitions.socialProfileIds async options.
Package metadata
components/hootsuite/package.json
Bumped package version to 0.2.0 and updated @pipedream/platform dependency to ^3.1.0.
Source minor change
components/hootsuite/sources/new-post-created/new-post-created.mjs
Incremented source version to 0.0.2, moved an import, and removed a console.log; no functional logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action
    participant HootsuiteApp
    participant HootsuiteAPI

    User->>Action: Provide inputs (file/filePath or fileId, message, profiles, targeting)
    Action->>HootsuiteApp: initializeUpload / scheduleMessage / getMediaUploadStatus
    HootsuiteApp->>HootsuiteAPI: HTTP request to /media or /messages or /socialProfiles
    HootsuiteAPI-->>HootsuiteApp: Response (upload URL, mediaId, status, scheduledId)
    HootsuiteApp-->>Action: Return API result
    Action-->>User: Export summary and return data
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~35 minutes

Assessment against linked issues

Objective Addressed Explanation
Create Media Upload Job action (#17712)
Get Media Upload Status action (#17712)
Schedule Message action (#17712)
Suggest Content to Amplify action (#17712) Missing implementation and no related files in the changeset.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Minor import reorder, version bump, and log removal (components/hootsuite/sources/new-post-created/new-post-created.mjs) Source cleanup/version increment unrelated to implementing the requested actions.
Package version and dependency bump (components/hootsuite/package.json) Metadata/dependency update not required by the specified action implementations.

🐇 I hopped through code with nimble cheer,
Uploaded, checked, and scheduled here.
Constants stacked and helpers spun,
Three actions ready—jobs well done.
One more wish waits beneath the sun.


📜 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 ee44b67 and 195fe34.

📒 Files selected for processing (2)
  • components/hootsuite/actions/schedule-message/schedule-message.mjs (1 hunks)
  • components/hootsuite/common/constants.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/hootsuite/common/constants.mjs
  • components/hootsuite/actions/schedule-message/schedule-message.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: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 17712-actions-for-hootsuite

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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 (4)
components/hootsuite/common/utils.mjs (1)

1-24: Review the function logic and consider edge cases.

The parseObject function has some logical inconsistencies and potential edge cases:

  1. Overly broad falsy check: Line 2 returns undefined for any falsy value including empty string "", which might be a valid JSON string to parse.

  2. Function name mismatch: The function name suggests it parses objects, but it handles arrays, strings, and passes through other types unchanged.

  3. Inconsistent behavior: Arrays get their string elements parsed, but if you pass an object, it's returned unchanged without any parsing attempt.

Consider these improvements:

export const parseObject = (obj) => {
-  if (!obj) return undefined;
+  if (obj === null || obj === undefined) return undefined;

  if (Array.isArray(obj)) {
    return obj.map((item) => {
      if (typeof item === "string") {
        try {
          return JSON.parse(item);
        } catch (e) {
          return item;
        }
      }
      return item;
    });
  }
  if (typeof obj === "string") {
    try {
      return JSON.parse(obj);
    } catch (e) {
      return obj;
    }
  }
  return obj;
};

Alternative approach - be more explicit about the function's purpose:

-export const parseObject = (obj) => {
+export const parseJsonStrings = (input) => {
components/hootsuite/common/constants.mjs (1)

2692-2702: Consider consistent data structure across all option arrays.

The STAFF_COUNT_RANGE_OPTIONS uses a different structure (array of strings) compared to other option arrays which use {label, value} objects. This inconsistency might cause issues in consuming code.

For consistency, consider:

export const STAFF_COUNT_RANGE_OPTIONS = [
-  "SIZE_1",
-  "SIZE_2_TO_10",
-  "SIZE_11_TO_50",
-  "SIZE_51_TO_200",
-  "SIZE_201_TO_500",
-  "SIZE_501_TO_1000",
-  "SIZE_1001_TO_5000",
-  "SIZE_5001_TO_10000",
-  "SIZE_10001_OR_MORE",
+  { label: "1", value: "SIZE_1" },
+  { label: "2-10", value: "SIZE_2_TO_10" },
+  { label: "11-50", value: "SIZE_11_TO_50" },
+  { label: "51-200", value: "SIZE_51_TO_200" },
+  { label: "201-500", value: "SIZE_201_TO_500" },
+  { label: "501-1000", value: "SIZE_501_TO_1000" },
+  { label: "1001-5000", value: "SIZE_1001_TO_5000" },
+  { label: "5001-10000", value: "SIZE_5001_TO_10000" },
+  { label: "10001+", value: "SIZE_10001_OR_MORE" },
];
components/hootsuite/actions/schedule-message/schedule-message.mjs (1)

1-339: Missing "Suggest Content to Amplify" action.

The PR objectives from issue #17712 mention implementing four actions, but only three are present in this PR. The "Suggest Content to Amplify" action is missing.

Would you like me to help implement the missing "Suggest Content to Amplify" action or create a follow-up issue to track this?

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

31-41: LGTM! Consider documenting the noHeaders parameter.

The refactored _makeRequest method improves maintainability by using centralized URL and header methods. The noHeaders flag adds useful flexibility.

Consider adding JSDoc documentation for the noHeaders parameter:

+    /**
+     * Make an HTTP request to the Hootsuite API
+     * @param {Object} options - Request options
+     * @param {boolean} options.noHeaders - Skip adding auth headers (for endpoints that don't require auth)
+     */
     _makeRequest({
       $ = this, path, noHeaders = false, ...opts
     }) {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between eca7334 and 6e81037.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • components/hootsuite/actions/create-media-upload-job/create-media-upload-job.mjs (1 hunks)
  • components/hootsuite/actions/get-media-upload-status/get-media-upload-status.mjs (1 hunks)
  • components/hootsuite/actions/schedule-message/schedule-message.mjs (1 hunks)
  • components/hootsuite/common/constants.mjs (1 hunks)
  • components/hootsuite/common/utils.mjs (1 hunks)
  • components/hootsuite/hootsuite.app.mjs (1 hunks)
  • components/hootsuite/package.json (2 hunks)
  • components/hootsuite/sources/new-post-created/new-post-created.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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/hootsuite/package.json
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.

Applied to files:

  • components/hootsuite/actions/get-media-upload-status/get-media-upload-status.mjs
  • components/hootsuite/actions/schedule-message/schedule-message.mjs
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#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/hootsuite/sources/new-post-created/new-post-created.mjs
📚 Learning: 2025-07-01T17:01:46.327Z
Learnt from: js07
PR: PipedreamHQ/pipedream#17375
File: components/tinypng/actions/compress-image/compress-image.mjs:18-23
Timestamp: 2025-07-01T17:01:46.327Z
Learning: In TinyPNG compress-image action (components/tinypng/actions/compress-image/compress-image.mjs), the syncDir property uses accessMode: "read" because this action only reads input files and returns API responses without writing files to /tmp, unlike other TinyPNG actions that save processed files to disk.

Applied to files:

  • components/hootsuite/actions/create-media-upload-job/create-media-upload-job.mjs
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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/hootsuite/actions/create-media-upload-job/create-media-upload-job.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#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/hootsuite/hootsuite.app.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.

Applied to files:

  • components/hootsuite/hootsuite.app.mjs
🔇 Additional comments (12)
components/hootsuite/package.json (2)

3-3: LGTM - Appropriate version bump for new features.

The minor version increment from 0.1.0 to 0.2.0 correctly reflects the addition of new actions and utilities in this release.


16-16: Verify @pipedream/platform ^3.1.0 API compatibility

Please confirm that the following imports and usages still exist and behave as expected in v3.1.0. A major version bump can introduce breaking changes:

• components/hootsuite/hootsuite.app.mjs
– import { axios } from "@pipedream/platform"
• components/hootsuite/actions/create-media-upload-job/create-media-upload-job.mjs
– import { getFileStreamAndMetadata } from "@pipedream/platform"
• components/hootsuite/sources/new-post-created/new-post-created.mjs
– import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"
– usage at line 19: intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL

Run your full test suite (or smoke tests) against the upgraded dependency and update any renamed, moved, or removed APIs before merging.

components/hootsuite/sources/new-post-created/new-post-created.mjs (2)

1-1: LGTM - Good import organization improvement.

Moving the DEFAULT_POLLING_SOURCE_TIMER_INTERVAL import to the top of the file improves code organization and follows standard import practices.


8-8: LGTM - Appropriate patch version increment.

The version bump from 0.0.1 to 0.0.2 correctly reflects the maintenance changes made to this source component.

components/hootsuite/actions/get-media-upload-status/get-media-upload-status.mjs (1)

1-26: LGTM - Well-structured action component.

The action follows Pipedream conventions correctly:

  • Proper component structure with key, name, description, version, and type
  • Clear prop definition with appropriate type and description
  • Correct usage of the hootsuite app method
  • Well-formatted summary message following established patterns
  • Appropriate return value

The implementation is clean and should work as expected for retrieving media upload status.

components/hootsuite/hootsuite.app.mjs (7)

23-25: LGTM!

Good refactoring to centralize the base URL configuration. This makes it easy to maintain and change API versions if needed.


26-30: LGTM!

Good refactoring to centralize header configuration. The OAuth Bearer token usage is correct for the Pipedream auth system.


42-46: LGTM!

Clean implementation of the listSocialProfiles method that follows the established pattern and supports the dynamic property definition.


47-54: LGTM!

Proper implementation of the media upload status method with correct parameter handling and path interpolation.


55-61: LGTM!

Correct implementation of the scheduleMessage method with proper HTTP method and flexible options handling.


62-67: LGTM!

Good refactoring of the getPosts method to use the centralized base URL and remove unnecessary async keyword. The changes maintain backward compatibility while improving consistency.


6-21: Confirm Hootsuite socialProfiles Response Shape

The new socialProfileIds propDefinition correctly uses an async options() fn and maps over the API response—but please verify the exact shape of the /socialProfiles endpoint:

  • File: components/hootsuite/hootsuite.app.mjs
  • Block:
    async options() {
      const { data } = await this.listSocialProfiles();
      return data.map(({ id: value, socialNetworkUsername: label }) => ({ label, value }));
    }
  • Ensure that listSocialProfiles() returns an object with a data array of items, each having:
    id (string)
    socialNetworkUsername (string)

If the endpoint wraps the list under a different key or uses a different field name, update the destructuring/mapping accordingly.

michelle0927
michelle0927 previously approved these changes Aug 11, 2025
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!

…ponent; refactor LinkedIn targeting logic for improved clarity
@luancazarine luancazarine merged commit 041fec0 into master Aug 13, 2025
11 checks passed
@luancazarine luancazarine deleted the 17712-actions-for-hootsuite branch August 13, 2025 20:25
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.

actions for hootsuite
2 participants