Skip to content

Commit 9f7d802

Browse files
committed
kustomer init
1 parent 70b218c commit 9f7d802

File tree

11 files changed

+2071
-4
lines changed

11 files changed

+2071
-4
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import kustomer from "../../kustomer.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "kustomer-create-conversation",
6+
name: "Create Conversation",
7+
description: "Creates a new conversation in Kustomer. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
kustomer,
12+
13+
// Required prop
14+
customerId: {
15+
type: "string",
16+
label: "Customer ID",
17+
description: "Unique identifier for the customer",
18+
},
19+
20+
// Optional props
21+
externalId: {
22+
type: "string",
23+
label: "External ID",
24+
description: "External identifier",
25+
optional: true,
26+
},
27+
name: {
28+
type: "string",
29+
label: "Name",
30+
description: "Name of the conversation",
31+
optional: true,
32+
},
33+
status: {
34+
type: "string",
35+
label: "Status",
36+
description: "Status of the conversation",
37+
optional: true,
38+
},
39+
priority: {
40+
type: "integer",
41+
label: "Priority",
42+
description: "Priority level (1-5)",
43+
optional: true,
44+
min: 1,
45+
max: 5,
46+
},
47+
direction: {
48+
type: "string",
49+
label: "Direction",
50+
description: "Direction of the conversation",
51+
optional: true,
52+
},
53+
replyChannel: {
54+
type: "string",
55+
label: "Reply Channel",
56+
description: "Channel to reply to",
57+
optional: true,
58+
},
59+
tags: {
60+
propDefinition: [
61+
kustomer,
62+
"tags",
63+
],
64+
optional: true,
65+
},
66+
assignedUsers: {
67+
propDefinition: [
68+
kustomer,
69+
"assignedUsers",
70+
],
71+
optional: true,
72+
},
73+
assignedTeams: {
74+
propDefinition: [
75+
kustomer,
76+
"assignedTeams",
77+
],
78+
optional: true,
79+
},
80+
defaultLang: {
81+
type: "string",
82+
label: "Default Language",
83+
description: "Default language for the conversation",
84+
optional: true,
85+
},
86+
queue: {
87+
type: "string",
88+
label: "Queue",
89+
description: "Queue information",
90+
optional: true,
91+
},
92+
},
93+
async run({ $ }) {
94+
const response = await this.kustomer.createConversation({
95+
customerId: this.customerId,
96+
externalId: this.externalId,
97+
name: this.name,
98+
status: this.status,
99+
priority: this.priority,
100+
direction: this.direction,
101+
replyChannel: this.replyChannel,
102+
tags: this.tags,
103+
assignedUsers: this.assignedUsers,
104+
assignedTeams: this.assignedTeams,
105+
defaultLang: this.defaultLang,
106+
queue: this.queue,
107+
});
108+
109+
$.export("$summary", `Created conversation with ID ${response.id}`);
110+
return response;
111+
},
112+
};
Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
import { axios } from "@pipedream/platform";
2+
import kustomer from "../../kustomer.app.mjs";
3+
4+
export default {
5+
key: "kustomer-create-customer",
6+
name: "Create Customer",
7+
description: "Creates a new customer in Kustomer. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
kustomer: {
12+
type: "app",
13+
app: "kustomer",
14+
},
15+
name: {
16+
propDefinition: [
17+
"kustomer",
18+
"name",
19+
],
20+
},
21+
company: {
22+
propDefinition: [
23+
"kustomer",
24+
"company",
25+
],
26+
},
27+
externalId: {
28+
propDefinition: [
29+
"kustomer",
30+
"externalId",
31+
],
32+
},
33+
username: {
34+
propDefinition: [
35+
"kustomer",
36+
"username",
37+
],
38+
},
39+
signedUpAt: {
40+
propDefinition: [
41+
"kustomer",
42+
"signedUpAt",
43+
],
44+
},
45+
lastActivityAt: {
46+
propDefinition: [
47+
"kustomer",
48+
"lastActivityAt",
49+
],
50+
},
51+
lastCustomerActivityAt: {
52+
propDefinition: [
53+
"kustomer",
54+
"lastCustomerActivityAt",
55+
],
56+
},
57+
lastSeenAt: {
58+
propDefinition: [
59+
"kustomer",
60+
"lastSeenAt",
61+
],
62+
},
63+
avatarUrl: {
64+
propDefinition: [
65+
"kustomer",
66+
"avatarUrl",
67+
],
68+
},
69+
externalIds: {
70+
propDefinition: [
71+
"kustomer",
72+
"externalIds",
73+
],
74+
},
75+
sharedExternalIds: {
76+
propDefinition: [
77+
"kustomer",
78+
"sharedExternalIds",
79+
],
80+
},
81+
emails: {
82+
propDefinition: [
83+
"kustomer",
84+
"emails",
85+
],
86+
},
87+
sharedEmails: {
88+
propDefinition: [
89+
"kustomer",
90+
"sharedEmails",
91+
],
92+
},
93+
phones: {
94+
propDefinition: [
95+
"kustomer",
96+
"phones",
97+
],
98+
},
99+
sharedPhones: {
100+
propDefinition: [
101+
"kustomer",
102+
"sharedPhones",
103+
],
104+
},
105+
whatsApps: {
106+
propDefinition: [
107+
"kustomer",
108+
"whatsApps",
109+
],
110+
},
111+
facebookIds: {
112+
propDefinition: [
113+
"kustomer",
114+
"facebookIds",
115+
],
116+
},
117+
instagramIds: {
118+
propDefinition: [
119+
"kustomer",
120+
"instagramIds",
121+
],
122+
},
123+
socials: {
124+
propDefinition: [
125+
"kustomer",
126+
"socials",
127+
],
128+
},
129+
sharedSocials: {
130+
propDefinition: [
131+
"kustomer",
132+
"sharedSocials",
133+
],
134+
},
135+
urls: {
136+
propDefinition: [
137+
"kustomer",
138+
"urls",
139+
],
140+
},
141+
locations: {
142+
propDefinition: [
143+
"kustomer",
144+
"locations",
145+
],
146+
},
147+
locale: {
148+
propDefinition: [
149+
"kustomer",
150+
"locale",
151+
],
152+
},
153+
timeZone: {
154+
propDefinition: [
155+
"kustomer",
156+
"timeZone",
157+
],
158+
},
159+
tags: {
160+
propDefinition: [
161+
"kustomer",
162+
"tags",
163+
],
164+
},
165+
sentiment: {
166+
propDefinition: [
167+
"kustomer",
168+
"sentiment",
169+
],
170+
},
171+
birthdayAt: {
172+
propDefinition: [
173+
"kustomer",
174+
"birthdayAt",
175+
],
176+
},
177+
gender: {
178+
propDefinition: [
179+
"kustomer",
180+
"gender",
181+
],
182+
},
183+
createdAt: {
184+
propDefinition: [
185+
"kustomer",
186+
"createdAt",
187+
],
188+
},
189+
importedAt: {
190+
propDefinition: [
191+
"kustomer",
192+
"importedAt",
193+
],
194+
},
195+
rev: {
196+
propDefinition: [
197+
"kustomer",
198+
"rev",
199+
],
200+
},
201+
defaultLang: {
202+
propDefinition: [
203+
"kustomer",
204+
"defaultLang",
205+
],
206+
},
207+
},
208+
async run({ $ }) {
209+
const customerData = {
210+
name: this.name,
211+
company: this.company,
212+
externalId: this.externalId,
213+
username: this.username,
214+
signedUpAt: this.signedUpAt,
215+
lastActivityAt: this.lastActivityAt,
216+
lastCustomerActivityAt: this.lastCustomerActivityAt,
217+
lastSeenAt: this.lastSeenAt,
218+
avatarUrl: this.avatarUrl,
219+
externalIds: this.externalIds,
220+
sharedExternalIds: this.sharedExternalIds,
221+
emails: this.emails,
222+
sharedEmails: this.sharedEmails,
223+
phones: this.phones,
224+
sharedPhones: this.sharedPhones,
225+
whatsApps: this.whatsApps,
226+
facebookIds: this.facebookIds,
227+
instagramIds: this.instagramIds,
228+
socials: this.socials,
229+
sharedSocials: this.sharedSocials,
230+
urls: this.urls,
231+
locations: this.locations,
232+
locale: this.locale,
233+
timeZone: this.timeZone,
234+
tags: this.tags,
235+
sentiment: this.sentiment,
236+
birthdayAt: this.birthdayAt,
237+
gender: this.gender,
238+
createdAt: this.createdAt,
239+
importedAt: this.importedAt,
240+
rev: this.rev,
241+
defaultLang: this.defaultLang,
242+
};
243+
244+
const response = await this.kustomer.createCustomer(customerData);
245+
$.export("$summary", `Created customer with ID ${response.id}`);
246+
return response;
247+
},
248+
};

0 commit comments

Comments
 (0)