Skip to content

Commit 5dca035

Browse files
authored
New Components - rejoiner (#15004)
* rejoiner init * new components * pnpm-lock.yaml * update
1 parent 0d5d83c commit 5dca035

File tree

7 files changed

+493
-11
lines changed

7 files changed

+493
-11
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import rejoiner from "../../rejoiner.app.mjs";
2+
3+
export default {
4+
key: "rejoiner-add-customer-to-list",
5+
name: "Add Customer to List",
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",
8+
type: "action",
9+
props: {
10+
rejoiner,
11+
listId: {
12+
propDefinition: [
13+
rejoiner,
14+
"listId",
15+
],
16+
},
17+
email: {
18+
propDefinition: [
19+
rejoiner,
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",
81+
],
82+
},
83+
country: {
84+
propDefinition: [
85+
rejoiner,
86+
"country",
87+
],
88+
},
89+
},
90+
async run({ $ }) {
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}`);
110+
return response;
111+
},
112+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import rejoiner from "../../rejoiner.app.mjs";
2+
3+
export default {
4+
key: "rejoiner-start-journey",
5+
name: "Start Journey",
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",
8+
type: "action",
9+
props: {
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",
15+
},
16+
email: {
17+
propDefinition: [
18+
rejoiner,
19+
"email",
20+
],
21+
},
22+
metadata: {
23+
type: "object",
24+
label: "Metadata",
25+
description: "Metadata to be attached to the customer's journey session metadata",
26+
optional: true,
27+
},
28+
},
29+
async run({ $ }) {
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}`);
44+
return response;
45+
},
46+
};
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import rejoiner from "../../rejoiner.app.mjs";
2+
3+
export default {
4+
key: "rejoiner-update-customer-profile",
5+
name: "Update Customer Profile",
6+
description: "Updates a customer's profile information. [See the documentation](https://docs.rejoiner.com/reference/update-customer-profile)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
rejoiner,
11+
email: {
12+
propDefinition: [
13+
rejoiner,
14+
"email",
15+
],
16+
},
17+
firstName: {
18+
propDefinition: [
19+
rejoiner,
20+
"firstName",
21+
],
22+
},
23+
lastName: {
24+
propDefinition: [
25+
rejoiner,
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",
81+
],
82+
},
83+
},
84+
async run({ $ }) {
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}`);
105+
return response;
106+
},
107+
};

components/rejoiner/package.json

Lines changed: 5 additions & 2 deletions
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
}
15-
}
18+
}

0 commit comments

Comments
 (0)