@activepieces/piece-wonderchat 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.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-wonderchat
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-wonderchat` to build the library.
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@activepieces/piece-wonderchat",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "axios": "1.8.3",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "mime-types": "2.1.35",
13
+ "nanoid": "3.3.8",
14
+ "semver": "7.6.0",
15
+ "tslib": "^2.3.0",
16
+ "zod": "3.25.76",
17
+ "@activepieces/pieces-common": "0.7.0",
18
+ "@activepieces/pieces-framework": "0.20.0",
19
+ "@activepieces/shared": "0.20.1"
20
+ },
21
+ "overrides": {
22
+ "@tryfabric/martian": {
23
+ "@notionhq/client": "$@notionhq/client"
24
+ },
25
+ "vite": {
26
+ "rollup": "npm:@rollup/wasm-node"
27
+ }
28
+ },
29
+ "resolutions": {
30
+ "rollup": "npm:@rollup/wasm-node"
31
+ }
32
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const wonderchatAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
2
+ export declare const wonderchat: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wonderchat = exports.wonderchatAuth = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ const shared_1 = require("@activepieces/shared");
6
+ const ask_question_1 = require("./lib/actions/ask-question");
7
+ const add_page_1 = require("./lib/actions/add-page");
8
+ const add_tag_1 = require("./lib/actions/add-tag");
9
+ const remove_tag_1 = require("./lib/actions/remove-tag");
10
+ const new_user_message_1 = require("./lib/triggers/new-user-message");
11
+ exports.wonderchatAuth = pieces_framework_1.PieceAuth.SecretText({
12
+ displayName: 'API Key',
13
+ description: `
14
+ 1. Log in to your Wonderchat account.
15
+ 2. Click on your **Profile card**.
16
+ 2. Go to your **User settings**.
17
+ 3. Click on the the **API keys** tab.
18
+ 3. If you already have a key, copy it, if not generate one.
19
+ `,
20
+ required: true,
21
+ });
22
+ exports.wonderchat = (0, pieces_framework_1.createPiece)({
23
+ displayName: 'Wonderchat',
24
+ description: 'Wonderchat is a no-code chatbot platform that lets you deploy AI-powered chatbots for websites quickly.',
25
+ auth: exports.wonderchatAuth,
26
+ minimumSupportedRelease: '0.36.1',
27
+ logoUrl: 'https://cdn.activepieces.com/pieces/wonderchat.png',
28
+ categories: [
29
+ shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE,
30
+ ],
31
+ authors: ['devroy10', 'sanket-a11y'],
32
+ actions: [ask_question_1.askQuestion, add_page_1.addPage, add_tag_1.addTag, remove_tag_1.removeTag],
33
+ triggers: [new_user_message_1.newUserMessage],
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/wonderchat/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,iDAAqD;AACrD,6DAAyD;AACzD,qDAAiD;AACjD,mDAA+C;AAC/C,yDAAqD;AACrD,sEAAiE;AAEpD,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IACjD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE;;;;;;GAMZ;IACD,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,YAAY;IACzB,WAAW,EACT,yGAAyG;IAC3G,IAAI,EAAE,sBAAc;IACpB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,oDAAoD;IAC7D,UAAU,EAAE;QACV,sBAAa,CAAC,uBAAuB;KACtC;IACD,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;IACpC,OAAO,EAAE,CAAC,0BAAW,EAAE,kBAAO,EAAE,gBAAM,EAAE,sBAAS,CAAC;IAClD,QAAQ,EAAE,CAAC,iCAAc,CAAC;CAC3B,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const addPage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ chatbotId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ urls: import("@activepieces/pieces-framework").ArrayProperty<false>;
4
+ sessionCookie: import("@activepieces/pieces-framework").LongTextProperty<false>;
5
+ }>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addPage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../..");
8
+ exports.addPage = (0, pieces_framework_1.createAction)({
9
+ name: 'addPage',
10
+ displayName: 'Add Page',
11
+ description: 'Add new pages to your chatbot’s knowledge base.',
12
+ auth: __1.wonderchatAuth,
13
+ props: {
14
+ chatbotId: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Chatbot Id',
16
+ description: 'The ID of your chatbot (can be found in the URL when viewing your bot: /bot/YOUR_BOT_ID)',
17
+ required: true,
18
+ }),
19
+ urls: pieces_framework_1.Property.Array({
20
+ displayName: 'URLs',
21
+ description: 'List of webpage URLs to add to your chatbot\'s knowledge base (e.g., "https://wonderchat.io")',
22
+ required: false,
23
+ }),
24
+ sessionCookie: pieces_framework_1.Property.LongText({
25
+ displayName: 'Session cookie',
26
+ description: 'Session cookie for crawling sites behind login',
27
+ required: false,
28
+ }),
29
+ },
30
+ run(_a) {
31
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
32
+ const apiKey = auth;
33
+ const { chatbotId, urls, sessionCookie } = propsValue;
34
+ const requestbody = {
35
+ apiKey,
36
+ chatbotId,
37
+ };
38
+ if (sessionCookie) {
39
+ requestbody.sessionCookie = sessionCookie;
40
+ }
41
+ if (urls) {
42
+ requestbody.urls = urls;
43
+ }
44
+ const response = yield pieces_common_1.httpClient.sendRequest({
45
+ method: pieces_common_1.HttpMethod.POST,
46
+ url: 'https://app.wonderchat.io/api/v1/add-pages',
47
+ headers: { 'Content-Type': 'application/json' },
48
+ body: requestbody,
49
+ });
50
+ return response.body;
51
+ });
52
+ },
53
+ });
54
+ //# sourceMappingURL=add-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-page.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/wonderchat/src/lib/actions/add-page.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6BAAuC;AAE1B,QAAA,OAAO,GAAG,IAAA,+BAAY,EAAC;IAClC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,iDAAiD;IAC9D,IAAI,EAAE,kBAAc;IACpB,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,0FAA0F;YACvG,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,+FAA+F;YAC5G,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC;YACpB,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC;YAEtD,MAAM,WAAW,GAAQ;gBACvB,MAAM;gBACN,SAAS;aACV,CAAC;YACF,IAAI,aAAa,EAAE,CAAC;gBAClB,WAAW,CAAC,aAAa,GAAG,aAAa,CAAC;YAC5C,CAAC;YACD,IAAI,IAAI,EAAE,CAAC;gBACT,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;YAC1B,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,4CAA4C;gBACjD,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAC;gBAC9C,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const addTag: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ chatlogId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ tags: import("@activepieces/pieces-framework").ArrayProperty<true>;
4
+ }>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addTag = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../..");
8
+ exports.addTag = (0, pieces_framework_1.createAction)({
9
+ name: 'addTag',
10
+ displayName: 'Add Tag',
11
+ description: 'Add custom tags to a specific chatlog.',
12
+ auth: __1.wonderchatAuth,
13
+ props: {
14
+ chatlogId: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Chatlog Id',
16
+ description: 'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',
17
+ required: true,
18
+ }),
19
+ tags: pieces_framework_1.Property.Array({
20
+ displayName: 'Tags',
21
+ description: 'List of URLs to add to your chatbot',
22
+ required: true,
23
+ }),
24
+ },
25
+ run(_a) {
26
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
27
+ const apiKey = auth;
28
+ const { chatlogId, tags } = propsValue;
29
+ const response = yield pieces_common_1.httpClient.sendRequest({
30
+ method: pieces_common_1.HttpMethod.POST,
31
+ url: 'https://app.wonderchat.io/api/v1/add-tags-to-chatlog',
32
+ headers: { 'Content-Type': 'application/json' },
33
+ body: {
34
+ apiKey,
35
+ chatlogId,
36
+ tags,
37
+ },
38
+ });
39
+ return response.body;
40
+ });
41
+ },
42
+ });
43
+ //# sourceMappingURL=add-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-tag.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/wonderchat/src/lib/actions/add-tag.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6BAAuC;AAE1B,QAAA,MAAM,GAAG,IAAA,+BAAY,EAAC;IACjC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,wCAAwC;IACrD,IAAI,EAAE,kBAAc;IACpB,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,2FAA2F;YAC7F,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC;YACpB,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;YAEvC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,sDAAsD;gBAC3D,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,IAAI,EAAE;oBACJ,MAAM;oBACN,SAAS;oBACT,IAAI;iBACL;aACF,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const askQuestion: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ chatbotId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ question: import("@activepieces/pieces-framework").LongTextProperty<true>;
4
+ chatlogId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ context: import("@activepieces/pieces-framework").LongTextProperty<false>;
6
+ contextUrl: import("@activepieces/pieces-framework").LongTextProperty<false>;
7
+ }>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askQuestion = 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 __1 = require("../..");
8
+ exports.askQuestion = (0, pieces_framework_1.createAction)({
9
+ name: 'askQuestion',
10
+ displayName: 'Ask Question',
11
+ description: 'Sends a question to a Wonderchat bot; returns the bot’s answer.',
12
+ auth: __1.wonderchatAuth,
13
+ props: {
14
+ chatbotId: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Chatbot Id',
16
+ description: 'The ID of your chatbot (can be found in the URL when viewing your bot: /bot/YOUR_BOT_ID)',
17
+ required: true,
18
+ }),
19
+ question: pieces_framework_1.Property.LongText({
20
+ displayName: 'Question',
21
+ description: 'The question you wish to ask your chatbot',
22
+ required: true,
23
+ }),
24
+ chatlogId: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Chatlog Id',
26
+ description: 'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',
27
+ required: false,
28
+ }),
29
+ context: pieces_framework_1.Property.LongText({
30
+ displayName: 'Custom context',
31
+ description: 'Additional custom context about the chat session (e.g., user information)',
32
+ required: false,
33
+ }),
34
+ contextUrl: pieces_framework_1.Property.LongText({
35
+ displayName: 'Context URL',
36
+ description: 'URL of the page the user is on to provide additional context',
37
+ required: false,
38
+ }),
39
+ },
40
+ run(_a) {
41
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue }) {
42
+ const { chatbotId, question, chatlogId, context, contextUrl } = propsValue;
43
+ const requestbody = {
44
+ chatbotId,
45
+ question,
46
+ };
47
+ if (chatlogId) {
48
+ requestbody.chatlogId = chatlogId;
49
+ }
50
+ if (context) {
51
+ requestbody.context = context;
52
+ }
53
+ if (contextUrl) {
54
+ requestbody.contextUrl = contextUrl;
55
+ }
56
+ const response = yield pieces_common_1.httpClient.sendRequest({
57
+ method: pieces_common_1.HttpMethod.POST,
58
+ url: 'https://app.wonderchat.io/api/v1/chat',
59
+ headers: { 'Content-Type': 'application/json' },
60
+ body: requestbody,
61
+ });
62
+ return response.body;
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=ask-question.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/wonderchat/src/lib/actions/ask-question.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AACrE,qEAAwE;AACxE,6BAAuC;AAE1B,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,iEAA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,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,uCAAuC;gBAC5C,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const removeTag: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ chatlogId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ tags: import("@activepieces/pieces-framework").ArrayProperty<true>;
4
+ }>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeTag = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../..");
8
+ exports.removeTag = (0, pieces_framework_1.createAction)({
9
+ name: 'removeTag',
10
+ displayName: 'Remove Tag',
11
+ description: 'Remove specific tags from a chatlog.',
12
+ auth: __1.wonderchatAuth,
13
+ props: {
14
+ chatlogId: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Chatlog Id',
16
+ description: 'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',
17
+ required: true,
18
+ }),
19
+ tags: pieces_framework_1.Property.Array({
20
+ displayName: 'Tags',
21
+ description: 'List of tags to remove',
22
+ required: true,
23
+ }),
24
+ },
25
+ run(_a) {
26
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
27
+ const apiKey = auth;
28
+ const { chatlogId, tags } = propsValue;
29
+ const response = yield pieces_common_1.httpClient.sendRequest({
30
+ method: pieces_common_1.HttpMethod.POST,
31
+ url: 'https://app.wonderchat.io/api/v1/delete-tags-from-chatlog',
32
+ headers: { 'Content-Type': 'application/json' },
33
+ body: {
34
+ apiKey,
35
+ chatlogId,
36
+ tags,
37
+ },
38
+ });
39
+ return response.body;
40
+ });
41
+ },
42
+ });
43
+ //# sourceMappingURL=remove-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-tag.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/wonderchat/src/lib/actions/remove-tag.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6BAAuC;AAE1B,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,sCAAsC;IACnD,IAAI,EAAE,kBAAc;IACpB,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,2FAA2F;YAC7F,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC;YACpB,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;YAEvC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,2DAA2D;gBAChE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,IAAI,EAAE;oBACJ,MAAM;oBACN,SAAS;oBACT,IAAI;iBACL;aACF,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const newUserMessage: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
+ chatlogId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
+ chatlogId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
+ chatlogId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ }>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newUserMessage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../..");
8
+ const polling = {
9
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
10
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
11
+ const response = yield pieces_common_1.httpClient.sendRequest({
12
+ method: pieces_common_1.HttpMethod.POST,
13
+ url: 'https://app.wonderchat.io/api/v1/messages',
14
+ headers: { 'Content-Type': 'application/json' },
15
+ body: {
16
+ apiKey: auth,
17
+ chatlogId: propsValue.chatlogId
18
+ }
19
+ });
20
+ const messages = response.body.messages;
21
+ const newMessages = messages
22
+ .filter((message) => message.type === 'user')
23
+ .filter((message) => new Date(message.createdAt).getTime() > lastFetchEpochMS);
24
+ return newMessages.map((message) => ({
25
+ epochMilliSeconds: new Date(message.createdAt).getTime(),
26
+ data: message
27
+ }));
28
+ })
29
+ };
30
+ exports.newUserMessage = (0, pieces_framework_1.createTrigger)({
31
+ auth: __1.wonderchatAuth,
32
+ name: 'newUserMessage',
33
+ displayName: 'New User Message',
34
+ description: 'Triggers when a new message is sent by a user in a specific chatlog.',
35
+ props: {
36
+ chatlogId: pieces_framework_1.Property.ShortText({
37
+ displayName: 'Chatlog ID',
38
+ description: 'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',
39
+ required: true,
40
+ }),
41
+ },
42
+ sampleData: {
43
+ content: 'I would want to now more about the products pricing strategy',
44
+ type: 'user',
45
+ createdAt: '2023-12-01T06:35:15.456Z'
46
+ },
47
+ type: pieces_framework_1.TriggerStrategy.POLLING,
48
+ test(context) {
49
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
50
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
51
+ });
52
+ },
53
+ onEnable(context) {
54
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
55
+ const { store, auth, propsValue } = context;
56
+ yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
57
+ });
58
+ },
59
+ onDisable(context) {
60
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+ const { store, auth, propsValue } = context;
62
+ yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
63
+ });
64
+ },
65
+ run(context) {
66
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
68
+ });
69
+ }
70
+ });
71
+ //# sourceMappingURL=new-user-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-user-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/wonderchat/src/lib/triggers/new-user-message.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,+DAMqC;AACrC,6BAAuC;AAQvC,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;QAClD,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,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