@pipedream/prodpad 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE +41 -0
  2. package/README.md +33 -0
  3. package/actions/create-company/create-company.mjs +81 -0
  4. package/actions/create-contact/create-contact.mjs +115 -0
  5. package/actions/create-feedback/create-feedback.mjs +85 -0
  6. package/actions/create-idea/create-idea.mjs +151 -0
  7. package/actions/find-company/find-company.mjs +85 -0
  8. package/actions/find-contact/find-contact.mjs +90 -0
  9. package/actions/find-feedback/find-feedback.mjs +123 -0
  10. package/actions/find-idea/find-idea.mjs +66 -0
  11. package/actions/find-or-create-company/find-or-create-company.mjs +105 -0
  12. package/actions/find-or-create-contact/find-or-create-contact.mjs +114 -0
  13. package/actions/find-or-create-feedback/find-or-create-feedback.mjs +149 -0
  14. package/actions/update-company/update-company.mjs +101 -0
  15. package/actions/update-contact/update-contact.mjs +134 -0
  16. package/actions/update-feedback/update-feedback.mjs +87 -0
  17. package/actions/update-idea-stage/update-idea-stage.mjs +52 -0
  18. package/common/constants.mjs +11 -0
  19. package/common/utils.mjs +42 -0
  20. package/package.json +19 -0
  21. package/prodpad.app.mjs +427 -0
  22. package/sources/common/polling.mjs +65 -0
  23. package/sources/new-company-created/new-company-created.mjs +27 -0
  24. package/sources/new-contact-created/new-contact-created.mjs +27 -0
  25. package/sources/new-feedback-created/new-feedback-created.mjs +27 -0
  26. package/sources/new-idea-created/new-idea-created.mjs +27 -0
  27. package/sources/new-idea-feedback-created/new-idea-feedback-created.mjs +38 -0
  28. package/sources/new-persona-created/new-persona-created.mjs +24 -0
  29. package/sources/new-product-created/new-product-created.mjs +24 -0
  30. package/sources/new-tag-created/new-tag-created.mjs +24 -0
  31. package/sources/new-user-story-created/new-user-story-created.mjs +24 -0
  32. package/sources/pushed-idea/pushed-idea.mjs +24 -0
  33. package/sources/pushed-user-story/pushed-user-story.mjs +24 -0
