Skip to content
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
36 changes: 36 additions & 0 deletions components/gmail/actions/approve-workflow/approve-workflow.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import gmail from "../../gmail.app.mjs";

export default {
key: "gmail-approve-workflow",
name: "Approve Workflow",
description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
version: "0.0.1",
type: "action",
props: {
gmail,
to: {
propDefinition: [
gmail,
"to",
],
},
subject: {
propDefinition: [
gmail,
"subject",
],
},
},
async run({ $ }) {
const {
resume_url, cancel_url,
} = $.flow.suspend();
const opts = await this.gmail.getOptionsToSendEmail($, {
body: `Click here to approve the workflow: ${resume_url}, \nand cancel here: ${cancel_url}`,
...this,
});
const response = await this.gmail.sendEmail(opts);
$.export("$summary", `Successfully sent email to ${this.to}`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/gmail/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/gmail",
"version": "0.1.14",
"version": "0.2.0",
"description": "Pipedream Gmail Components",
"main": "gmail.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";

export default {
key: "microsoft_outlook-approve-workflow",
name: "Approve Workflow",
description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
version: "0.0.1",
type: "action",
props: {
microsoftOutlook,
recipients: {
propDefinition: [
microsoftOutlook,
"recipients",
],
optional: false,
},
subject: {
propDefinition: [
microsoftOutlook,
"subject",
],
optional: false,
},
},
async run({ $ }) {
const {
resume_url, cancel_url,
} = $.flow.suspend();
const opts = {
content: `Click here to approve the workflow: ${resume_url}, \nand cancel here: ${cancel_url}`,
ccRecipients: [],
bccRecipients: [],
...this,
};
const response = await this.microsoftOutlook.sendEmail({
$,
data: {
message: {
...this.microsoftOutlook.prepareMessageBody(opts),
},
},
});
$.export("$summary", "Email has been sent.");
return response;
},
};
2 changes: 1 addition & 1 deletion components/microsoft_outlook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/microsoft_outlook",
"version": "1.2.0",
"version": "1.3.0",
"description": "Pipedream Microsoft Outlook Components",
"main": "microsoft_outlook.app.mjs",
"keywords": [
Expand Down
85 changes: 85 additions & 0 deletions components/slack/actions/approve-workflow/approve-workflow.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import slack from "../../slack.app.mjs";
import constants from "../../common/constants.mjs";

export default {
key: "slack-approve-workflow",
name: "Approve Workflow",
description: "Suspend the workflow until approved by a slack message. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
version: "0.0.1",
type: "action",
props: {
slack,
channelType: {
type: "string",
label: "Channel Type",
description: "The type of channel to send to. User/Direct Message (im), Group (mpim), Private Channel or Public Channel",
async options() {
return constants.CHANNEL_TYPE_OPTIONS;
},
},
conversation: {
propDefinition: [
slack,
"conversation",
(c) => ({
types: c.channelType === "Channels"
? [
constants.CHANNEL_TYPE.PUBLIC,
constants.CHANNEL_TYPE.PRIVATE,
]
: [
c.channelType,
],
}),
],
},
message: {
type: "string",
label: "Message",
description: "A text message to include with the Approve and Cancel Buttons",
},
},
async run({ $ }) {
const {
resume_url, cancel_url,
} = $.flow.suspend();

const response = await this.slack.sdk().chat.postMessage({
text: "Click here to approve or cancel workflow",
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: this.message,
},
},
{
type: "actions",
elements: [
{
type: "button",
text: {
type: "plain_text",
text: "Approve",
},
url: resume_url,
},
{
type: "button",
text: {
type: "plain_text",
text: "Cancel",
},
url: cancel_url,
},
],
},
],
channel: this.conversation,
});

$.export("$summary", "Successfully sent message");
return response;
},
};
2 changes: 1 addition & 1 deletion components/slack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/slack",
"version": "0.8.1",
"version": "0.9.0",
"description": "Pipedream Slack Components",
"main": "slack.app.mjs",
"keywords": [
Expand Down
Loading