@activepieces/piece-respond-io 0.1.5 → 0.1.7
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.
- package/package.json +7 -12
- package/src/index.js +118 -59
- package/src/index.d.ts +0 -4
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-comment-to-conversation.d.ts +0 -9
- package/src/lib/actions/add-comment-to-conversation.d.ts.map +0 -1
- package/src/lib/actions/add-comment-to-conversation.js +0 -45
- package/src/lib/actions/add-comment-to-conversation.js.map +0 -1
- package/src/lib/actions/add-tag-to-contact.d.ts +0 -9
- package/src/lib/actions/add-tag-to-contact.d.ts.map +0 -1
- package/src/lib/actions/add-tag-to-contact.js +0 -57
- package/src/lib/actions/add-tag-to-contact.js.map +0 -1
- package/src/lib/actions/assign-or-unassign-conversation.d.ts +0 -26
- package/src/lib/actions/assign-or-unassign-conversation.d.ts.map +0 -1
- package/src/lib/actions/assign-or-unassign-conversation.js +0 -46
- package/src/lib/actions/assign-or-unassign-conversation.js.map +0 -1
- package/src/lib/actions/create-contact.d.ts +0 -14
- package/src/lib/actions/create-contact.d.ts.map +0 -1
- package/src/lib/actions/create-contact.js +0 -129
- package/src/lib/actions/create-contact.js.map +0 -1
- package/src/lib/actions/create-or-update-contact.d.ts +0 -14
- package/src/lib/actions/create-or-update-contact.d.ts.map +0 -1
- package/src/lib/actions/create-or-update-contact.js +0 -131
- package/src/lib/actions/create-or-update-contact.js.map +0 -1
- package/src/lib/actions/delete-contact.d.ts +0 -8
- package/src/lib/actions/delete-contact.d.ts.map +0 -1
- package/src/lib/actions/delete-contact.js +0 -31
- package/src/lib/actions/delete-contact.js.map +0 -1
- package/src/lib/actions/find-contact.d.ts +0 -9
- package/src/lib/actions/find-contact.d.ts.map +0 -1
- package/src/lib/actions/find-contact.js +0 -68
- package/src/lib/actions/find-contact.js.map +0 -1
- package/src/lib/actions/open-conversation.d.ts +0 -8
- package/src/lib/actions/open-conversation.d.ts.map +0 -1
- package/src/lib/actions/open-conversation.js +0 -34
- package/src/lib/actions/open-conversation.js.map +0 -1
- package/src/lib/common/auth.d.ts +0 -5
- package/src/lib/common/auth.d.ts.map +0 -1
- package/src/lib/common/auth.js +0 -49
- package/src/lib/common/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -11
- package/src/lib/common/client.d.ts.map +0 -1
- package/src/lib/common/client.js +0 -56
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/common/props.d.ts +0 -7
- package/src/lib/common/props.d.ts.map +0 -1
- package/src/lib/common/props.js +0 -119
- package/src/lib/common/props.js.map +0 -1
- package/src/lib/triggers/contact-tag-updated.d.ts +0 -19
- package/src/lib/triggers/contact-tag-updated.d.ts.map +0 -1
- package/src/lib/triggers/contact-tag-updated.js +0 -50
- package/src/lib/triggers/contact-tag-updated.js.map +0 -1
- package/src/lib/triggers/contact-updated.d.ts +0 -19
- package/src/lib/triggers/contact-updated.d.ts.map +0 -1
- package/src/lib/triggers/contact-updated.js +0 -50
- package/src/lib/triggers/contact-updated.js.map +0 -1
- package/src/lib/triggers/conversation-closed.d.ts +0 -19
- package/src/lib/triggers/conversation-closed.d.ts.map +0 -1
- package/src/lib/triggers/conversation-closed.js +0 -50
- package/src/lib/triggers/conversation-closed.js.map +0 -1
- package/src/lib/triggers/conversation-opened.d.ts +0 -19
- package/src/lib/triggers/conversation-opened.d.ts.map +0 -1
- package/src/lib/triggers/conversation-opened.js +0 -87
- package/src/lib/triggers/conversation-opened.js.map +0 -1
- package/src/lib/triggers/new-contact.d.ts +0 -19
- package/src/lib/triggers/new-contact.d.ts.map +0 -1
- package/src/lib/triggers/new-contact.js +0 -50
- package/src/lib/triggers/new-contact.js.map +0 -1
- package/src/lib/triggers/new-incoming-message.d.ts +0 -19
- package/src/lib/triggers/new-incoming-message.d.ts.map +0 -1
- package/src/lib/triggers/new-incoming-message.js +0 -50
- package/src/lib/triggers/new-incoming-message.js.map +0 -1
- package/src/lib/triggers/new-outgoing-message.d.ts +0 -19
- package/src/lib/triggers/new-outgoing-message.d.ts.map +0 -1
- package/src/lib/triggers/new-outgoing-message.js +0 -50
- package/src/lib/triggers/new-outgoing-message.js.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addCommentToConversation = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const client_1 = require("../common/client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.addCommentToConversation = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.respondIoAuth,
|
|
12
|
-
name: 'add_comment_to_conversation',
|
|
13
|
-
displayName: 'Add Comment to Conversation',
|
|
14
|
-
description: 'Add an internal comment/note to a conversation in Respond.io.',
|
|
15
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: { description: 'Posts an internal comment (note visible to team members, not the contact) on a contact\'s conversation in Respond.io. Use to leave context for agents rather than to message the contact. Requires the contact identifier and comment text (max 1000 chars); supports @-mentioning users via {{@user.ID}}. Not idempotent — each call appends another comment.', idempotent: false },
|
|
17
|
-
props: {
|
|
18
|
-
identifier: props_1.contactIdentifierDropdown,
|
|
19
|
-
text: pieces_framework_1.Property.LongText({
|
|
20
|
-
displayName: 'Comment Text',
|
|
21
|
-
description: 'The internal comment to add (max 1000 characters). You can mention users with {{@user.ID}} format where ID is the user ID.',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
run(_a) {
|
|
26
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
27
|
-
const { identifier, text } = propsValue;
|
|
28
|
-
if (!text || text.trim().length === 0) {
|
|
29
|
-
throw new Error('Comment text is required and cannot be empty.');
|
|
30
|
-
}
|
|
31
|
-
if (text.length > 1000) {
|
|
32
|
-
throw new Error(`Comment text is too long (${text.length} characters). Maximum allowed is 1000 characters.`);
|
|
33
|
-
}
|
|
34
|
-
return yield (0, client_1.respondIoApiCall)({
|
|
35
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
36
|
-
url: `/contact/${identifier}/comment`,
|
|
37
|
-
auth: auth,
|
|
38
|
-
body: {
|
|
39
|
-
text: text.trim(),
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=add-comment-to-conversation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-comment-to-conversation.js","sourceRoot":"","sources":["../../../../src/lib/actions/add-comment-to-conversation.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,6CAAoD;AACpD,yCAA+C;AAC/C,2CAA4D;AAE/C,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,+DAA+D;IAC5E,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,gWAAgW,EAAE,UAAU,EAAE,KAAK,EAAE;IAChZ,KAAK,EAAE;QACL,UAAU,EAAE,iCAAyB;QACrC,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,4HAA4H;YAC9H,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,UAAU,EAAE,IAAI,EAAE;YAC5B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;YAExC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;YACnE,CAAC;YACD,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,MAAM,mDAAmD,CAAC,CAAC;YAC/G,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,YAAY,UAAU,UAAU;gBACrC,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;iBAClB;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const addTagToContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
}>, {
|
|
4
|
-
identifier: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>>;
|
|
7
|
-
tags: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=add-tag-to-contact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-tag-to-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/add-tag-to-contact.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;;;;;EAgD1B,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addTagToContact = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const client_1 = require("../common/client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.addTagToContact = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.respondIoAuth,
|
|
12
|
-
name: 'add_tag_to_contact',
|
|
13
|
-
displayName: 'Add Tag to Contact',
|
|
14
|
-
description: 'Add one or multiple tags to a contact in Respond.io.',
|
|
15
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: { description: 'Adds one or more tags to a Respond.io contact, identified by the contact identifier. Use to label or segment a contact. Accepts 1-10 tag names per call. Idempotent on the resulting tag set — re-adding a tag the contact already has leaves it unchanged.', idempotent: true },
|
|
17
|
-
props: {
|
|
18
|
-
identifier: props_1.contactIdentifierDropdown,
|
|
19
|
-
tags: pieces_framework_1.Property.Array({
|
|
20
|
-
displayName: 'Tags',
|
|
21
|
-
description: 'Tags to add to the contact (minimum 1, maximum 10 tags).',
|
|
22
|
-
required: true,
|
|
23
|
-
properties: {
|
|
24
|
-
tag: pieces_framework_1.Property.ShortText({
|
|
25
|
-
displayName: 'Tag Name',
|
|
26
|
-
description: 'Name of the tag to add.',
|
|
27
|
-
required: true,
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
}),
|
|
31
|
-
},
|
|
32
|
-
run(_a) {
|
|
33
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
34
|
-
const { identifier, tags } = propsValue;
|
|
35
|
-
if (!tags || !Array.isArray(tags) || tags.length === 0) {
|
|
36
|
-
throw new Error('At least one tag is required.');
|
|
37
|
-
}
|
|
38
|
-
if (tags.length > 10) {
|
|
39
|
-
throw new Error('Maximum of 10 tags allowed per request.');
|
|
40
|
-
}
|
|
41
|
-
const tagNames = tags
|
|
42
|
-
.map((tagObj) => tagObj.tag)
|
|
43
|
-
.filter((tag) => tag && tag.trim())
|
|
44
|
-
.map((tag) => tag.trim());
|
|
45
|
-
if (tagNames.length === 0) {
|
|
46
|
-
throw new Error('At least one valid tag name is required.');
|
|
47
|
-
}
|
|
48
|
-
return yield (0, client_1.respondIoApiCall)({
|
|
49
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
50
|
-
url: `/contact/${identifier}/tag`,
|
|
51
|
-
auth: auth,
|
|
52
|
-
body: tagNames,
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=add-tag-to-contact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-tag-to-contact.js","sourceRoot":"","sources":["../../../../src/lib/actions/add-tag-to-contact.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,6CAAoD;AACpD,yCAA+C;AAC/C,2CAA4D;AAE/C,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,sDAAsD;IACnE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6PAA6P,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5S,KAAK,EAAE;QACL,UAAU,EAAE,iCAAyB;QACrC,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;oBACtB,WAAW,EAAE,UAAU;oBACvB,WAAW,EAAE,yBAAyB;oBACtC,QAAQ,EAAE,IAAI;iBACf,CAAC;aACH;SACF,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,UAAU,EAAE,IAAI,EAAE;YAC5B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;YAExC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC7D,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI;iBAClB,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC;iBAChC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;iBAClC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAE5B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC9D,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,YAAY,UAAU,MAAM;gBACjC,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const assignOrUnassignConversation: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
}>, {
|
|
4
|
-
identifier: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>>;
|
|
7
|
-
assignee: {
|
|
8
|
-
description: string;
|
|
9
|
-
required: false;
|
|
10
|
-
displayName: string;
|
|
11
|
-
auth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
-
}>;
|
|
14
|
-
refreshers: string[];
|
|
15
|
-
refreshOnSearch?: boolean;
|
|
16
|
-
options: (propsValue: Record<string, unknown> & {
|
|
17
|
-
auth?: import("@activepieces/shared").CustomAuthConnectionValue<import("@activepieces/pieces-framework").StaticPropsValue<{
|
|
18
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
-
}>> | undefined;
|
|
20
|
-
}, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").DropdownState<string>>;
|
|
21
|
-
valueSchema: string;
|
|
22
|
-
type: import("@activepieces/pieces-framework").PropertyType.DROPDOWN;
|
|
23
|
-
defaultValue?: unknown;
|
|
24
|
-
};
|
|
25
|
-
}>;
|
|
26
|
-
//# sourceMappingURL=assign-or-unassign-conversation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assign-or-unassign-conversation.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/assign-or-unassign-conversation.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;EAwCvC,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assignOrUnassignConversation = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const client_1 = require("../common/client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.assignOrUnassignConversation = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.respondIoAuth,
|
|
12
|
-
name: 'assign_or_unassign_conversation',
|
|
13
|
-
displayName: 'Assign or Unassign Conversation',
|
|
14
|
-
description: 'Assign or unassign a conversation to/from a team member in Respond.io.',
|
|
15
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: { description: 'Sets (or clears) the assignee on a contact\'s conversation in Respond.io. Two modes: provide a user to assign, or leave the assignee empty to unassign. Use to route a conversation to a specific agent or remove ownership. Idempotent — re-applying the same assignee leaves the conversation in the same state.', idempotent: true },
|
|
17
|
-
props: {
|
|
18
|
-
identifier: props_1.contactIdentifierDropdown,
|
|
19
|
-
assignee: Object.assign(Object.assign({}, props_1.assigneeDropdown), { description: 'Select the user to assign the conversation to. Leave empty to unassign.', required: false }),
|
|
20
|
-
},
|
|
21
|
-
run(_a) {
|
|
22
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
23
|
-
const { identifier, assignee } = propsValue;
|
|
24
|
-
// Convert assignee to proper format
|
|
25
|
-
let assigneeValue = null;
|
|
26
|
-
if (assignee && assignee.trim() !== '' && assignee !== 'null') {
|
|
27
|
-
const userId = parseInt(assignee, 10);
|
|
28
|
-
if (!isNaN(userId)) {
|
|
29
|
-
assigneeValue = userId;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
assigneeValue = assignee;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return yield (0, client_1.respondIoApiCall)({
|
|
36
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
37
|
-
url: `/contact/${identifier}/conversation/assignee`,
|
|
38
|
-
auth: auth,
|
|
39
|
-
body: {
|
|
40
|
-
assignee: assigneeValue,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=assign-or-unassign-conversation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assign-or-unassign-conversation.js","sourceRoot":"","sources":["../../../../src/lib/actions/assign-or-unassign-conversation.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA8D;AAC9D,6CAAoD;AACpD,yCAA+C;AAC/C,2CAA8E;AAEjE,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,iCAAiC;IAC9C,WAAW,EAAE,wEAAwE;IACrF,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,oTAAoT,EAAE,UAAU,EAAE,IAAI,EAAE;IACnW,KAAK,EAAE;QACL,UAAU,EAAE,iCAAyB;QACrC,QAAQ,kCACH,wBAAgB,KACnB,WAAW,EACT,yEAAyE,EAC3E,QAAQ,EAAE,KAAK,GAChB;KACF;IACK,GAAG;qEAAC,EAAE,UAAU,EAAE,IAAI,EAAE;YAC5B,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;YAE5C,oCAAoC;YACpC,IAAI,aAAa,GAA2B,IAAI,CAAC;YAEjD,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBAC9D,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBACtC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;oBACnB,aAAa,GAAG,MAAM,CAAC;gBACzB,CAAC;qBAAM,CAAC;oBACN,aAAa,GAAG,QAAQ,CAAC;gBAC3B,CAAC;YACH,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,YAAY,UAAU,wBAAwB;gBACnD,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE;oBACJ,QAAQ,EAAE,aAAa;iBACxB;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const createContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
}>, {
|
|
4
|
-
identifier: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
firstName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
lastName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
language: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
profilePic: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
countryCode: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
customFields: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
13
|
-
}>;
|
|
14
|
-
//# sourceMappingURL=create-contact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-contact.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;EA+HxB,CAAC"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createContact = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const client_1 = require("../common/client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
exports.createContact = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.respondIoAuth,
|
|
11
|
-
name: 'create_contact',
|
|
12
|
-
displayName: 'Create Contact',
|
|
13
|
-
description: 'Create a new contact record in Respond.io.',
|
|
14
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: { description: 'Creates a new contact in Respond.io, keyed by a unique identifier in `email:...` or `phone:...` form. Use only when adding a brand-new contact; if the contact may already exist, prefer Create or Update Contact, which upserts. Requires the identifier and first name; optional email, phone, language, country, profile picture, and custom fields. Not idempotent — intended to create a fresh record.', idempotent: false },
|
|
16
|
-
props: {
|
|
17
|
-
identifier: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Identifier',
|
|
19
|
-
description: 'Must be a unique identifier for the new contact. Use format: `email:user@example.com` or `phone:+60123456789`.',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
firstName: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'First Name',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
lastName: pieces_framework_1.Property.ShortText({
|
|
27
|
-
displayName: 'Last Name',
|
|
28
|
-
required: false,
|
|
29
|
-
}),
|
|
30
|
-
email: pieces_framework_1.Property.ShortText({
|
|
31
|
-
displayName: 'Email',
|
|
32
|
-
description: 'The email address of the contact.',
|
|
33
|
-
required: false,
|
|
34
|
-
}),
|
|
35
|
-
phone: pieces_framework_1.Property.ShortText({
|
|
36
|
-
displayName: 'Phone',
|
|
37
|
-
description: 'The phone number of the contact (in E.164 format).',
|
|
38
|
-
required: false,
|
|
39
|
-
}),
|
|
40
|
-
language: pieces_framework_1.Property.ShortText({
|
|
41
|
-
displayName: 'Language',
|
|
42
|
-
description: 'Language code (e.g., "en", "es") following ISO 639-1.',
|
|
43
|
-
required: false,
|
|
44
|
-
}),
|
|
45
|
-
profilePic: pieces_framework_1.Property.ShortText({
|
|
46
|
-
displayName: 'Profile Picture URL',
|
|
47
|
-
description: "A direct URL to the contact's profile picture.",
|
|
48
|
-
required: false,
|
|
49
|
-
}),
|
|
50
|
-
countryCode: pieces_framework_1.Property.ShortText({
|
|
51
|
-
displayName: 'Country Code',
|
|
52
|
-
description: 'Country code (e.g., "US", "MY") following ISO 3166-1 alpha-2.',
|
|
53
|
-
required: false,
|
|
54
|
-
}),
|
|
55
|
-
customFields: pieces_framework_1.Property.Array({
|
|
56
|
-
displayName: 'Custom Fields',
|
|
57
|
-
description: 'Add custom fields for the contact.',
|
|
58
|
-
required: false,
|
|
59
|
-
properties: {
|
|
60
|
-
name: pieces_framework_1.Property.ShortText({
|
|
61
|
-
displayName: 'Field Name',
|
|
62
|
-
description: 'Name of the custom field (e.g., "Company Website", "Department").',
|
|
63
|
-
required: true,
|
|
64
|
-
}),
|
|
65
|
-
value: pieces_framework_1.Property.ShortText({
|
|
66
|
-
displayName: 'Field Value',
|
|
67
|
-
description: 'Value of the custom field. Format based on field type:\n- Text: "string" (use quotation marks)\n- Number: 123 (without quotation marks)\n- Email: "user@domain.com"\n- URL: "https://example.com"\n- Date: "yyyy-mm-dd"\n- Time: "HH:MM" (24H format)\n- Checkbox: "true" or "false"',
|
|
68
|
-
required: false,
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
},
|
|
73
|
-
run(_a) {
|
|
74
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
75
|
-
const { identifier, customFields } = propsValue, contactData = tslib_1.__rest(propsValue, ["identifier", "customFields"]);
|
|
76
|
-
if (contactData.email && contactData.email.trim()) {
|
|
77
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
78
|
-
if (!emailRegex.test(contactData.email)) {
|
|
79
|
-
throw new Error('Invalid email format. Please provide a valid email address.');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (contactData.phone && contactData.phone.trim()) {
|
|
83
|
-
const e164Regex = /^\+[1-9]\d{1,14}$/;
|
|
84
|
-
if (!e164Regex.test(contactData.phone)) {
|
|
85
|
-
throw new Error('Invalid phone format. Please provide phone number in E.164 format (e.g., +60123456789).');
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (contactData.profilePic && contactData.profilePic.trim()) {
|
|
89
|
-
const urlRegex = /^https?:\/\/[^\s$.?#].[^\s]*$/;
|
|
90
|
-
if (!urlRegex.test(contactData.profilePic)) {
|
|
91
|
-
throw new Error('Invalid profile picture URL format. Please provide a valid HTTP/HTTPS URL.');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (contactData.language && contactData.language.trim()) {
|
|
95
|
-
const iso639Regex = /^[a-z]{2}$/;
|
|
96
|
-
if (!iso639Regex.test(contactData.language)) {
|
|
97
|
-
throw new Error('Invalid language code. Please provide a valid ISO 639-1 two-letter language code (e.g., "en", "es").');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (contactData.countryCode && contactData.countryCode.trim()) {
|
|
101
|
-
const iso3166Regex = /^[A-Z]{2}$/;
|
|
102
|
-
if (!iso3166Regex.test(contactData.countryCode)) {
|
|
103
|
-
throw new Error('Invalid country code. Please provide a valid ISO 3166-1 alpha-2 two-letter country code (e.g., "US", "MY").');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const body = {};
|
|
107
|
-
for (const [key, value] of Object.entries(contactData)) {
|
|
108
|
-
if (value !== undefined && value !== null) {
|
|
109
|
-
body[key] = value;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (customFields && Array.isArray(customFields) && customFields.length > 0) {
|
|
113
|
-
body['custom_fields'] = customFields
|
|
114
|
-
.filter((field) => field.name && field.name.trim())
|
|
115
|
-
.map((field) => ({
|
|
116
|
-
name: field.name,
|
|
117
|
-
value: field.value || null,
|
|
118
|
-
}));
|
|
119
|
-
}
|
|
120
|
-
return yield (0, client_1.respondIoApiCall)({
|
|
121
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
122
|
-
url: `/contact/${identifier}`,
|
|
123
|
-
auth: auth,
|
|
124
|
-
body,
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
//# sourceMappingURL=create-contact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-contact.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-contact.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,6CAAoD;AACpD,yCAA+C;AAElC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6YAA6Y,EAAE,UAAU,EAAE,KAAK,EAAE;IAC7b,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,gHAAgH;YAClH,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAA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C;gBACjI,CAAC;YACH,CAAC;YAED,MAAM,IAAI,GAA4B,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBAC1C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,CAAC;YACH,CAAC;YAED,IAAI,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3E,IAAI,CAAC,eAAe,CAAC,GAAG,YAAY;qBACjC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;qBACvD,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;oBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;iBAC3B,CAAC,CAAC,CAAC;YACR,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,YAAY,UAAU,EAAE;gBAC7B,IAAI,EAAE,IAAI;gBACV,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const createOrUpdateContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
}>, {
|
|
4
|
-
identifier: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
firstName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
lastName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
language: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
profilePic: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
countryCode: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
customFields: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
13
|
-
}>;
|
|
14
|
-
//# sourceMappingURL=create-or-update-contact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-or-update-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-or-update-contact.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAiIhC,CAAC"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createOrUpdateContact = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const client_1 = require("../common/client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
exports.createOrUpdateContact = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.respondIoAuth,
|
|
11
|
-
name: 'create_or_update_contact',
|
|
12
|
-
displayName: 'Create or Update Contact',
|
|
13
|
-
description: 'Create a new contact or update an existing one by email, phone, or ID.',
|
|
14
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: { description: 'Upserts a Respond.io contact keyed by a unique identifier in `id:...`, `email:...`, or `phone:...` form: updates the matching contact if it exists, otherwise creates one. Prefer this over Create Contact when the contact may already exist. Requires the identifier and first name; optional email, phone, language, country, profile picture, and custom fields. Idempotent — repeating with the same input converges to the same record.', idempotent: true },
|
|
16
|
-
props: {
|
|
17
|
-
identifier: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Identifier',
|
|
19
|
-
description: 'Identifier for the contact. Use format: `id:123`, `email:user@example.com`, or `phone:+60123456789`. If contact exists, it will be updated; if not, a new one will be created.',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
firstName: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'First Name',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
lastName: pieces_framework_1.Property.ShortText({
|
|
27
|
-
displayName: 'Last Name',
|
|
28
|
-
required: false,
|
|
29
|
-
}),
|
|
30
|
-
email: pieces_framework_1.Property.ShortText({
|
|
31
|
-
displayName: 'Email',
|
|
32
|
-
description: 'The email address of the contact.',
|
|
33
|
-
required: false,
|
|
34
|
-
}),
|
|
35
|
-
phone: pieces_framework_1.Property.ShortText({
|
|
36
|
-
displayName: 'Phone',
|
|
37
|
-
description: 'The phone number of the contact (in E.164 format).',
|
|
38
|
-
required: false,
|
|
39
|
-
}),
|
|
40
|
-
language: pieces_framework_1.Property.ShortText({
|
|
41
|
-
displayName: 'Language',
|
|
42
|
-
description: 'Language code (e.g., "en", "es") following ISO 639-1.',
|
|
43
|
-
required: false,
|
|
44
|
-
}),
|
|
45
|
-
profilePic: pieces_framework_1.Property.ShortText({
|
|
46
|
-
displayName: 'Profile Picture URL',
|
|
47
|
-
description: "A direct URL to the contact's profile picture.",
|
|
48
|
-
required: false,
|
|
49
|
-
}),
|
|
50
|
-
countryCode: pieces_framework_1.Property.ShortText({
|
|
51
|
-
displayName: 'Country Code',
|
|
52
|
-
description: 'Country code (e.g., "US", "MY") following ISO 3166-1 alpha-2.',
|
|
53
|
-
required: false,
|
|
54
|
-
}),
|
|
55
|
-
customFields: pieces_framework_1.Property.Array({
|
|
56
|
-
displayName: 'Custom Fields',
|
|
57
|
-
description: 'Add custom fields for the contact.',
|
|
58
|
-
required: false,
|
|
59
|
-
properties: {
|
|
60
|
-
name: pieces_framework_1.Property.ShortText({
|
|
61
|
-
displayName: 'Field Name',
|
|
62
|
-
description: 'Name of the custom field (e.g., "Company Website", "Department").',
|
|
63
|
-
required: true,
|
|
64
|
-
}),
|
|
65
|
-
value: pieces_framework_1.Property.ShortText({
|
|
66
|
-
displayName: 'Field Value',
|
|
67
|
-
description: 'Value of the custom field. Format based on field type:\n- Text: "string" (use quotation marks)\n- Number: 123 (without quotation marks)\n- Email: "user@domain.com"\n- URL: "https://example.com"\n- Date: "yyyy-mm-dd"\n- Time: "HH:MM" (24H format)\n- Checkbox: "true" or "false"',
|
|
68
|
-
required: false,
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
},
|
|
73
|
-
run(_a) {
|
|
74
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
75
|
-
const { identifier, customFields } = propsValue, contactData = tslib_1.__rest(propsValue, ["identifier", "customFields"]);
|
|
76
|
-
// Field validation
|
|
77
|
-
if (contactData.email && contactData.email.trim()) {
|
|
78
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
79
|
-
if (!emailRegex.test(contactData.email)) {
|
|
80
|
-
throw new Error('Invalid email format. Please provide a valid email address.');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (contactData.phone && contactData.phone.trim()) {
|
|
84
|
-
const e164Regex = /^\+[1-9]\d{1,14}$/;
|
|
85
|
-
if (!e164Regex.test(contactData.phone)) {
|
|
86
|
-
throw new Error('Invalid phone format. Please provide phone number in E.164 format (e.g., +60123456789).');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (contactData.profilePic && contactData.profilePic.trim()) {
|
|
90
|
-
const urlRegex = /^https?:\/\/[^\s$.?#].[^\s]*$/;
|
|
91
|
-
if (!urlRegex.test(contactData.profilePic)) {
|
|
92
|
-
throw new Error('Invalid profile picture URL format. Please provide a valid HTTP/HTTPS URL.');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (contactData.language && contactData.language.trim()) {
|
|
96
|
-
const iso639Regex = /^[a-z]{2}$/;
|
|
97
|
-
if (!iso639Regex.test(contactData.language)) {
|
|
98
|
-
throw new Error('Invalid language code. Please provide a valid ISO 639-1 two-letter language code (e.g., "en", "es").');
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (contactData.countryCode && contactData.countryCode.trim()) {
|
|
102
|
-
const iso3166Regex = /^[A-Z]{2}$/;
|
|
103
|
-
if (!iso3166Regex.test(contactData.countryCode)) {
|
|
104
|
-
throw new Error('Invalid country code. Please provide a valid ISO 3166-1 alpha-2 two-letter country code (e.g., "US", "MY").');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const body = {};
|
|
108
|
-
for (const [key, value] of Object.entries(contactData)) {
|
|
109
|
-
if (value !== undefined && value !== null) {
|
|
110
|
-
body[key] = value;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Add custom fields array if provided
|
|
114
|
-
if (customFields && Array.isArray(customFields) && customFields.length > 0) {
|
|
115
|
-
body['custom_fields'] = customFields
|
|
116
|
-
.filter((field) => field.name && field.name.trim())
|
|
117
|
-
.map((field) => ({
|
|
118
|
-
name: field.name,
|
|
119
|
-
value: field.value || null,
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
return yield (0, client_1.respondIoApiCall)({
|
|
123
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
124
|
-
url: `/contact/create_or_update/${identifier}`,
|
|
125
|
-
auth: auth,
|
|
126
|
-
body,
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
//# sourceMappingURL=create-or-update-contact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-or-update-contact.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-or-update-contact.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,6CAAoD;AACpD,yCAA+C;AAElC,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,wEAAwE;IACrF,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,+aAA+a,EAAE,UAAU,EAAE,IAAI,EAAE;IAC9d,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,gLAAgL;YAClL,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,qBAAqB;YAClC,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H,CAAC;YAED,sCAAsC;YACtC,IAAI,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3E,IAAI,CAAC,eAAe,CAAC,GAAG,YAAY;qBACjC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;qBACvD,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;oBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;iBAC3B,CAAC,CAAC,CAAC;YACR,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,6BAA6B,UAAU,EAAE;gBAC9C,IAAI,EAAE,IAAI;gBACV,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const deleteContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
}>, {
|
|
4
|
-
identifier: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>>;
|
|
7
|
-
}>;
|
|
8
|
-
//# sourceMappingURL=delete-contact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-contact.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;EAmBxB,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteContact = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const client_1 = require("../common/client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.deleteContact = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.respondIoAuth,
|
|
12
|
-
name: 'delete_contact',
|
|
13
|
-
displayName: 'Delete Contact',
|
|
14
|
-
description: 'Permanently delete a contact from Respond.io.',
|
|
15
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: { description: 'Permanently deletes a contact from Respond.io, identified by the contact identifier. Destructive and irreversible — use only when the contact should be fully removed. Idempotent on end state: once deleted, repeating leaves the contact absent.', idempotent: true },
|
|
17
|
-
props: {
|
|
18
|
-
identifier: props_1.contactIdentifierDropdown,
|
|
19
|
-
},
|
|
20
|
-
run(_a) {
|
|
21
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
22
|
-
const { identifier } = propsValue;
|
|
23
|
-
return yield (0, client_1.respondIoApiCall)({
|
|
24
|
-
method: pieces_common_1.HttpMethod.DELETE,
|
|
25
|
-
url: `/contact/${identifier}`,
|
|
26
|
-
auth: auth,
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=delete-contact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-contact.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-contact.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA8D;AAC9D,6CAAoD;AACpD,yCAA+C;AAC/C,2CAA4D;AAE/C,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,+CAA+C;IAC5D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,oPAAoP,EAAE,UAAU,EAAE,IAAI,EAAE;IACnS,KAAK,EAAE;QACL,UAAU,EAAE,iCAAyB;KACtC;IACK,GAAG;qEAAC,EAAE,UAAU,EAAE,IAAI,EAAE;YAC5B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;YAElC,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,GAAG,EAAE,YAAY,UAAU,EAAE;gBAC7B,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const findContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
-
}>, {
|
|
4
|
-
search: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
timezone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
-
cursorId: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=find-contact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-contact.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;EAmEtB,CAAC"}
|