@@ -0,0 +1,123 @@
1
+ import app from "../../prodpad.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "prodpad-find-feedback",
6
+ name: "Find Feedback",
7
+ description: "Finds a feedback. [See the docs](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/GetFeedbacks).",
8
+ type: "action",
9
+ version: "0.0.1",
10
+ props: {
11
+ app,
12
+ state: {
13
+ type: "string",
14
+ label: "State",
15
+ description: "The state of the feedback. Default is `active`.",
16
+ optional: true,
17
+ options: [
18
+ "active",
19
+ "unsorted",
20
+ "archived",
21
+ "all",
22
+ ],
23
+ },
24
+ company: {
25
+ description: "Set to filter the feedback results based on whether the feedback was entered for a contact linked to the company.",
26
+ optional: true,
27
+ propDefinition: [
28
+ app,
29
+ "companyId",
30
+ ],
31
+ },
32
+ country: {
33
+ label: "Company Country",
34
+ description: "Set to filter the feedback results based on whether the feedback was entered for a contact linked to the company. Use ISO Alpha-2 country codes.",
35
+ propDefinition: [
36
+ app,
37
+ "country",
38
+ ],
39
+ },
40
+ companySize: {
41
+ label: "Company Size",
42
+ description: "Set to filter the feedback results based on the size of the company for the associated company.",
43
+ propDefinition: [
44
+ app,
45
+ "companySize",
46
+ ],
47
+ },
48
+ companyValue: {
49
+ label: "Company Value",
50
+ description: "Set to filter the feedback results based on the value of the company for the company assocaited to the feedback.",
51
+ propDefinition: [
52
+ app,
53
+ "companyValue",
54
+ ],
55
+ },
56
+ persona: {
57
+ description: "Filter results by the persona associated to feedback. Can either be the persona UUID or persona ID.",
58
+ optional: true,
59
+ propDefinition: [
60
+ app,
61
+ "personaId",
62
+ ],
63
+ },
64
+ jobrole: {
65
+ description: "Filter results by the job role of the contact associated to the feedback. Use the JobRole UUID.",
66
+ optional: true,
67
+ propDefinition: [
68
+ app,
69
+ "jobroleId",
70
+ ],
71
+ },
72
+ tagIds: {
73
+ type: "string[]",
74
+ label: "Tag IDs",
75
+ description: "Tag IDs to link to the feedback.",
76
+ optional: true,
77
+ propDefinition: [
78
+ app,
79
+ "tagId",
80
+ ],
81
+ },
82
+ product: {
83
+ description: "Filter results by the product associated to feedback. Can either be the product UUID or product ID.",
84
+ optional: true,
85
+ propDefinition: [
86
+ app,
87
+ "productId",
88
+ ],
89
+ },
90
+ },
91
+ async run({ $: step }) {
92
+ const {
93
+ state,
94
+ company,
95
+ country,
96
+ companySize,
97
+ companyValue,
98
+ persona,
99
+ jobrole,
100
+ tagIds,
101
+ product,
102
+ } = this;
103
+
104
+ const feedbacks = await this.app.listFeedbacks({
105
+ step,
106
+ params: {
107
+ state,
108
+ company,
109
+ company_country: country,
110
+ company_size: companySize,
111
+ company_value: companyValue,
112
+ persona,
113
+ job_role: jobrole,
114
+ tags: utils.mapOrParse(tagIds).join(","),
115
+ product,
116
+ },
117
+ });
118
+
119
+ step.export("$summary", `Successfully found ${utils.summaryEnd(feedbacks.length, "feedback")}`);
120
+
121
+ return feedbacks;
122
+ },
123
+ };
@@ -0,0 +1,66 @@
1
+ import app from "../../prodpad.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "prodpad-find-idea",
6
+ name: "Find Idea",
7
+ description: "Finds an idea. [See the docs](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Ideas/GetIdeas).",
8
+ type: "action",
9
+ version: "0.0.1",
10
+ props: {
11
+ app,
12
+ externalId: {
13
+ propDefinition: [
14
+ app,
15
+ "externalId",
16
+ ],
17
+ },
18
+ externalUrl: {
19
+ propDefinition: [
20
+ app,
21
+ "externalUrl",
22
+ ],
23
+ },
24
+ tagIds: {
25
+ type: "string[]",
26
+ label: "Tags",
27
+ description: "One or more tag names to filter the ideas by.",
28
+ optional: true,
29
+ propDefinition: [
30
+ app,
31
+ "tagId",
32
+ ],
33
+ },
34
+ status: {
35
+ label: "Status",
36
+ description: "Name of a workflow status to filter the ideas by.",
37
+ optional: true,
38
+ propDefinition: [
39
+ app,
40
+ "statusId",
41
+ ],
42
+ },
43
+ },
44
+ async run({ $: step }) {
45
+ const {
46
+ externalId,
47
+ externalUrl,
48
+ tagIds,
49
+ status,
50
+ } = this;
51
+
52
+ const { ideas } = await this.app.listIdeas({
53
+ step,
54
+ params: {
55
+ external_id: externalId,
56
+ external_url: externalUrl,
57
+ status,
58
+ tags: utils.mapOrParse(tagIds).join(","),
59
+ },
60
+ });
61
+
62
+ step.export("$summary", `Successfully found ${utils.summaryEnd(ideas.length, "idea")}`);
63
+
64
+ return ideas;
65
+ },
66
+ };
@@ -0,0 +1,105 @@
1
+ import app from "../../prodpad.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "prodpad-find-or-create-company",
6
+ name: "Find or Create Company",
7
+ description: "Finds or creates a company. See the docs for [find company](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/GetCompanies) and [create company](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/PostCompanies).",
8
+ type: "action",
9
+ version: "0.0.1",
10
+ props: {
11
+ app,
12
+ name: {
13
+ description: "Filter the companies by the name or partial name of the companies.",
14
+ optional: true,
15
+ propDefinition: [
16
+ app,
17
+ "name",
18
+ ],
19
+ },
20
+ city: {
21
+ description: "Set to filter the companies based on city.",
22
+ propDefinition: [
23
+ app,
24
+ "city",
25
+ ],
26
+ },
27
+ country: {
28
+ description: "Set to filter the companies based on the country. Use ISO Alpha-2 country codes. Only one country can be filtered at a time.",
29
+ propDefinition: [
30
+ app,
31
+ "country",
32
+ ],
33
+ },
34
+ companySize: {
35
+ label: "Company Size",
36
+ description: "Set to filter the companies based on their size.",
37
+ propDefinition: [
38
+ app,
39
+ "companySize",
40
+ ],
41
+ },
42
+ companyValue: {
43
+ label: "Company Value",
44
+ description: "Set to filter the companies based on their value.",
45
+ propDefinition: [
46
+ app,
47
+ "companyValue",
48
+ ],
49
+ },
50
+ tagIds: {
51
+ type: "string[]",
52
+ label: "Tags",
53
+ description: "Filter companies by the tags associated to the feedback. Mulitple tags can be specified and acts as an OR. Use the tag ID or UUID.",
54
+ optional: true,
55
+ propDefinition: [
56
+ app,
57
+ "tagId",
58
+ ],
59
+ },
60
+ },
61
+ async run({ $: step }) {
62
+ const {
63
+ name,
64
+ city,
65
+ country,
66
+ companySize,
67
+ companyValue,
68
+ tagIds,
69
+ } = this;
70
+
71
+ const { companies } = await this.app.listCompanies({
72
+ step,
73
+ params: {
74
+ name,
75
+ city,
76
+ country,
77
+ company_size: companySize,
78
+ value: companyValue,
79
+ tags: utils.mapOrParse(tagIds).join(","),
80
+ },
81
+ });
82
+
83
+ if (companies.length) {
84
+ step.export("$summary", `Successfully found ${utils.summaryEnd(companies.length, "company", "companies")}`);
85
+ return companies;
86
+ }
87
+
88
+ const response = await this.app.createCompany({
89
+ step,
90
+ data: {
91
+ name,
92
+ city,
93
+ country,
94
+ size: companySize,
95
+ value: companyValue,
96
+ tags: utils.mapOrParse(tagIds, (id) => ({
97
+ id,
98
+ })),
99
+ },
100
+ });
101
+
102
+ step.export("$summary", `Successfully created company with ID ${response.id}.`);
103
+ return response;
104
+ },
105
+ };
@@ -0,0 +1,114 @@
1
+ import app from "../../prodpad.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "prodpad-find-or-create-contact",
6
+ name: "Find or Create Contact",
7
+ description: "Finds or creates a contact. See the docs for [find contact](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/PostContacts) and [create contact](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/PostContacts).",
8
+ type: "action",
9
+ version: "0.0.1",
10
+ props: {
11
+ app,
12
+ name: {
13
+ description: "Name of contact or partial name of contacts to filter the list by",
14
+ optional: true,
15
+ propDefinition: [
16
+ app,
17
+ "name",
18
+ ],
19
+ },
20
+ email: {
21
+ description: "Filter the contacts by an email.",
22
+ optional: true,
23
+ propDefinition: [
24
+ app,
25
+ "email",
26
+ ],
27
+ },
28
+ tagIds: {
29
+ type: "string[]",
30
+ label: "Tags",
31
+ description: "ID of one or more tags to filter the contacts by.",
32
+ optional: true,
33
+ propDefinition: [
34
+ app,
35
+ "tagId",
36
+ ],
37
+ },
38
+ persona: {
39
+ label: "Persona",
40
+ description: "ID of a persona to filter contacts by.",
41
+ optional: true,
42
+ propDefinition: [
43
+ app,
44
+ "personaId",
45
+ ],
46
+ },
47
+ company: {
48
+ label: "Company",
49
+ description: "UUID of a company to filter contacts by.",
50
+ optional: true,
51
+ propDefinition: [
52
+ app,
53
+ "companyId",
54
+ ],
55
+ },
56
+ jobrole: {
57
+ description: "UUID of a job role to filter contacts by.",
58
+ optional: true,
59
+ propDefinition: [
60
+ app,
61
+ "jobroleId",
62
+ ],
63
+ },
64
+ },
65
+ async run({ $: step }) {
66
+ const {
67
+ name,
68
+ email,
69
+ tagIds,
70
+ persona,
71
+ company,
72
+ jobrole,
73
+ } = this;
74
+
75
+ const { contacts } = await this.app.listContacts({
76
+ step,
77
+ params: {
78
+ name,
79
+ email,
80
+ tags: utils.mapOrParse(tagIds).join(","),
81
+ persona,
82
+ company,
83
+ job_role: jobrole,
84
+ },
85
+ });
86
+
87
+ if (contacts.length) {
88
+ step.export("$summary", `Successfully found ${utils.summaryEnd(contacts.length, "contact")}`);
89
+ return contacts;
90
+ }
91
+
92
+ const response = await this.app.createContact({
93
+ step,
94
+ data: {
95
+ name,
96
+ email,
97
+ tags: utils.mapOrParse(tagIds, (id) => ({
98
+ id,
99
+ })),
100
+ personas: persona && [
101
+ {
102
+ id: persona,
103
+ },
104
+ ],
105
+ company,
106
+ jobrole: jobrole,
107
+ },
108
+ });
109
+
110
+ step.export("$summary", `Successfully created contact with ID ${response.id}.`);
111
+
112
+ return response;
113
+ },
114
+ };
@@ -0,0 +1,149 @@
1
+ import app from "../../prodpad.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "prodpad-find-or-create-feedback",
6
+ name: "Find or Create Feedback",
7
+ description: "Finds or creates a feedback. See the docs for [find feedback](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/GetFeedbacks) and [create feedback](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/PostFeedbacks).",
8
+ type: "action",
9
+ version: "0.0.1",
10
+ props: {
11
+ app,
12
+ customer: {
13
+ label: "Customer",
14
+ optional: true,
15
+ description: "ID of the contact providing the feedback.",
16
+ propDefinition: [
17
+ app,
18
+ "contactId",
19
+ ],
20
+ },
21
+ company: {
22
+ label: "Company",
23
+ description: "Set to filter the feedback results based on whether the feedback was entered for a contact linked to the company.",
24
+ optional: true,
25
+ propDefinition: [
26
+ app,
27
+ "companyId",
28
+ ],
29
+ },
30
+ product: {
31
+ label: "Product",
32
+ description: "Product IDs to link to the feedback.",
33
+ optional: true,
34
+ propDefinition: [
35
+ app,
36
+ "productId",
37
+ ],
38
+ },
39
+ persona: {
40
+ label: "Persona",
41
+ optional: true,
42
+ propDefinition: [
43
+ app,
44
+ "personaId",
45
+ ],
46
+ },
47
+ tagIds: {
48
+ type: "string[]",
49
+ label: "Tag IDs",
50
+ description: "Tag IDs to link to the feedback.",
51
+ optional: true,
52
+ propDefinition: [
53
+ app,
54
+ "tagId",
55
+ ],
56
+ },
57
+ externalId: {
58
+ description: "Filter feedback to return the feedback associated with a specific External ID. An example of an external ID is the ID of a record in a CRM or ID of a ticket in a customer support application.",
59
+ propDefinition: [
60
+ app,
61
+ "externalId",
62
+ ],
63
+ },
64
+ externalUrl: {
65
+ description: "Filter feedback to return the feedback associated with a specific external url. An example of an external url is that of a record in a CRM or a ticket in a customer support application",
66
+ propDefinition: [
67
+ app,
68
+ "externalUrl",
69
+ ],
70
+ },
71
+ feedback: {
72
+ type: "string",
73
+ label: "Feedback",
74
+ description: "In case the feedback is not found, this will be used to create a new feedback. This field accepts HTML and is stored as UTF-8.",
75
+ optional: true,
76
+ },
77
+ name: {
78
+ description: "In case the feedback is not found, this will be used to create a new feedback.",
79
+ optional: true,
80
+ propDefinition: [
81
+ app,
82
+ "name",
83
+ ],
84
+ },
85
+ },
86
+ async run({ $: step }) {
87
+ const {
88
+ customer,
89
+ company,
90
+ product,
91
+ persona,
92
+ tagIds,
93
+ externalId,
94
+ externalUrl,
95
+ feedback,
96
+ name,
97
+ } = this;
98
+
99
+ const feedbacks = await this.app.listFeedbacks({
100
+ step,
101
+ params: {
102
+ customer,
103
+ company,
104
+ product,
105
+ persona,
106
+ tags: utils.mapOrParse(tagIds).join(","),
107
+ external_id: externalId,
108
+ external_url: externalUrl,
109
+ },
110
+ });
111
+
112
+ if (feedbacks.length) {
113
+ step.export("$summary", `Successfully found ${utils.summaryEnd(feedbacks.length, "feedback")}`);
114
+ return feedbacks;
115
+ }
116
+
117
+ const response = await this.app.createFeedback({
118
+ step,
119
+ data: {
120
+ name,
121
+ feedback,
122
+ contact_id: customer,
123
+ company_id: company,
124
+ products: product && [
125
+ {
126
+ id: product,
127
+ },
128
+ ],
129
+ personas: persona && [
130
+ {
131
+ id: persona,
132
+ },
133
+ ],
134
+ tags: utils.mapOrParse(tagIds, (id) => ({
135
+ id,
136
+ })),
137
+ external_links: (externalId || externalUrl) && [
138
+ {
139
+ external_id: externalId,
140
+ url: externalUrl,
141
+ },
142
+ ],
143
+ },
144
+ });
145
+
146
+ step.export("$summary", `Successfully created feedback with ID ${response.id}.`);
147
+ return response;
148
+ },
149
+ };
@@ -0,0 +1,101 @@
1
+ import app from "../../prodpad.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "prodpad-update-company",
6
+ name: "Update Company",
7
+ description: "Updates a company. [See the docs](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/PutCompany).",
8
+ type: "action",
9
+ version: "0.0.1",
10
+ props: {
11
+ app,
12
+ companyId: {
13
+ propDefinition: [
14
+ app,
15
+ "companyId",
16
+ ],
17
+ },
18
+ name: {
19
+ optional: true,
20
+ propDefinition: [
21
+ app,
22
+ "name",
23
+ ],
24
+ },
25
+ city: {
26
+ propDefinition: [
27
+ app,
28
+ "city",
29
+ ],
30
+ },
31
+ country: {
32
+ propDefinition: [
33
+ app,
34
+ "country",
35
+ ],
36
+ },
37
+ size: {
38
+ label: "Company Size",
39
+ propDefinition: [
40
+ app,
41
+ "companySize",
42
+ ],
43
+ },
44
+ value: {
45
+ label: "Company Value",
46
+ propDefinition: [
47
+ app,
48
+ "companyValue",
49
+ ],
50
+ },
51
+ tagIds: {
52
+ type: "string[]",
53
+ label: "Tags",
54
+ description: "The tags to associate with the company.",
55
+ optional: true,
56
+ propDefinition: [
57
+ app,
58
+ "tagId",
59
+ ],
60
+ },
61
+ },
62
+ methods: {
63
+ updateCompany({
64
+ companyId, ...args
65
+ } = {}) {
66
+ return this.app.update({
67
+ path: `/companies/${companyId}`,
68
+ ...args,
69
+ });
70
+ },
71
+ },
72
+ async run({ $: step }) {
73
+ const {
74
+ companyId,
75
+ name,
76
+ city,
77
+ country,
78
+ size,
79
+ value,
80
+ tagIds,
81
+ } = this;
82
+
83
+ const response = await this.updateCompany({
84
+ companyId,
85
+ data: {
86
+ name,
87
+ city,
88
+ country,
89
+ size,
90
+ value,
91
+ tags: utils.mapOrParse(tagIds, (id) => ({
92
+ id,
93
+ })),
94
+ },
95
+ });
96
+
97
+ step.export("$summary", `Successfully updated company with ID ${response.id}`);
98
+
99
+ return response;
100
+ },
101
+ };