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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { getFileStreamAndMetadata } from "@pipedream/platform";
import hootsuite from "../../hootsuite.app.mjs";

export default {
key: "hootsuite-create-media-upload-job",
name: "Create Media Upload Job",
description: "Creates a new Media Upload Job on your Hootsuite account. [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/createMedia)",
version: "0.0.1",
type: "action",
props: {
hootsuite,
file: {
type: "string",
label: "File Path or URL",
description: "The path or URL to the image file.",
},
syncDir: {
type: "dir",
accessMode: "read",
sync: true,
},
},
methods: {
initializeUpload(opts = {}) {
return this.hootsuite._makeRequest({
method: "POST",
path: "/media",
...opts,
});
},
streamToBuffer(stream) {
return new Promise((resolve, reject) => {
const chunks = [];
stream.on("data", (chunk) => chunks.push(chunk));
stream.on("end", () => resolve(Buffer.concat(chunks)));
stream.on("error", reject);
});
},
uploadImage(url, fileBinary, headers) {
return this.hootsuite._makeRequest({
url,
method: "PUT",
maxBodyLength: Infinity,
data: Buffer.from(fileBinary, "binary"),
noHeaders: true,
headers,
});
},
},
async run({ $ }) {
const {
stream, metadata,
} = await getFileStreamAndMetadata(this.file);

const {
data: {
uploadUrl, id,
},
} = await this.initializeUpload({
data: {
sizeBytes: metadata.size,
mimeType: metadata.contentType,
},
});

const fileBinary = await this.streamToBuffer(stream);

await this.uploadImage(uploadUrl, fileBinary, {
"Content-Type": metadata.contentType,
});

$.export("$summary", `Successfully created media upload job with ID: ${id}`);
return {
fileId: id,
};
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import hootsuite from "../../hootsuite.app.mjs";

export default {
key: "hootsuite-get-media-upload-status",
name: "Get Media Upload Status",
description: "Gets the status of a Media Upload Job on your Hootsuite account. [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/getMedia)",
version: "0.0.1",
type: "action",
props: {
hootsuite,
fileId: {
type: "string",
label: "File ID",
description: "The ID of the file to get the status of.",
},
},
async run({ $ }) {
const response = await this.hootsuite.getMediaUploadStatus({
$,
fileId: this.fileId,
});

$.export("$summary", `Successfully got media upload status for file ID: ${this.fileId}`);
return response;
},
};
Loading
Loading