Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
101 changes: 101 additions & 0 deletions components/beekeeper/actions/create-post/create-post.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import beekeeper from "../../beekeeper.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "beekeeper-create-post",
name: "Create Post",
description: "Create a new text or multimedia post in a defined stream. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/18408b41927b9-creates-a-new-post)",
version: "0.0.1",
type: "action",
props: {
beekeeper,
streamId: {
propDefinition: [
beekeeper,
"streamId",
],
},
text: {
type: "string",
label: "Text",
description: "The text content of the post",
},
files: {
type: "string[]",
label: "Files",
description: "List of file objects to be attached. E.g. [{\"name\": \"fair_play_rules.pdf\", \"url\": \"https://mytenant.beekeeper.io/file/665987/original/fair_play_rules.pdf\", \"userid\": \"5cb9v45d-8i78-4v65-b5fd-81cgfac3ef17\", \"height\": 619, \"width\": 700, \"key\": \"f4fdaab0-d198-49b4-b1cc-dd85572d72f1\", \"media_type\": \"image/png\", \"usage_type\": \"attachment_image\" }]. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/18408b41927b9-creates-a-new-post) for further details.",
optional: true,
},
locked: {
type: "boolean",
label: "Locked",
description: "Disables adding comments on the post",
optional: true,
},
title: {
type: "string",
label: "Title",
description: "The title of the post",
optional: true,
},
media: {
type: "string[]",
label: "Media",
description: "List of Photo or Video objects. E.g. [{\"name\": \"fair_play_rules.pdf\", \"url\": \"https://mytenant.beekeeper.io/file/665987/original/fair_play_rules.pdf\", \"userid\": \"5cb9v45d-8i78-4v65-b5fd-81cgfac3ef17\", \"height\": 619, \"width\": 700, \"key\": \"f4fdaab0-d198-49b4-b1cc-dd85572d72f1\", \"media_type\": \"image/png\", \"usage_type\": \"attachment_image\" }]. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/18408b41927b9-creates-a-new-post) for further details.",
optional: true,
},
labels: {
type: "string[]",
label: "Labels",
description: "List of labels attached to the post",
optional: true,
},
sticky: {
type: "boolean",
label: "Sticky",
description: "Flag that pins a post to the top of the stream",
optional: true,
},
reactionsDisabled: {
type: "boolean",
label: "Reactions Disabled",
description: "Flag that disables the ability to add reaction to the post and to see reactions that have been added",
optional: true,
},
options: {
type: "string[]",
label: "Options",
description: "List of poll options in a post. E.g. [\"This Friday\", \"Monday next week\"]",
optional: true,
},
scheduledAt: {
type: "string",
label: "Scheduled At",
description: "Date and time when the post is scheduled to be published (UTC timezone, yyyy-mm-ddTHH:MM:SS format)",
optional: true,
},
},
async run({ $ }) {
const response = await this.beekeeper.createPost({
$,
data: {
streamid: this.streamId,
files: parseObject(this.files),
locked: this.locked,
title: this.title,
media: parseObject(this.media),
labels: parseObject(this.labels),
sticky: this.sticky,
reactions_disabled: this.reactionsDisabled,
text: this.text,
options: parseObject(this.options)?.map((item) => ({
text: item,
})),
scheduled_at: this.scheduledAt,
},
});

$.export("$summary", `Successfully created post with UUID: ${response.uuid}`);
return response;
},
};
43 changes: 43 additions & 0 deletions components/beekeeper/actions/get-profile/get-profile.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import beekeeper from "../../beekeeper.app.mjs";

export default {
key: "beekeeper-get-profile",
name: "Get User Profile",
description: "Retrieve the profile details of a specific user. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/05bcd13b38a67-get-profile-of-the-given-user)",
version: "0.0.1",
type: "action",
props: {
beekeeper,
userId: {
propDefinition: [
beekeeper,
"userId",
],
},
includeActivities: {
type: "boolean",
label: "Include Activities",
description: "Whether to include the user's activities.",
default: true,
},
includeTotals: {
type: "boolean",
label: "Include Totals",
description: "Whether to include the user's total number of posts, comments, and likes received.",
default: true,
},
},
async run({ $ }) {
const response = await this.beekeeper.getUserProfile({
$,
userId: this.userId,
params: {
include_activities: this.includeActivities,
include_totals: this.includeTotals,
},
});

$.export("$summary", `Successfully retrieved profile for user ID ${this.userId}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { ConfigurationError } from "@pipedream/platform";
import beekeeper from "../../beekeeper.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "beekeeper-send-message-group-chat",
name: "Send Message to Group Chat",
description: "Send a precomposed message to a defined group chat. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/9075b32d36db4-send-a-message-to-a-group-chat)",
version: "0.0.1",
type: "action",
props: {
beekeeper,
chatId: {
propDefinition: [
beekeeper,
"chatId",
],
},
body: {
type: "string",
label: "Body",
description: "The message body. Supports rich text formatting.",
optional: true,
},
attachment: {
type: "object",
label: "Attachment",
description: "JSON object representing attachment. A valid attachment object can be created and fetched using the POST /files/{usage_type}/upload endpoint.",
optional: true,
},
eventType: {
type: "string",
label: "Event Type",
description: "Type of event that the message corresponds to.",
optional: true,
},
chatStateAddons: {
type: "string[]",
label: "Chat State Addons",
description: "Array of objects containing type and data fields for chat state addons.",
optional: true,
},
messageAddons: {
type: "string[]",
label: "Message Addons",
description: "Array of objects containing type and data fields for message addons.",
optional: true,
},
mentions: {
propDefinition: [
beekeeper,
"mentions",
({ chatId }) => ({
chatId,
}),
],
optional: true,
},
},
async run({ $ }) {
if (!this.body && !this.eventType && !this.attachment && !this.chatStateAddons) {
throw new ConfigurationError("You must provide at least **Body**, **Event**, **Attachment** or **Chat State Addons**");
}
const response = await this.beekeeper.sendMessage({
$,
chatId: this.chatId,
data: {
body: this.body,
attachment: parseObject(this.attachment),
...(this.eventType
? {
event: {
type: this.eventType,
},
}
: {}),
chat_state_addons: parseObject(this.chatStateAddons),
message_addons: parseObject(this.messageAddons),
mentions: parseObject(this.mentions),
},
});

$.export("$summary", `Message sent successfully to chat ID: ${this.chatId}`);
return response;
},
};
Loading
Loading