-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
Copy pathapprove-workflow.mjs
47 lines (46 loc) · 1.15 KB
/
approve-workflow.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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.4",
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;
},
};