Skip to content

Commit 6ba66f3

Browse files
committed
new components
1 parent cbbae66 commit 6ba66f3

File tree

7 files changed

+368
-246
lines changed

7 files changed

+368
-246
lines changed
Lines changed: 87 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,112 @@
11
import rejoiner from "../../rejoiner.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "rejoiner-add-customer-to-list",
65
name: "Add Customer to List",
7-
description: "Adds a customer to a specific list. [See the documentation](https://docs.rejoiner.com/docs/getting-started)",
8-
version: "0.0.{{ts}}",
6+
description: "Adds a customer to a specific list, or if the customer already exists, will update the record of that customer with the supplied data. [See the documentation](https://docs.rejoiner.com/reference/add-customer-to-list)",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
rejoiner,
12-
customerId: {
11+
listId: {
1312
propDefinition: [
1413
rejoiner,
15-
"customerId",
14+
"listId",
1615
],
1716
},
18-
listId: {
17+
email: {
1918
propDefinition: [
2019
rejoiner,
21-
"listId",
20+
"email",
21+
],
22+
},
23+
firstName: {
24+
propDefinition: [
25+
rejoiner,
26+
"firstName",
27+
],
28+
},
29+
lastName: {
30+
propDefinition: [
31+
rejoiner,
32+
"lastName",
33+
],
34+
},
35+
phone: {
36+
propDefinition: [
37+
rejoiner,
38+
"phone",
39+
],
40+
},
41+
timezone: {
42+
propDefinition: [
43+
rejoiner,
44+
"timezone",
45+
],
46+
},
47+
language: {
48+
propDefinition: [
49+
rejoiner,
50+
"language",
51+
],
52+
},
53+
address1: {
54+
propDefinition: [
55+
rejoiner,
56+
"address1",
57+
],
58+
},
59+
address2: {
60+
propDefinition: [
61+
rejoiner,
62+
"address2",
63+
],
64+
},
65+
city: {
66+
propDefinition: [
67+
rejoiner,
68+
"city",
69+
],
70+
},
71+
state: {
72+
propDefinition: [
73+
rejoiner,
74+
"state",
75+
],
76+
},
77+
postalCode: {
78+
propDefinition: [
79+
rejoiner,
80+
"postalCode",
2281
],
2382
},
24-
listSource: {
83+
country: {
2584
propDefinition: [
2685
rejoiner,
27-
"listSource",
86+
"country",
2887
],
29-
optional: true,
3088
},
3189
},
3290
async run({ $ }) {
33-
const response = await this.rejoiner.addCustomerToList();
34-
$.export("$summary", `Added customer ${this.customerId} to list ${this.listId}`);
91+
const response = await this.rejoiner.addCustomerToList({
92+
$,
93+
listId: this.listId,
94+
data: {
95+
email: this.email,
96+
first_name: this.firstName,
97+
last_name: this.lastName,
98+
phone: this.phone,
99+
timezone: this.timezone,
100+
language: this.language,
101+
address1: this.address1,
102+
address2: this.address2,
103+
city: this.city,
104+
state: this.state,
105+
postal_code: this.postalCode,
106+
country: this.country,
107+
},
108+
});
109+
$.export("$summary", `Added customer ${this.email} to list ${this.listId}`);
35110
return response;
36111
},
37112
};
Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,46 @@
11
import rejoiner from "../../rejoiner.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "rejoiner-start-journey",
65
name: "Start Journey",
7-
description: "Triggers the beginning of a customer journey in Rejoiner. [See the documentation]()",
8-
version: "0.0.{{ts}}",
6+
description: "Triggers the beginning of a customer journey in Rejoiner. [See the documentation](https://docs.rejoiner.com/reference/trigger-webhook-journey)",
7+
version: "0.0.1",
98
type: "action",
109
props: {
11-
rejoiner: {
12-
type: "app",
13-
app: "rejoiner",
10+
rejoiner,
11+
webhookUrl: {
12+
type: "string",
13+
label: "Webhook Endpoint URL",
14+
description: "Webhook URL of the journey. A webhook-triggered journey will provide an explicit Webhook Endpoint URL to be used for triggering the journey",
1415
},
15-
journeyId: {
16+
email: {
1617
propDefinition: [
1718
rejoiner,
18-
"journeyId",
19-
],
20-
},
21-
customerId: {
22-
propDefinition: [
23-
rejoiner,
24-
"customerId",
19+
"email",
2520
],
2621
},
2722
metadata: {
28-
propDefinition: [
29-
rejoiner,
30-
"metadata",
31-
],
23+
type: "object",
24+
label: "Metadata",
25+
description: "Metadata to be attached to the customer's journey session metadata",
3226
optional: true,
3327
},
3428
},
3529
async run({ $ }) {
36-
this.rejoiner.journeyId = this.journeyId;
37-
this.rejoiner.customerId = this.customerId;
38-
if (this.metadata) {
39-
this.rejoiner.metadata = this.metadata;
40-
}
41-
42-
const response = await this.rejoiner.triggerCustomerJourney();
43-
44-
$.export(
45-
"$summary",
46-
`Triggered journey ${this.journeyId} for customer ${this.customerId}`,
47-
);
30+
const response = await this.rejoiner._makeRequest({
31+
$,
32+
method: "POST",
33+
url: this.webhookUrl,
34+
data: {
35+
email: this.email,
36+
session_data: this.metadata
37+
? typeof this.metadata === "string"
38+
? JSON.parse(this.metadata)
39+
: this.metadata
40+
: undefined,
41+
},
42+
});
43+
$.export("$summary", `Triggered journey for customer ${this.email}`);
4844
return response;
4945
},
5046
};
Lines changed: 82 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,107 @@
11
import rejoiner from "../../rejoiner.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "rejoiner-update-customer-profile",
65
name: "Update Customer Profile",
7-
description: "Updates a customer's profile information. [See the documentation](https://docs.rejoiner.com/docs/getting-started)",
8-
version: "0.0.{{ts}}",
6+
description: "Updates a customer's profile information. [See the documentation](https://docs.rejoiner.com/reference/update-customer-profile)",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
rejoiner,
12-
customerId: {
11+
email: {
1312
propDefinition: [
1413
rejoiner,
15-
"customerId",
14+
"email",
1615
],
1716
},
18-
profileData: {
17+
firstName: {
1918
propDefinition: [
2019
rejoiner,
21-
"profileData",
20+
"firstName",
2221
],
2322
},
24-
updateSource: {
23+
lastName: {
2524
propDefinition: [
2625
rejoiner,
27-
"updateSource",
26+
"lastName",
27+
],
28+
},
29+
phone: {
30+
propDefinition: [
31+
rejoiner,
32+
"phone",
33+
],
34+
},
35+
timezone: {
36+
propDefinition: [
37+
rejoiner,
38+
"timezone",
39+
],
40+
},
41+
language: {
42+
propDefinition: [
43+
rejoiner,
44+
"language",
45+
],
46+
},
47+
address1: {
48+
propDefinition: [
49+
rejoiner,
50+
"address1",
51+
],
52+
},
53+
address2: {
54+
propDefinition: [
55+
rejoiner,
56+
"address2",
57+
],
58+
},
59+
city: {
60+
propDefinition: [
61+
rejoiner,
62+
"city",
63+
],
64+
},
65+
state: {
66+
propDefinition: [
67+
rejoiner,
68+
"state",
69+
],
70+
},
71+
postalCode: {
72+
propDefinition: [
73+
rejoiner,
74+
"postalCode",
75+
],
76+
},
77+
country: {
78+
propDefinition: [
79+
rejoiner,
80+
"country",
2881
],
29-
optional: true,
3082
},
3183
},
3284
async run({ $ }) {
33-
const response = await this.rejoiner.updateCustomerProfile();
34-
$.export("$summary", `Updated customer profile for customer_id ${this.customerId}`);
85+
const response = await this.rejoiner.updateCustomerProfile({
86+
$,
87+
params: {
88+
email: this.email,
89+
},
90+
data: {
91+
first_name: this.firstName,
92+
last_name: this.lastName,
93+
phone: this.phone,
94+
timezone: this.timezone,
95+
language: this.language,
96+
address1: this.address1,
97+
address2: this.address2,
98+
city: this.city,
99+
state: this.state,
100+
postal_code: this.postalCode,
101+
country: this.country,
102+
},
103+
});
104+
$.export("$summary", `Updated customer profile for customer ${this.email}`);
35105
return response;
36106
},
37107
};

components/rejoiner/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/rejoiner",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Rejoiner Components",
55
"main": "rejoiner.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
1518
}

0 commit comments

Comments
 (0)