@activepieces/piece-respond-io 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 (59) hide show
  1. package/README.md +7 -0
  2. package/package.json +38 -0
  3. package/src/index.d.ts +3 -0
  4. package/src/index.js +59 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/actions/add-comment-to-conversation.d.ts +6 -0
  7. package/src/lib/actions/add-comment-to-conversation.js +43 -0
  8. package/src/lib/actions/add-comment-to-conversation.js.map +1 -0
  9. package/src/lib/actions/add-tag-to-contact.d.ts +6 -0
  10. package/src/lib/actions/add-tag-to-contact.js +55 -0
  11. package/src/lib/actions/add-tag-to-contact.js.map +1 -0
  12. package/src/lib/actions/assign-or-unassign-conversation.d.ts +16 -0
  13. package/src/lib/actions/assign-or-unassign-conversation.js +44 -0
  14. package/src/lib/actions/assign-or-unassign-conversation.js.map +1 -0
  15. package/src/lib/actions/create-contact.d.ts +13 -0
  16. package/src/lib/actions/create-contact.js +127 -0
  17. package/src/lib/actions/create-contact.js.map +1 -0
  18. package/src/lib/actions/create-or-update-contact.d.ts +13 -0
  19. package/src/lib/actions/create-or-update-contact.js +129 -0
  20. package/src/lib/actions/create-or-update-contact.js.map +1 -0
  21. package/src/lib/actions/delete-contact.d.ts +5 -0
  22. package/src/lib/actions/delete-contact.js +29 -0
  23. package/src/lib/actions/delete-contact.js.map +1 -0
  24. package/src/lib/actions/find-contact.d.ts +8 -0
  25. package/src/lib/actions/find-contact.js +66 -0
  26. package/src/lib/actions/find-contact.js.map +1 -0
  27. package/src/lib/actions/open-conversation.d.ts +5 -0
  28. package/src/lib/actions/open-conversation.js +32 -0
  29. package/src/lib/actions/open-conversation.js.map +1 -0
  30. package/src/lib/common/auth.d.ts +4 -0
  31. package/src/lib/common/auth.js +45 -0
  32. package/src/lib/common/auth.js.map +1 -0
  33. package/src/lib/common/client.d.ts +10 -0
  34. package/src/lib/common/client.js +56 -0
  35. package/src/lib/common/client.js.map +1 -0
  36. package/src/lib/common/props.d.ts +2 -0
  37. package/src/lib/common/props.js +116 -0
  38. package/src/lib/common/props.js.map +1 -0
  39. package/src/lib/triggers/contact-tag-updated.d.ts +14 -0
  40. package/src/lib/triggers/contact-tag-updated.js +47 -0
  41. package/src/lib/triggers/contact-tag-updated.js.map +1 -0
  42. package/src/lib/triggers/contact-updated.d.ts +14 -0
  43. package/src/lib/triggers/contact-updated.js +47 -0
  44. package/src/lib/triggers/contact-updated.js.map +1 -0
  45. package/src/lib/triggers/conversation-closed.d.ts +14 -0
  46. package/src/lib/triggers/conversation-closed.js +47 -0
  47. package/src/lib/triggers/conversation-closed.js.map +1 -0
  48. package/src/lib/triggers/conversation-opened.d.ts +14 -0
  49. package/src/lib/triggers/conversation-opened.js +84 -0
  50. package/src/lib/triggers/conversation-opened.js.map +1 -0
  51. package/src/lib/triggers/new-contact.d.ts +14 -0
  52. package/src/lib/triggers/new-contact.js +47 -0
  53. package/src/lib/triggers/new-contact.js.map +1 -0
  54. package/src/lib/triggers/new-incoming-message.d.ts +14 -0
  55. package/src/lib/triggers/new-incoming-message.js +47 -0
  56. package/src/lib/triggers/new-incoming-message.js.map +1 -0
  57. package/src/lib/triggers/new-outgoing-message.d.ts +14 -0
  58. package/src/lib/triggers/new-outgoing-message.js +47 -0
  59. package/src/lib/triggers/new-outgoing-message.js.map +1 -0
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-respond-io
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-respond-io` to build the library.
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@activepieces/piece-respond-io",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@ai-sdk/anthropic": "1.2.12",
9
+ "@ai-sdk/google": "1.2.19",
10
+ "@ai-sdk/openai": "1.3.22",
11
+ "@ai-sdk/replicate": "0.2.8",
12
+ "@sinclair/typebox": "0.34.11",
13
+ "ai": "4.3.16",
14
+ "axios": "1.8.3",
15
+ "axios-retry": "4.4.1",
16
+ "deepmerge-ts": "7.1.0",
17
+ "fast-glob": "3.3.3",
18
+ "mime-types": "2.1.35",
19
+ "nanoid": "3.3.8",
20
+ "semver": "7.6.0",
21
+ "tslib": "^2.3.0",
22
+ "zod": "3.25.76",
23
+ "@activepieces/pieces-common": "0.6.1",
24
+ "@activepieces/pieces-framework": "0.18.0",
25
+ "@activepieces/shared": "0.17.8"
26
+ },
27
+ "overrides": {
28
+ "@tryfabric/martian": {
29
+ "@notionhq/client": "$@notionhq/client"
30
+ },
31
+ "vite": {
32
+ "rollup": "npm:@rollup/wasm-node"
33
+ }
34
+ },
35
+ "resolutions": {
36
+ "rollup": "npm:@rollup/wasm-node"
37
+ }
38
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const respondIo: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
3
+ }>>;
package/src/index.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.respondIo = 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 auth_1 = require("./lib/common/auth");
8
+ const add_comment_to_conversation_1 = require("./lib/actions/add-comment-to-conversation");
9
+ const add_tag_to_contact_1 = require("./lib/actions/add-tag-to-contact");
10
+ const assign_or_unassign_conversation_1 = require("./lib/actions/assign-or-unassign-conversation");
11
+ const create_contact_1 = require("./lib/actions/create-contact");
12
+ const create_or_update_contact_1 = require("./lib/actions/create-or-update-contact");
13
+ const delete_contact_1 = require("./lib/actions/delete-contact");
14
+ const find_contact_1 = require("./lib/actions/find-contact");
15
+ const open_conversation_1 = require("./lib/actions/open-conversation");
16
+ const contact_tag_updated_1 = require("./lib/triggers/contact-tag-updated");
17
+ const contact_updated_1 = require("./lib/triggers/contact-updated");
18
+ const conversation_closed_1 = require("./lib/triggers/conversation-closed");
19
+ const conversation_opened_1 = require("./lib/triggers/conversation-opened");
20
+ const new_contact_1 = require("./lib/triggers/new-contact");
21
+ const new_incoming_message_1 = require("./lib/triggers/new-incoming-message");
22
+ const new_outgoing_message_1 = require("./lib/triggers/new-outgoing-message");
23
+ exports.respondIo = (0, pieces_framework_1.createPiece)({
24
+ displayName: 'Respond.io',
25
+ auth: auth_1.respondIoAuth,
26
+ minimumSupportedRelease: '0.36.1',
27
+ logoUrl: 'https://cdn.activepieces.com/pieces/respond-io.png',
28
+ authors: ['aryel780'],
29
+ actions: [
30
+ add_comment_to_conversation_1.addCommentToConversation,
31
+ add_tag_to_contact_1.addTagToContact,
32
+ assign_or_unassign_conversation_1.assignOrUnassignConversation,
33
+ create_contact_1.createContact,
34
+ create_or_update_contact_1.createOrUpdateContact,
35
+ delete_contact_1.deleteContact,
36
+ find_contact_1.findContact,
37
+ open_conversation_1.openConversation,
38
+ (0, pieces_common_1.createCustomApiCallAction)({
39
+ auth: auth_1.respondIoAuth,
40
+ baseUrl: () => 'https://api.respond.io/v2',
41
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
42
+ const { token } = auth;
43
+ return {
44
+ Authorization: `Bearer ${token}`,
45
+ };
46
+ }),
47
+ }),
48
+ ],
49
+ triggers: [
50
+ contact_tag_updated_1.contactTagUpdatedTrigger,
51
+ contact_updated_1.contactUpdatedTrigger,
52
+ conversation_closed_1.conversationClosedTrigger,
53
+ conversation_opened_1.conversationOpenedTrigger,
54
+ new_contact_1.newContactTrigger,
55
+ new_incoming_message_1.newIncomingMessageTrigger,
56
+ new_outgoing_message_1.newOutgoingMessageTrigger,
57
+ ],
58
+ });
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/respond-io/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAA6D;AAC7D,4CAAkD;AAClD,2FAAqF;AACrF,yEAAmE;AACnE,mGAA6F;AAC7F,iEAA6D;AAC7D,qFAA+E;AAC/E,iEAA6D;AAC7D,6DAAyD;AACzD,uEAAmE;AACnE,4EAA8E;AAC9E,oEAAuE;AACvE,4EAA+E;AAC/E,4EAA+E;AAC/E,4DAA+D;AAC/D,8EAAgF;AAChF,8EAAgF;AAEnE,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,YAAY;IACzB,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,oDAAoD;IAC7D,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE;QACP,sDAAwB;QACxB,oCAAe;QACf,8DAA4B;QAC5B,8BAAa;QACb,gDAAqB;QACrB,8BAAa;QACb,0BAAW;QACX,oCAAgB;QAChB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,oBAAa;YACnB,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B;YAC1C,WAAW,EAAE,CAAO,IAAa,EAAE,EAAE;gBACnC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAyB,CAAC;gBAC5C,OAAO;oBACL,aAAa,EAAE,UAAU,KAAK,EAAE;iBACjC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE;QACR,8CAAwB;QACxB,uCAAqB;QACrB,+CAAyB;QACzB,+CAAyB;QACzB,+BAAiB;QACjB,gDAAyB;QACzB,gDAAyB;KAC1B;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const addCommentToConversation: 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>;
5
+ text: import("@activepieces/pieces-framework").LongTextProperty<true>;
6
+ }>;
@@ -0,0 +1,43 @@
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
+ props: {
16
+ identifier: props_1.contactIdentifierDropdown,
17
+ text: pieces_framework_1.Property.LongText({
18
+ displayName: 'Comment Text',
19
+ description: 'The internal comment to add (max 1000 characters). You can mention users with {{@user.ID}} format where ID is the user ID.',
20
+ required: true,
21
+ }),
22
+ },
23
+ run(_a) {
24
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
25
+ const { identifier, text } = propsValue;
26
+ if (!text || text.trim().length === 0) {
27
+ throw new Error('Comment text is required and cannot be empty.');
28
+ }
29
+ if (text.length > 1000) {
30
+ throw new Error(`Comment text is too long (${text.length} characters). Maximum allowed is 1000 characters.`);
31
+ }
32
+ return yield (0, client_1.respondIoApiCall)({
33
+ method: pieces_common_1.HttpMethod.POST,
34
+ url: `/contact/${identifier}/comment`,
35
+ auth: auth,
36
+ body: {
37
+ text: text.trim(),
38
+ },
39
+ });
40
+ });
41
+ },
42
+ });
43
+ //# sourceMappingURL=add-comment-to-conversation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-comment-to-conversation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/respond-io/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,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"}
@@ -0,0 +1,6 @@
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>;
5
+ tags: import("@activepieces/pieces-framework").ArrayProperty<true>;
6
+ }>;
@@ -0,0 +1,55 @@
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
+ props: {
16
+ identifier: props_1.contactIdentifierDropdown,
17
+ tags: pieces_framework_1.Property.Array({
18
+ displayName: 'Tags',
19
+ description: 'Tags to add to the contact (minimum 1, maximum 10 tags).',
20
+ required: true,
21
+ properties: {
22
+ tag: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Tag Name',
24
+ description: 'Name of the tag to add.',
25
+ required: true,
26
+ }),
27
+ },
28
+ }),
29
+ },
30
+ run(_a) {
31
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
32
+ const { identifier, tags } = propsValue;
33
+ if (!tags || !Array.isArray(tags) || tags.length === 0) {
34
+ throw new Error('At least one tag is required.');
35
+ }
36
+ if (tags.length > 10) {
37
+ throw new Error('Maximum of 10 tags allowed per request.');
38
+ }
39
+ const tagNames = tags
40
+ .map((tagObj) => tagObj.tag)
41
+ .filter((tag) => tag && tag.trim())
42
+ .map((tag) => tag.trim());
43
+ if (tagNames.length === 0) {
44
+ throw new Error('At least one valid tag name is required.');
45
+ }
46
+ return yield (0, client_1.respondIoApiCall)({
47
+ method: pieces_common_1.HttpMethod.POST,
48
+ url: `/contact/${identifier}/tag`,
49
+ auth: auth,
50
+ body: tagNames,
51
+ });
52
+ });
53
+ },
54
+ });
55
+ //# sourceMappingURL=add-tag-to-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-tag-to-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/respond-io/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,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"}
@@ -0,0 +1,16 @@
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>;
5
+ assignee: {
6
+ description: string;
7
+ required: false;
8
+ displayName: string;
9
+ refreshers: string[];
10
+ refreshOnSearch?: boolean;
11
+ options: (propsValue: Record<string, unknown>, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").DropdownState<string>>;
12
+ valueSchema: string;
13
+ type: import("@activepieces/pieces-framework").PropertyType.DROPDOWN;
14
+ defaultValue?: unknown;
15
+ };
16
+ }>;
@@ -0,0 +1,44 @@
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
+ props: {
16
+ identifier: props_1.contactIdentifierDropdown,
17
+ assignee: Object.assign(Object.assign({}, props_1.assigneeDropdown), { description: 'Select the user to assign the conversation to. Leave empty to unassign.', required: false }),
18
+ },
19
+ run(_a) {
20
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
21
+ const { identifier, assignee } = propsValue;
22
+ // Convert assignee to proper format
23
+ let assigneeValue = null;
24
+ if (assignee && assignee.trim() !== '' && assignee !== 'null') {
25
+ const userId = parseInt(assignee, 10);
26
+ if (!isNaN(userId)) {
27
+ assigneeValue = userId;
28
+ }
29
+ else {
30
+ assigneeValue = assignee;
31
+ }
32
+ }
33
+ return yield (0, client_1.respondIoApiCall)({
34
+ method: pieces_common_1.HttpMethod.POST,
35
+ url: `/contact/${identifier}/conversation/assignee`,
36
+ auth: auth,
37
+ body: {
38
+ assignee: assigneeValue,
39
+ },
40
+ });
41
+ });
42
+ },
43
+ });
44
+ //# sourceMappingURL=assign-or-unassign-conversation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assign-or-unassign-conversation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/respond-io/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,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"}
@@ -0,0 +1,13 @@
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
+ }>;
@@ -0,0 +1,127 @@
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
+ props: {
15
+ identifier: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Identifier',
17
+ description: 'Must be a unique identifier for the new contact. Use format: `email:user@example.com` or `phone:+60123456789`.',
18
+ required: true,
19
+ }),
20
+ firstName: pieces_framework_1.Property.ShortText({
21
+ displayName: 'First Name',
22
+ required: true,
23
+ }),
24
+ lastName: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Last Name',
26
+ required: false,
27
+ }),
28
+ email: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Email',
30
+ description: 'The email address of the contact.',
31
+ required: false,
32
+ }),
33
+ phone: pieces_framework_1.Property.ShortText({
34
+ displayName: 'Phone',
35
+ description: 'The phone number of the contact (in E.164 format).',
36
+ required: false,
37
+ }),
38
+ language: pieces_framework_1.Property.ShortText({
39
+ displayName: 'Language',
40
+ description: 'Language code (e.g., "en", "es") following ISO 639-1.',
41
+ required: false,
42
+ }),
43
+ profilePic: pieces_framework_1.Property.ShortText({
44
+ displayName: 'Profile Picture URL',
45
+ description: "A direct URL to the contact's profile picture.",
46
+ required: false,
47
+ }),
48
+ countryCode: pieces_framework_1.Property.ShortText({
49
+ displayName: 'Country Code',
50
+ description: 'Country code (e.g., "US", "MY") following ISO 3166-1 alpha-2.',
51
+ required: false,
52
+ }),
53
+ customFields: pieces_framework_1.Property.Array({
54
+ displayName: 'Custom Fields',
55
+ description: 'Add custom fields for the contact.',
56
+ required: false,
57
+ properties: {
58
+ name: pieces_framework_1.Property.ShortText({
59
+ displayName: 'Field Name',
60
+ description: 'Name of the custom field (e.g., "Company Website", "Department").',
61
+ required: true,
62
+ }),
63
+ value: pieces_framework_1.Property.ShortText({
64
+ displayName: 'Field Value',
65
+ 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"',
66
+ required: false,
67
+ }),
68
+ },
69
+ }),
70
+ },
71
+ run(_a) {
72
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
73
+ const { identifier, customFields } = propsValue, contactData = tslib_1.__rest(propsValue, ["identifier", "customFields"]);
74
+ if (contactData.email && contactData.email.trim()) {
75
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
76
+ if (!emailRegex.test(contactData.email)) {
77
+ throw new Error('Invalid email format. Please provide a valid email address.');
78
+ }
79
+ }
80
+ if (contactData.phone && contactData.phone.trim()) {
81
+ const e164Regex = /^\+[1-9]\d{1,14}$/;
82
+ if (!e164Regex.test(contactData.phone)) {
83
+ throw new Error('Invalid phone format. Please provide phone number in E.164 format (e.g., +60123456789).');
84
+ }
85
+ }
86
+ if (contactData.profilePic && contactData.profilePic.trim()) {
87
+ const urlRegex = /^https?:\/\/[^\s$.?#].[^\s]*$/;
88
+ if (!urlRegex.test(contactData.profilePic)) {
89
+ throw new Error('Invalid profile picture URL format. Please provide a valid HTTP/HTTPS URL.');
90
+ }
91
+ }
92
+ if (contactData.language && contactData.language.trim()) {
93
+ const iso639Regex = /^[a-z]{2}$/;
94
+ if (!iso639Regex.test(contactData.language)) {
95
+ throw new Error('Invalid language code. Please provide a valid ISO 639-1 two-letter language code (e.g., "en", "es").');
96
+ }
97
+ }
98
+ if (contactData.countryCode && contactData.countryCode.trim()) {
99
+ const iso3166Regex = /^[A-Z]{2}$/;
100
+ if (!iso3166Regex.test(contactData.countryCode)) {
101
+ throw new Error('Invalid country code. Please provide a valid ISO 3166-1 alpha-2 two-letter country code (e.g., "US", "MY").');
102
+ }
103
+ }
104
+ const body = {};
105
+ for (const [key, value] of Object.entries(contactData)) {
106
+ if (value !== undefined && value !== null) {
107
+ body[key] = value;
108
+ }
109
+ }
110
+ if (customFields && Array.isArray(customFields) && customFields.length > 0) {
111
+ body['custom_fields'] = customFields
112
+ .filter((field) => field.name && field.name.trim())
113
+ .map((field) => ({
114
+ name: field.name,
115
+ value: field.value || null,
116
+ }));
117
+ }
118
+ return yield (0, client_1.respondIoApiCall)({
119
+ method: pieces_common_1.HttpMethod.POST,
120
+ url: `/contact/${identifier}`,
121
+ auth: auth,
122
+ body,
123
+ });
124
+ });
125
+ },
126
+ });
127
+ //# sourceMappingURL=create-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/respond-io/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,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,gHAAgH;YAClH,QAAQ,EAAE,IAAI;SACf,CAAC;QAC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AAE;gBAC7B,IAAI,EAAE,IAAI;gBACV,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,13 @@
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
+ }>;
@@ -0,0 +1,129 @@
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
+ props: {
15
+ identifier: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Identifier',
17
+ 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.',
18
+ required: true,
19
+ }),
20
+ firstName: pieces_framework_1.Property.ShortText({
21
+ displayName: 'First Name',
22
+ required: true,
23
+ }),
24
+ lastName: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Last Name',
26
+ required: false,
27
+ }),
28
+ email: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Email',
30
+ description: 'The email address of the contact.',
31
+ required: false,
32
+ }),
33
+ phone: pieces_framework_1.Property.ShortText({
34
+ displayName: 'Phone',
35
+ description: 'The phone number of the contact (in E.164 format).',
36
+ required: false,
37
+ }),
38
+ language: pieces_framework_1.Property.ShortText({
39
+ displayName: 'Language',
40
+ description: 'Language code (e.g., "en", "es") following ISO 639-1.',
41
+ required: false,
42
+ }),
43
+ profilePic: pieces_framework_1.Property.ShortText({
44
+ displayName: 'Profile Picture URL',
45
+ description: "A direct URL to the contact's profile picture.",
46
+ required: false,
47
+ }),
48
+ countryCode: pieces_framework_1.Property.ShortText({
49
+ displayName: 'Country Code',
50
+ description: 'Country code (e.g., "US", "MY") following ISO 3166-1 alpha-2.',
51
+ required: false,
52
+ }),
53
+ customFields: pieces_framework_1.Property.Array({
54
+ displayName: 'Custom Fields',
55
+ description: 'Add custom fields for the contact.',
56
+ required: false,
57
+ properties: {
58
+ name: pieces_framework_1.Property.ShortText({
59
+ displayName: 'Field Name',
60
+ description: 'Name of the custom field (e.g., "Company Website", "Department").',
61
+ required: true,
62
+ }),
63
+ value: pieces_framework_1.Property.ShortText({
64
+ displayName: 'Field Value',
65
+ 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"',
66
+ required: false,
67
+ }),
68
+ },
69
+ }),
70
+ },
71
+ run(_a) {
72
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
73
+ const { identifier, customFields } = propsValue, contactData = tslib_1.__rest(propsValue, ["identifier", "customFields"]);
74
+ // Field validation
75
+ if (contactData.email && contactData.email.trim()) {
76
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
77
+ if (!emailRegex.test(contactData.email)) {
78
+ throw new Error('Invalid email format. Please provide a valid email address.');
79
+ }
80
+ }
81
+ if (contactData.phone && contactData.phone.trim()) {
82
+ const e164Regex = /^\+[1-9]\d{1,14}$/;
83
+ if (!e164Regex.test(contactData.phone)) {
84
+ throw new Error('Invalid phone format. Please provide phone number in E.164 format (e.g., +60123456789).');
85
+ }
86
+ }
87
+ if (contactData.profilePic && contactData.profilePic.trim()) {
88
+ const urlRegex = /^https?:\/\/[^\s$.?#].[^\s]*$/;
89
+ if (!urlRegex.test(contactData.profilePic)) {
90
+ throw new Error('Invalid profile picture URL format. Please provide a valid HTTP/HTTPS URL.');
91
+ }
92
+ }
93
+ if (contactData.language && contactData.language.trim()) {
94
+ const iso639Regex = /^[a-z]{2}$/;
95
+ if (!iso639Regex.test(contactData.language)) {
96
+ throw new Error('Invalid language code. Please provide a valid ISO 639-1 two-letter language code (e.g., "en", "es").');
97
+ }
98
+ }
99
+ if (contactData.countryCode && contactData.countryCode.trim()) {
100
+ const iso3166Regex = /^[A-Z]{2}$/;
101
+ if (!iso3166Regex.test(contactData.countryCode)) {
102
+ throw new Error('Invalid country code. Please provide a valid ISO 3166-1 alpha-2 two-letter country code (e.g., "US", "MY").');
103
+ }
104
+ }
105
+ const body = {};
106
+ for (const [key, value] of Object.entries(contactData)) {
107
+ if (value !== undefined && value !== null) {
108
+ body[key] = value;
109
+ }
110
+ }
111
+ // Add custom fields array if provided
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/create_or_update/${identifier}`,
123
+ auth: auth,
124
+ body,
125
+ });
126
+ });
127
+ },
128
+ });
129
+ //# sourceMappingURL=create-or-update-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-or-update-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/respond-io/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,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,E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AC;gBACpB,CAAC;YACH,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"}
@@ -0,0 +1,5 @@
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>;
5
+ }>;