@activepieces/piece-whatsscale 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/package.json +17 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +112 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/crm/add-crm-contact-tag.d.ts +4 -0
- package/src/lib/actions/crm/add-crm-contact-tag.js +32 -0
- package/src/lib/actions/crm/add-crm-contact-tag.js.map +1 -0
- package/src/lib/actions/crm/create-crm-contact.d.ts +5 -0
- package/src/lib/actions/crm/create-crm-contact.js +45 -0
- package/src/lib/actions/crm/create-crm-contact.js.map +1 -0
- package/src/lib/actions/crm/delete-crm-contact.d.ts +3 -0
- package/src/lib/actions/crm/delete-crm-contact.js +27 -0
- package/src/lib/actions/crm/delete-crm-contact.js.map +1 -0
- package/src/lib/actions/crm/find-crm-contact-by-phone.d.ts +3 -0
- package/src/lib/actions/crm/find-crm-contact-by-phone.js +30 -0
- package/src/lib/actions/crm/find-crm-contact-by-phone.js.map +1 -0
- package/src/lib/actions/crm/get-crm-contact.d.ts +3 -0
- package/src/lib/actions/crm/get-crm-contact.js +27 -0
- package/src/lib/actions/crm/get-crm-contact.js.map +1 -0
- package/src/lib/actions/crm/list-crm-contacts.d.ts +6 -0
- package/src/lib/actions/crm/list-crm-contacts.js +86 -0
- package/src/lib/actions/crm/list-crm-contacts.js.map +1 -0
- package/src/lib/actions/crm/remove-crm-contact-tag.d.ts +4 -0
- package/src/lib/actions/crm/remove-crm-contact-tag.js +29 -0
- package/src/lib/actions/crm/remove-crm-contact-tag.js.map +1 -0
- package/src/lib/actions/crm/update-crm-contact.d.ts +5 -0
- package/src/lib/actions/crm/update-crm-contact.js +42 -0
- package/src/lib/actions/crm/update-crm-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-document-to-contact.d.ts +7 -0
- package/src/lib/actions/messaging/send-document-to-contact.js +55 -0
- package/src/lib/actions/messaging/send-document-to-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-document-to-crm-contact.d.ts +7 -0
- package/src/lib/actions/messaging/send-document-to-crm-contact.js +56 -0
- package/src/lib/actions/messaging/send-document-to-crm-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-document-to-group.d.ts +7 -0
- package/src/lib/actions/messaging/send-document-to-group.js +55 -0
- package/src/lib/actions/messaging/send-document-to-group.js.map +1 -0
- package/src/lib/actions/messaging/send-image-manual.d.ts +8 -0
- package/src/lib/actions/messaging/send-image-manual.js +58 -0
- package/src/lib/actions/messaging/send-image-manual.js.map +1 -0
- package/src/lib/actions/messaging/send-image-to-channel.d.ts +6 -0
- package/src/lib/actions/messaging/send-image-to-channel.js +45 -0
- package/src/lib/actions/messaging/send-image-to-channel.js.map +1 -0
- package/src/lib/actions/messaging/send-image-to-contact.d.ts +6 -0
- package/src/lib/actions/messaging/send-image-to-contact.js +45 -0
- package/src/lib/actions/messaging/send-image-to-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-image-to-crm-contact.d.ts +6 -0
- package/src/lib/actions/messaging/send-image-to-crm-contact.js +46 -0
- package/src/lib/actions/messaging/send-image-to-crm-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-image-to-group.d.ts +6 -0
- package/src/lib/actions/messaging/send-image-to-group.js +45 -0
- package/src/lib/actions/messaging/send-image-to-group.js.map +1 -0
- package/src/lib/actions/messaging/send-text-manual.d.ts +7 -0
- package/src/lib/actions/messaging/send-text-manual.js +51 -0
- package/src/lib/actions/messaging/send-text-manual.js.map +1 -0
- package/src/lib/actions/messaging/send-text-to-channel.d.ts +5 -0
- package/src/lib/actions/messaging/send-text-to-channel.js +35 -0
- package/src/lib/actions/messaging/send-text-to-channel.js.map +1 -0
- package/src/lib/actions/messaging/send-text-to-contact.d.ts +5 -0
- package/src/lib/actions/messaging/send-text-to-contact.js +35 -0
- package/src/lib/actions/messaging/send-text-to-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-text-to-crm-contact.d.ts +5 -0
- package/src/lib/actions/messaging/send-text-to-crm-contact.js +35 -0
- package/src/lib/actions/messaging/send-text-to-crm-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-text-to-group.d.ts +5 -0
- package/src/lib/actions/messaging/send-text-to-group.js +35 -0
- package/src/lib/actions/messaging/send-text-to-group.js.map +1 -0
- package/src/lib/actions/messaging/send-video-manual.d.ts +8 -0
- package/src/lib/actions/messaging/send-video-manual.js +60 -0
- package/src/lib/actions/messaging/send-video-manual.js.map +1 -0
- package/src/lib/actions/messaging/send-video-to-channel.d.ts +6 -0
- package/src/lib/actions/messaging/send-video-to-channel.js +47 -0
- package/src/lib/actions/messaging/send-video-to-channel.js.map +1 -0
- package/src/lib/actions/messaging/send-video-to-contact.d.ts +6 -0
- package/src/lib/actions/messaging/send-video-to-contact.js +47 -0
- package/src/lib/actions/messaging/send-video-to-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-video-to-crm-contact.d.ts +6 -0
- package/src/lib/actions/messaging/send-video-to-crm-contact.js +48 -0
- package/src/lib/actions/messaging/send-video-to-crm-contact.js.map +1 -0
- package/src/lib/actions/messaging/send-video-to-group.d.ts +6 -0
- package/src/lib/actions/messaging/send-video-to-group.js +47 -0
- package/src/lib/actions/messaging/send-video-to-group.js.map +1 -0
- package/src/lib/actions/utility/check-whatsapp.d.ts +4 -0
- package/src/lib/actions/utility/check-whatsapp.js +34 -0
- package/src/lib/actions/utility/check-whatsapp.js.map +1 -0
- package/src/lib/auth.d.ts +1 -0
- package/src/lib/auth.js +39 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +3 -0
- package/src/lib/common/client.js +22 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/poll-job.d.ts +1 -0
- package/src/lib/common/poll-job.js +26 -0
- package/src/lib/common/poll-job.js.map +1 -0
- package/src/lib/common/prepare-file.d.ts +1 -0
- package/src/lib/common/prepare-file.js +16 -0
- package/src/lib/common/prepare-file.js.map +1 -0
- package/src/lib/common/props.d.ts +14 -0
- package/src/lib/common/props.js +257 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/common/recipients.d.ts +29 -0
- package/src/lib/common/recipients.js +52 -0
- package/src/lib/common/recipients.js.map +1 -0
- package/src/lib/common/types.d.ts +17 -0
- package/src/lib/common/types.js +22 -0
- package/src/lib/common/types.js.map +1 -0
- package/src/lib/triggers/watch-channel-messages.d.ts +10 -0
- package/src/lib/triggers/watch-channel-messages.js +56 -0
- package/src/lib/triggers/watch-channel-messages.js.map +1 -0
- package/src/lib/triggers/watch-group-messages.d.ts +10 -0
- package/src/lib/triggers/watch-group-messages.js +64 -0
- package/src/lib/triggers/watch-group-messages.js.map +1 -0
- package/src/lib/triggers/watch-incoming-messages.d.ts +10 -0
- package/src/lib/triggers/watch-incoming-messages.js +62 -0
- package/src/lib/triggers/watch-incoming-messages.js.map +1 -0
- package/src/lib/triggers/watch-specific-channel-messages.d.ts +14 -0
- package/src/lib/triggers/watch-specific-channel-messages.js +58 -0
- package/src/lib/triggers/watch-specific-channel-messages.js.map +1 -0
- package/src/lib/triggers/watch-specific-group-messages.d.ts +14 -0
- package/src/lib/triggers/watch-specific-group-messages.js +66 -0
- package/src/lib/triggers/watch-specific-group-messages.js.map +1 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const sendTextToCrmContactAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
crmContact: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
text: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendTextToCrmContactAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
const recipients_1 = require("../../common/recipients");
|
|
11
|
+
exports.sendTextToCrmContactAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.whatsscaleAuth,
|
|
13
|
+
name: 'whatsscale_send_text_to_crm_contact',
|
|
14
|
+
displayName: 'Send a Message to a CRM Contact',
|
|
15
|
+
description: 'Send a text message to a contact from your WhatsScale CRM',
|
|
16
|
+
props: {
|
|
17
|
+
session: props_1.whatsscaleProps.session,
|
|
18
|
+
crmContact: props_1.whatsscaleProps.crmContact,
|
|
19
|
+
text: pieces_framework_1.Property.LongText({
|
|
20
|
+
displayName: 'Message',
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'The text message to send',
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { session, crmContact, text } = context.propsValue;
|
|
28
|
+
const auth = context.auth.secret_text;
|
|
29
|
+
const body = (0, recipients_1.buildRecipientBody)(recipients_1.RecipientType.CRM_CONTACT, session, crmContact);
|
|
30
|
+
const response = yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/api/sendText', Object.assign(Object.assign({}, body), { text }));
|
|
31
|
+
return response.body;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=send-text-to-crm-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-text-to-crm-contact.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-text-to-crm-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,wDAA4E;AAE/D,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACrD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,qCAAqC;IAC3C,WAAW,EAAE,iCAAiC;IAC9C,WAAW,EAAE,2DAA2D;IACxE,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,UAAU,EAAE,uBAAe,CAAC,UAAU;QACtC,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,0BAA0B;SACxC,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACzD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAEtC,MAAM,IAAI,GAAG,IAAA,+BAAkB,EAC7B,0BAAa,CAAC,WAAW,EACzB,OAAO,EACP,UAAU,CACX,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EACrC,IAAI,EACJ,0BAAU,CAAC,IAAI,EACf,eAAe,kCACV,IAAI,KAAE,IAAI,IAChB,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const sendTextToGroupAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
group: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
text: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendTextToGroupAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
const recipients_1 = require("../../common/recipients");
|
|
11
|
+
exports.sendTextToGroupAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.whatsscaleAuth,
|
|
13
|
+
name: 'whatsscale_send_text_to_group',
|
|
14
|
+
displayName: 'Send a Message to a Group',
|
|
15
|
+
description: 'Send a text message to a WhatsApp group selected from your group list',
|
|
16
|
+
props: {
|
|
17
|
+
session: props_1.whatsscaleProps.session,
|
|
18
|
+
group: props_1.whatsscaleProps.group,
|
|
19
|
+
text: pieces_framework_1.Property.LongText({
|
|
20
|
+
displayName: 'Message',
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'The text message to send',
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { session, group, text } = context.propsValue;
|
|
28
|
+
const auth = context.auth.secret_text;
|
|
29
|
+
const body = (0, recipients_1.buildRecipientBody)(recipients_1.RecipientType.GROUP, session, group);
|
|
30
|
+
const response = yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/api/sendText', Object.assign(Object.assign({}, body), { text }));
|
|
31
|
+
return response.body;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=send-text-to-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-text-to-group.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-text-to-group.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,wDAA4E;AAE/D,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EACT,uEAAuE;IACzE,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,KAAK,EAAE,uBAAe,CAAC,KAAK;QAC5B,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,0BAA0B;SACxC,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACpD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAEtC,MAAM,IAAI,GAAG,IAAA,+BAAkB,EAAC,0BAAa,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YACrE,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EACrC,IAAI,EACJ,0BAAU,CAAC,IAAI,EACf,eAAe,kCACV,IAAI,KAAE,IAAI,IAChB,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChatType } from '../../common/types';
|
|
2
|
+
export declare const sendVideoManualAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
chatType: import("@activepieces/pieces-framework").StaticDropdownProperty<ChatType, true>;
|
|
5
|
+
recipient: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
videoUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendVideoManualAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
const types_1 = require("../../common/types");
|
|
11
|
+
const recipients_1 = require("../../common/recipients");
|
|
12
|
+
const prepare_file_1 = require("../../common/prepare-file");
|
|
13
|
+
const poll_job_1 = require("../../common/poll-job");
|
|
14
|
+
exports.sendVideoManualAction = (0, pieces_framework_1.createAction)({
|
|
15
|
+
auth: auth_1.whatsscaleAuth,
|
|
16
|
+
name: 'whatsscale_send_video_manual',
|
|
17
|
+
displayName: 'Send a Video (Manual Entry)',
|
|
18
|
+
description: 'Send a video by entering a phone number or group ID manually.',
|
|
19
|
+
props: {
|
|
20
|
+
session: props_1.whatsscaleProps.session,
|
|
21
|
+
chatType: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Chat Type',
|
|
23
|
+
description: 'Select whether you are sending to a contact or a group.',
|
|
24
|
+
required: true,
|
|
25
|
+
options: {
|
|
26
|
+
options: [
|
|
27
|
+
{ label: 'Contact', value: types_1.ChatType.CONTACT },
|
|
28
|
+
{ label: 'Group', value: types_1.ChatType.GROUP },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
recipient: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Phone Number / Group ID',
|
|
34
|
+
description: 'Phone number with country code (digits only) or group ID (without suffix).',
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
videoUrl: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'Video URL',
|
|
39
|
+
description: 'Direct URL to the video file.',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
caption: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Caption',
|
|
44
|
+
description: 'Optional caption for the video (max 1024 characters).',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
run(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const { session, chatType, recipient, videoUrl, caption } = context.propsValue;
|
|
51
|
+
const apiKey = context.auth.secret_text;
|
|
52
|
+
const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, videoUrl);
|
|
53
|
+
const recipientBody = (0, recipients_1.buildRecipientBody)(recipients_1.RecipientType.MANUAL, session, recipient, chatType);
|
|
54
|
+
const sendResponse = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendVideo', Object.assign(Object.assign({}, recipientBody), { file: preparedUrl, caption: caption !== null && caption !== void 0 ? caption : '' }));
|
|
55
|
+
const { jobId } = sendResponse.body;
|
|
56
|
+
return yield (0, poll_job_1.pollJob)(apiKey, jobId);
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=send-video-manual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-video-manual.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-video-manual.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,8CAA8C;AAC9C,wDAA4E;AAC5E,4DAAwD;AACxD,oDAAgD;AAEnC,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,+DAA+D;IAC5E,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAQ,CAAC,OAAO,EAAE;oBAC7C,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAQ,CAAC,KAAK,EAAE;iBAC1C;aACF;SACF,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,yBAAyB;YACtC,WAAW,EAAE,4EAA4E;YACzF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC/E,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAExD,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,0BAAa,CAAC,MAAM,EACpB,OAAO,EACP,SAAS,EACT,QAAoB,CACrB,CAAC;YAEF,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,kCAChF,aAAa,KAChB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,IACtB,CAAC;YAEH,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAyB,CAAC;YACzD,OAAO,MAAM,IAAA,kBAAO,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const sendVideoToChannelAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
channel: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
videoUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendVideoToChannelAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
const prepare_file_1 = require("../../common/prepare-file");
|
|
11
|
+
const poll_job_1 = require("../../common/poll-job");
|
|
12
|
+
exports.sendVideoToChannelAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.whatsscaleAuth,
|
|
14
|
+
name: 'whatsscale_send_video_to_channel',
|
|
15
|
+
displayName: 'Send a Video to a Channel',
|
|
16
|
+
description: 'Broadcast a video to a WhatsApp Channel selected from the dropdown.',
|
|
17
|
+
props: {
|
|
18
|
+
session: props_1.whatsscaleProps.session,
|
|
19
|
+
channel: props_1.whatsscaleProps.channel,
|
|
20
|
+
videoUrl: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Video URL',
|
|
22
|
+
description: 'Direct URL to the video file.',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
caption: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Caption',
|
|
27
|
+
description: 'Optional caption for the video (max 1024 characters).',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { session, channel, videoUrl, caption } = context.propsValue;
|
|
34
|
+
const apiKey = context.auth.secret_text;
|
|
35
|
+
const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, videoUrl);
|
|
36
|
+
const sendResponse = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendVideo', {
|
|
37
|
+
session,
|
|
38
|
+
chatId: channel,
|
|
39
|
+
file: preparedUrl,
|
|
40
|
+
caption: caption !== null && caption !== void 0 ? caption : '',
|
|
41
|
+
});
|
|
42
|
+
const { jobId } = sendResponse.body;
|
|
43
|
+
return yield (0, poll_job_1.pollJob)(apiKey, jobId);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=send-video-to-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-video-to-channel.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-video-to-channel.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AACxD,oDAAgD;AAEnC,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,qEAAqE;IAClF,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACnE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAExD,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACrF,OAAO;gBACP,MAAM,EAAE,OAAO;gBACf,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC,CAAC;YAEH,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAyB,CAAC;YACzD,OAAO,MAAM,IAAA,kBAAO,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const sendVideoToContactAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
contact: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
videoUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendVideoToContactAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
const prepare_file_1 = require("../../common/prepare-file");
|
|
11
|
+
const poll_job_1 = require("../../common/poll-job");
|
|
12
|
+
exports.sendVideoToContactAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.whatsscaleAuth,
|
|
14
|
+
name: 'whatsscale_send_video_to_contact',
|
|
15
|
+
displayName: 'Send a Video to a Contact',
|
|
16
|
+
description: 'Send a video to a WhatsApp contact selected from the dropdown.',
|
|
17
|
+
props: {
|
|
18
|
+
session: props_1.whatsscaleProps.session,
|
|
19
|
+
contact: props_1.whatsscaleProps.contact,
|
|
20
|
+
videoUrl: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Video URL',
|
|
22
|
+
description: 'Direct URL to the video file.',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
caption: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Caption',
|
|
27
|
+
description: 'Optional caption for the video (max 1024 characters).',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { session, contact, videoUrl, caption } = context.propsValue;
|
|
34
|
+
const apiKey = context.auth.secret_text;
|
|
35
|
+
const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, videoUrl);
|
|
36
|
+
const sendResponse = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendVideo', {
|
|
37
|
+
session,
|
|
38
|
+
chatId: contact,
|
|
39
|
+
file: preparedUrl,
|
|
40
|
+
caption: caption !== null && caption !== void 0 ? caption : '',
|
|
41
|
+
});
|
|
42
|
+
const { jobId } = sendResponse.body;
|
|
43
|
+
return yield (0, poll_job_1.pollJob)(apiKey, jobId);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=send-video-to-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-video-to-contact.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-video-to-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AACxD,oDAAgD;AAEnC,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,gEAAgE;IAC7E,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACnE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAExD,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACrF,OAAO;gBACP,MAAM,EAAE,OAAO;gBACf,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC,CAAC;YAEH,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAyB,CAAC;YACzD,OAAO,MAAM,IAAA,kBAAO,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const sendVideoToCrmContactAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
crmContact: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
videoUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendVideoToCrmContactAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
const prepare_file_1 = require("../../common/prepare-file");
|
|
11
|
+
const poll_job_1 = require("../../common/poll-job");
|
|
12
|
+
exports.sendVideoToCrmContactAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.whatsscaleAuth,
|
|
14
|
+
name: 'whatsscale_send_video_to_crm_contact',
|
|
15
|
+
displayName: 'Send a Video to a CRM Contact',
|
|
16
|
+
description: 'Send a video to a WhatsScale CRM contact selected from the dropdown.',
|
|
17
|
+
props: {
|
|
18
|
+
session: props_1.whatsscaleProps.session,
|
|
19
|
+
crmContact: props_1.whatsscaleProps.crmContact,
|
|
20
|
+
videoUrl: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Video URL',
|
|
22
|
+
description: 'Direct URL to the video file.',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
caption: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Caption',
|
|
27
|
+
description: 'Optional caption for the video (max 1024 characters).',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { session, crmContact, videoUrl, caption } = context.propsValue;
|
|
34
|
+
const apiKey = context.auth.secret_text;
|
|
35
|
+
const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, videoUrl);
|
|
36
|
+
const sendResponse = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendVideo', {
|
|
37
|
+
session,
|
|
38
|
+
contact_type: 'crm_contact',
|
|
39
|
+
crm_contact_id: crmContact,
|
|
40
|
+
file: preparedUrl,
|
|
41
|
+
caption: caption !== null && caption !== void 0 ? caption : '',
|
|
42
|
+
});
|
|
43
|
+
const { jobId } = sendResponse.body;
|
|
44
|
+
return yield (0, poll_job_1.pollJob)(apiKey, jobId);
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=send-video-to-crm-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-video-to-crm-contact.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-video-to-crm-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AACxD,oDAAgD;AAEnC,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,sCAAsC;IAC5C,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EAAE,sEAAsE;IACnF,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,UAAU,EAAE,uBAAe,CAAC,UAAU;QACtC,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACtE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAExD,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACrF,OAAO;gBACP,YAAY,EAAE,aAAa;gBAC3B,cAAc,EAAE,UAAU;gBAC1B,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC,CAAC;YAEH,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAyB,CAAC;YACzD,OAAO,MAAM,IAAA,kBAAO,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const sendVideoToGroupAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
group: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
videoUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendVideoToGroupAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
const prepare_file_1 = require("../../common/prepare-file");
|
|
11
|
+
const poll_job_1 = require("../../common/poll-job");
|
|
12
|
+
exports.sendVideoToGroupAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.whatsscaleAuth,
|
|
14
|
+
name: 'whatsscale_send_video_to_group',
|
|
15
|
+
displayName: 'Send a Video to a Group',
|
|
16
|
+
description: 'Send a video to a WhatsApp group selected from the dropdown.',
|
|
17
|
+
props: {
|
|
18
|
+
session: props_1.whatsscaleProps.session,
|
|
19
|
+
group: props_1.whatsscaleProps.group,
|
|
20
|
+
videoUrl: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Video URL',
|
|
22
|
+
description: 'Direct URL to the video file.',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
caption: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Caption',
|
|
27
|
+
description: 'Optional caption for the video (max 1024 characters).',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { session, group, videoUrl, caption } = context.propsValue;
|
|
34
|
+
const apiKey = context.auth.secret_text;
|
|
35
|
+
const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, videoUrl);
|
|
36
|
+
const sendResponse = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendVideo', {
|
|
37
|
+
session,
|
|
38
|
+
chatId: group,
|
|
39
|
+
file: preparedUrl,
|
|
40
|
+
caption: caption !== null && caption !== void 0 ? caption : '',
|
|
41
|
+
});
|
|
42
|
+
const { jobId } = sendResponse.body;
|
|
43
|
+
return yield (0, poll_job_1.pollJob)(apiKey, jobId);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=send-video-to-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-video-to-group.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-video-to-group.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AACxD,oDAAgD;AAEnC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,8DAA8D;IAC3E,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,KAAK,EAAE,uBAAe,CAAC,KAAK;QAC5B,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACjE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAExD,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACrF,OAAO;gBACP,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC,CAAC;YAEH,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAyB,CAAC;YACzD,OAAO,MAAM,IAAA,kBAAO,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const checkWhatsappAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
phone: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkWhatsappAction = 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 auth_1 = require("../../auth");
|
|
8
|
+
const client_1 = require("../../common/client");
|
|
9
|
+
const props_1 = require("../../common/props");
|
|
10
|
+
exports.checkWhatsappAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.whatsscaleAuth,
|
|
12
|
+
name: 'whatsscale_check_whatsapp',
|
|
13
|
+
displayName: 'Check WhatsApp Number',
|
|
14
|
+
description: 'Check if a phone number has WhatsApp',
|
|
15
|
+
props: {
|
|
16
|
+
session: props_1.whatsscaleProps.session,
|
|
17
|
+
phone: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Phone Number',
|
|
19
|
+
description: 'Phone number with country code (e.g. +31612345678 or 31612345678). Any format accepted.',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const auth = context.auth.secret_text;
|
|
26
|
+
const response = yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/make/checkWhatsapp', {
|
|
27
|
+
session: context.propsValue.session,
|
|
28
|
+
phone: context.propsValue.phone,
|
|
29
|
+
});
|
|
30
|
+
return response.body;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=check-whatsapp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-whatsapp.js","sourceRoot":"","sources":["../../../../../src/lib/actions/utility/check-whatsapp.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AAExC,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,yFAAyF;YACtG,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAEtC,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EACrC,IAAI,EACJ,0BAAU,CAAC,IAAI,EACf,qBAAqB,EACrB;gBACE,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;gBACnC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;aAChC,CACF,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const whatsscaleAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.whatsscaleAuth = 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
|
+
exports.whatsscaleAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
8
|
+
displayName: 'API Key',
|
|
9
|
+
required: true,
|
|
10
|
+
description: `
|
|
11
|
+
To obtain your API key:
|
|
12
|
+
|
|
13
|
+
1. Log in to your WhatsScale account at https://whatsscale.com/dashboard
|
|
14
|
+
2. Navigate to Setting => API Keys section
|
|
15
|
+
3. Create a new API key if you don't have one already
|
|
16
|
+
4. Copy your API key and paste it here
|
|
17
|
+
`,
|
|
18
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
19
|
+
try {
|
|
20
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
21
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
22
|
+
url: 'https://proxy.whatsscale.com/api/auth/test',
|
|
23
|
+
headers: {
|
|
24
|
+
'X-Api-Key': auth,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
valid: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
return {
|
|
33
|
+
valid: false,
|
|
34
|
+
error: 'Invalid API key',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AAExD,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IACjD,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE;;;;;;;GAOZ;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,4CAA4C;gBACjD,OAAO,EAAE;oBACP,WAAW,EAAE,IAAc;iBAC5B;aACF,CAAC,CAAC;YACH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,iBAAiB;aACzB,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { HttpMethod, HttpResponse } from '@activepieces/pieces-common';
|
|
2
|
+
export declare const BASE_URL = "https://proxy.whatsscale.com";
|
|
3
|
+
export declare function whatsscaleClient(auth: string, method: HttpMethod, path: string, body?: Record<string, unknown>, queryParams?: Record<string, string>): Promise<HttpResponse>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASE_URL = void 0;
|
|
4
|
+
exports.whatsscaleClient = whatsscaleClient;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
exports.BASE_URL = 'https://proxy.whatsscale.com';
|
|
8
|
+
function whatsscaleClient(auth, method, path, body, queryParams) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
return pieces_common_1.httpClient.sendRequest({
|
|
11
|
+
method,
|
|
12
|
+
url: `${exports.BASE_URL}${path}`,
|
|
13
|
+
headers: {
|
|
14
|
+
'X-Api-Key': auth,
|
|
15
|
+
'Content-Type': 'application/json',
|
|
16
|
+
},
|
|
17
|
+
body,
|
|
18
|
+
queryParams,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;;AAIA,4CAiBC;;AArBD,+DAAmF;AAEtE,QAAA,QAAQ,GAAG,8BAA8B,CAAC;AAEvD,SAAsB,gBAAgB,CACpC,IAAY,EACZ,MAAkB,EAClB,IAAY,EACZ,IAA8B,EAC9B,WAAoC;;QAEpC,OAAO,0BAAU,CAAC,WAAW,CAAC;YAC5B,MAAM;YACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE;YACzB,OAAO,EAAE;gBACP,WAAW,EAAE,IAAI;gBACjB,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI;YACJ,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function pollJob(apiKey: string, jobId: string): Promise<Record<string, unknown>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pollJob = pollJob;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const POLL_INTERVAL_MS = 3000;
|
|
8
|
+
const MAX_ATTEMPTS = 20;
|
|
9
|
+
function pollJob(apiKey, jobId) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
if (!jobId)
|
|
13
|
+
throw new Error('No jobId returned from API');
|
|
14
|
+
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
15
|
+
const response = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.GET, `/api/status/${jobId}`);
|
|
16
|
+
const body = response.body;
|
|
17
|
+
if (body.status === 'COMPLETED')
|
|
18
|
+
return (_a = body.result) !== null && _a !== void 0 ? _a : body;
|
|
19
|
+
if (body.status === 'FAILED')
|
|
20
|
+
throw new Error((_b = body.error) !== null && _b !== void 0 ? _b : 'Job failed');
|
|
21
|
+
yield new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
22
|
+
}
|
|
23
|
+
throw new Error('Job timed out after 20 attempts');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=poll-job.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll-job.js","sourceRoot":"","sources":["../../../../src/lib/common/poll-job.ts"],"names":[],"mappings":";;AAMA,0BAaC;;AAnBD,+DAAyD;AACzD,qCAA4C;AAE5C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,SAAsB,OAAO,CAAC,MAAc,EAAE,KAAa;;;QACzD,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC1D,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,YAAY,EAAE,OAAO,EAAE,EAAE,CAAC;YACxD,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,GAAG,EAAE,eAAe,KAAK,EAAE,CAAC,CAAC;YACxF,MAAM,IAAI,GAAG,QAAQ,CAAC,IAA4E,CAAC;YAEnG,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW;gBAAE,OAAO,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI,CAAC;YAC5D,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,MAAA,IAAI,CAAC,KAAK,mCAAI,YAAY,CAAC,CAAC;YAE1E,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prepareFile(apiKey: string, fileUrl: string, mediaType?: string): Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareFile = prepareFile;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
function prepareFile(apiKey, fileUrl, mediaType) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const body = { fileUrl };
|
|
10
|
+
if (mediaType)
|
|
11
|
+
body['mediaType'] = mediaType;
|
|
12
|
+
const response = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/make/prepareFile', body);
|
|
13
|
+
return response.body.url;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=prepare-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-file.js","sourceRoot":"","sources":["../../../../src/lib/common/prepare-file.ts"],"names":[],"mappings":";;AAGA,kCAKC;;AARD,+DAAyD;AACzD,qCAA4C;AAE5C,SAAsB,WAAW,CAAC,MAAc,EAAE,OAAe,EAAE,SAAkB;;QACnF,MAAM,IAAI,GAA2B,EAAE,OAAO,EAAE,CAAC;QACjD,IAAI,SAAS;YAAE,IAAI,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;QAC7C,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;QAC5F,OAAQ,QAAQ,CAAC,IAAwB,CAAC,GAAG,CAAC;IAChD,CAAC;CAAA"}
|