@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.
Files changed (121) hide show
  1. package/package.json +17 -0
  2. package/src/index.d.ts +1 -0
  3. package/src/index.js +112 -0
  4. package/src/index.js.map +1 -0
  5. package/src/lib/actions/crm/add-crm-contact-tag.d.ts +4 -0
  6. package/src/lib/actions/crm/add-crm-contact-tag.js +32 -0
  7. package/src/lib/actions/crm/add-crm-contact-tag.js.map +1 -0
  8. package/src/lib/actions/crm/create-crm-contact.d.ts +5 -0
  9. package/src/lib/actions/crm/create-crm-contact.js +45 -0
  10. package/src/lib/actions/crm/create-crm-contact.js.map +1 -0
  11. package/src/lib/actions/crm/delete-crm-contact.d.ts +3 -0
  12. package/src/lib/actions/crm/delete-crm-contact.js +27 -0
  13. package/src/lib/actions/crm/delete-crm-contact.js.map +1 -0
  14. package/src/lib/actions/crm/find-crm-contact-by-phone.d.ts +3 -0
  15. package/src/lib/actions/crm/find-crm-contact-by-phone.js +30 -0
  16. package/src/lib/actions/crm/find-crm-contact-by-phone.js.map +1 -0
  17. package/src/lib/actions/crm/get-crm-contact.d.ts +3 -0
  18. package/src/lib/actions/crm/get-crm-contact.js +27 -0
  19. package/src/lib/actions/crm/get-crm-contact.js.map +1 -0
  20. package/src/lib/actions/crm/list-crm-contacts.d.ts +6 -0
  21. package/src/lib/actions/crm/list-crm-contacts.js +86 -0
  22. package/src/lib/actions/crm/list-crm-contacts.js.map +1 -0
  23. package/src/lib/actions/crm/remove-crm-contact-tag.d.ts +4 -0
  24. package/src/lib/actions/crm/remove-crm-contact-tag.js +29 -0
  25. package/src/lib/actions/crm/remove-crm-contact-tag.js.map +1 -0
  26. package/src/lib/actions/crm/update-crm-contact.d.ts +5 -0
  27. package/src/lib/actions/crm/update-crm-contact.js +42 -0
  28. package/src/lib/actions/crm/update-crm-contact.js.map +1 -0
  29. package/src/lib/actions/messaging/send-document-to-contact.d.ts +7 -0
  30. package/src/lib/actions/messaging/send-document-to-contact.js +55 -0
  31. package/src/lib/actions/messaging/send-document-to-contact.js.map +1 -0
  32. package/src/lib/actions/messaging/send-document-to-crm-contact.d.ts +7 -0
  33. package/src/lib/actions/messaging/send-document-to-crm-contact.js +56 -0
  34. package/src/lib/actions/messaging/send-document-to-crm-contact.js.map +1 -0
  35. package/src/lib/actions/messaging/send-document-to-group.d.ts +7 -0
  36. package/src/lib/actions/messaging/send-document-to-group.js +55 -0
  37. package/src/lib/actions/messaging/send-document-to-group.js.map +1 -0
  38. package/src/lib/actions/messaging/send-image-manual.d.ts +8 -0
  39. package/src/lib/actions/messaging/send-image-manual.js +58 -0
  40. package/src/lib/actions/messaging/send-image-manual.js.map +1 -0
  41. package/src/lib/actions/messaging/send-image-to-channel.d.ts +6 -0
  42. package/src/lib/actions/messaging/send-image-to-channel.js +45 -0
  43. package/src/lib/actions/messaging/send-image-to-channel.js.map +1 -0
  44. package/src/lib/actions/messaging/send-image-to-contact.d.ts +6 -0
  45. package/src/lib/actions/messaging/send-image-to-contact.js +45 -0
  46. package/src/lib/actions/messaging/send-image-to-contact.js.map +1 -0
  47. package/src/lib/actions/messaging/send-image-to-crm-contact.d.ts +6 -0
  48. package/src/lib/actions/messaging/send-image-to-crm-contact.js +46 -0
  49. package/src/lib/actions/messaging/send-image-to-crm-contact.js.map +1 -0
  50. package/src/lib/actions/messaging/send-image-to-group.d.ts +6 -0
  51. package/src/lib/actions/messaging/send-image-to-group.js +45 -0
  52. package/src/lib/actions/messaging/send-image-to-group.js.map +1 -0
  53. package/src/lib/actions/messaging/send-text-manual.d.ts +7 -0
  54. package/src/lib/actions/messaging/send-text-manual.js +51 -0
  55. package/src/lib/actions/messaging/send-text-manual.js.map +1 -0
  56. package/src/lib/actions/messaging/send-text-to-channel.d.ts +5 -0
  57. package/src/lib/actions/messaging/send-text-to-channel.js +35 -0
  58. package/src/lib/actions/messaging/send-text-to-channel.js.map +1 -0
  59. package/src/lib/actions/messaging/send-text-to-contact.d.ts +5 -0
  60. package/src/lib/actions/messaging/send-text-to-contact.js +35 -0
  61. package/src/lib/actions/messaging/send-text-to-contact.js.map +1 -0
  62. package/src/lib/actions/messaging/send-text-to-crm-contact.d.ts +5 -0
  63. package/src/lib/actions/messaging/send-text-to-crm-contact.js +35 -0
  64. package/src/lib/actions/messaging/send-text-to-crm-contact.js.map +1 -0
  65. package/src/lib/actions/messaging/send-text-to-group.d.ts +5 -0
  66. package/src/lib/actions/messaging/send-text-to-group.js +35 -0
  67. package/src/lib/actions/messaging/send-text-to-group.js.map +1 -0
  68. package/src/lib/actions/messaging/send-video-manual.d.ts +8 -0
  69. package/src/lib/actions/messaging/send-video-manual.js +60 -0
  70. package/src/lib/actions/messaging/send-video-manual.js.map +1 -0
  71. package/src/lib/actions/messaging/send-video-to-channel.d.ts +6 -0
  72. package/src/lib/actions/messaging/send-video-to-channel.js +47 -0
  73. package/src/lib/actions/messaging/send-video-to-channel.js.map +1 -0
  74. package/src/lib/actions/messaging/send-video-to-contact.d.ts +6 -0
  75. package/src/lib/actions/messaging/send-video-to-contact.js +47 -0
  76. package/src/lib/actions/messaging/send-video-to-contact.js.map +1 -0
  77. package/src/lib/actions/messaging/send-video-to-crm-contact.d.ts +6 -0
  78. package/src/lib/actions/messaging/send-video-to-crm-contact.js +48 -0
  79. package/src/lib/actions/messaging/send-video-to-crm-contact.js.map +1 -0
  80. package/src/lib/actions/messaging/send-video-to-group.d.ts +6 -0
  81. package/src/lib/actions/messaging/send-video-to-group.js +47 -0
  82. package/src/lib/actions/messaging/send-video-to-group.js.map +1 -0
  83. package/src/lib/actions/utility/check-whatsapp.d.ts +4 -0
  84. package/src/lib/actions/utility/check-whatsapp.js +34 -0
  85. package/src/lib/actions/utility/check-whatsapp.js.map +1 -0
  86. package/src/lib/auth.d.ts +1 -0
  87. package/src/lib/auth.js +39 -0
  88. package/src/lib/auth.js.map +1 -0
  89. package/src/lib/common/client.d.ts +3 -0
  90. package/src/lib/common/client.js +22 -0
  91. package/src/lib/common/client.js.map +1 -0
  92. package/src/lib/common/poll-job.d.ts +1 -0
  93. package/src/lib/common/poll-job.js +26 -0
  94. package/src/lib/common/poll-job.js.map +1 -0
  95. package/src/lib/common/prepare-file.d.ts +1 -0
  96. package/src/lib/common/prepare-file.js +16 -0
  97. package/src/lib/common/prepare-file.js.map +1 -0
  98. package/src/lib/common/props.d.ts +14 -0
  99. package/src/lib/common/props.js +257 -0
  100. package/src/lib/common/props.js.map +1 -0
  101. package/src/lib/common/recipients.d.ts +29 -0
  102. package/src/lib/common/recipients.js +52 -0
  103. package/src/lib/common/recipients.js.map +1 -0
  104. package/src/lib/common/types.d.ts +17 -0
  105. package/src/lib/common/types.js +22 -0
  106. package/src/lib/common/types.js.map +1 -0
  107. package/src/lib/triggers/watch-channel-messages.d.ts +10 -0
  108. package/src/lib/triggers/watch-channel-messages.js +56 -0
  109. package/src/lib/triggers/watch-channel-messages.js.map +1 -0
  110. package/src/lib/triggers/watch-group-messages.d.ts +10 -0
  111. package/src/lib/triggers/watch-group-messages.js +64 -0
  112. package/src/lib/triggers/watch-group-messages.js.map +1 -0
  113. package/src/lib/triggers/watch-incoming-messages.d.ts +10 -0
  114. package/src/lib/triggers/watch-incoming-messages.js +62 -0
  115. package/src/lib/triggers/watch-incoming-messages.js.map +1 -0
  116. package/src/lib/triggers/watch-specific-channel-messages.d.ts +14 -0
  117. package/src/lib/triggers/watch-specific-channel-messages.js +58 -0
  118. package/src/lib/triggers/watch-specific-channel-messages.js.map +1 -0
  119. package/src/lib/triggers/watch-specific-group-messages.d.ts +14 -0
  120. package/src/lib/triggers/watch-specific-group-messages.js +66 -0
  121. package/src/lib/triggers/watch-specific-group-messages.js.map +1 -0
@@ -0,0 +1,7 @@
1
+ export declare const sendDocumentToCrmContactAction: 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
+ documentUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ filename: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ }>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendDocumentToCrmContactAction = 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.sendDocumentToCrmContactAction = (0, pieces_framework_1.createAction)({
13
+ auth: auth_1.whatsscaleAuth,
14
+ name: 'whatsscale_send_document_to_crm_contact',
15
+ displayName: 'Send a Document to a CRM Contact',
16
+ description: 'Send a document to a WhatsScale CRM contact selected from the dropdown.',
17
+ props: {
18
+ session: props_1.whatsscaleProps.session,
19
+ crmContact: props_1.whatsscaleProps.crmContact,
20
+ documentUrl: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Document URL',
22
+ description: 'Direct URL to the document file.',
23
+ required: true,
24
+ }),
25
+ filename: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Filename',
27
+ description: 'Optional filename shown in WhatsApp (e.g. report.pdf). Auto-detected from URL if not provided.',
28
+ required: false,
29
+ }),
30
+ caption: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Caption',
32
+ description: 'Optional caption for the document (max 1024 characters).',
33
+ required: false,
34
+ }),
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const { session, crmContact, documentUrl, filename, caption } = context.propsValue;
39
+ const apiKey = context.auth.secret_text;
40
+ const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, documentUrl, 'document');
41
+ const body = {
42
+ session,
43
+ contact_type: 'crm_contact',
44
+ crm_contact_id: crmContact,
45
+ file: preparedUrl,
46
+ caption: caption !== null && caption !== void 0 ? caption : '',
47
+ };
48
+ if (filename)
49
+ body['filename'] = filename;
50
+ const sendResponse = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendDocument', body);
51
+ const { jobId } = sendResponse.body;
52
+ return yield (0, poll_job_1.pollJob)(apiKey, jobId);
53
+ });
54
+ },
55
+ });
56
+ //# sourceMappingURL=send-document-to-crm-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-document-to-crm-contact.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-document-to-crm-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AACxD,oDAAgD;AAEnC,QAAA,8BAA8B,GAAG,IAAA,+BAAY,EAAC;IACzD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,yCAAyC;IAC/C,WAAW,EAAE,kCAAkC;IAC/C,WAAW,EAAE,yEAAyE;IACtF,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,UAAU,EAAE,uBAAe,CAAC,UAAU;QACtC,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,gGAAgG;YAC7G,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACnF,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;YAEvE,MAAM,IAAI,GAA4B;gBACpC,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;YACF,IAAI,QAAQ;gBAAE,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAE1C,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;YAChG,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,7 @@
1
+ export declare const sendDocumentToGroupAction: 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
+ documentUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ filename: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ }>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendDocumentToGroupAction = 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.sendDocumentToGroupAction = (0, pieces_framework_1.createAction)({
13
+ auth: auth_1.whatsscaleAuth,
14
+ name: 'whatsscale_send_document_to_group',
15
+ displayName: 'Send a Document to a Group',
16
+ description: 'Send a document to a WhatsApp group selected from the dropdown.',
17
+ props: {
18
+ session: props_1.whatsscaleProps.session,
19
+ group: props_1.whatsscaleProps.group,
20
+ documentUrl: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Document URL',
22
+ description: 'Direct URL to the document file.',
23
+ required: true,
24
+ }),
25
+ filename: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Filename',
27
+ description: 'Optional filename shown in WhatsApp (e.g. report.pdf). Auto-detected from URL if not provided.',
28
+ required: false,
29
+ }),
30
+ caption: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Caption',
32
+ description: 'Optional caption for the document (max 1024 characters).',
33
+ required: false,
34
+ }),
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const { session, group, documentUrl, filename, caption } = context.propsValue;
39
+ const apiKey = context.auth.secret_text;
40
+ const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, documentUrl, 'document');
41
+ const body = {
42
+ session,
43
+ chatId: group,
44
+ file: preparedUrl,
45
+ caption: caption !== null && caption !== void 0 ? caption : '',
46
+ };
47
+ if (filename)
48
+ body['filename'] = filename;
49
+ const sendResponse = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendDocument', body);
50
+ const { jobId } = sendResponse.body;
51
+ return yield (0, poll_job_1.pollJob)(apiKey, jobId);
52
+ });
53
+ },
54
+ });
55
+ //# sourceMappingURL=send-document-to-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-document-to-group.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-document-to-group.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AACxD,oDAAgD;AAEnC,QAAA,yBAAyB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EAAE,iEAAiE;IAC9E,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,KAAK,EAAE,uBAAe,CAAC,KAAK;QAC5B,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,gGAAgG;YAC7G,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAExC,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;YAEvE,MAAM,IAAI,GAA4B;gBACpC,OAAO;gBACP,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC;YACF,IAAI,QAAQ;gBAAE,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAE1C,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;YAChG,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,8 @@
1
+ import { ChatType } from '../../common/types';
2
+ export declare const sendImageManualAction: 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
+ imageUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ }>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendImageManualAction = 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
+ exports.sendImageManualAction = (0, pieces_framework_1.createAction)({
14
+ auth: auth_1.whatsscaleAuth,
15
+ name: 'whatsscale_send_image_manual',
16
+ displayName: 'Send an Image (Manual Entry)',
17
+ description: 'Send an image by entering a phone number or group ID manually.',
18
+ props: {
19
+ session: props_1.whatsscaleProps.session,
20
+ chatType: pieces_framework_1.Property.StaticDropdown({
21
+ displayName: 'Chat Type',
22
+ description: 'Select whether you are sending to a contact or a group.',
23
+ required: true,
24
+ options: {
25
+ options: [
26
+ { label: 'Contact', value: types_1.ChatType.CONTACT },
27
+ { label: 'Group', value: types_1.ChatType.GROUP },
28
+ ],
29
+ },
30
+ }),
31
+ recipient: pieces_framework_1.Property.ShortText({
32
+ displayName: 'Phone Number / Group ID',
33
+ description: 'Phone number with country code (digits only) or group ID (without suffix).',
34
+ required: true,
35
+ }),
36
+ imageUrl: pieces_framework_1.Property.ShortText({
37
+ displayName: 'Image URL',
38
+ description: 'Direct URL to the image file.',
39
+ required: true,
40
+ }),
41
+ caption: pieces_framework_1.Property.ShortText({
42
+ displayName: 'Caption',
43
+ description: 'Optional caption for the image (max 1024 characters).',
44
+ required: false,
45
+ }),
46
+ },
47
+ run(context) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ const { session, chatType, recipient, imageUrl, caption } = context.propsValue;
50
+ const apiKey = context.auth.secret_text;
51
+ const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, imageUrl);
52
+ const recipientBody = (0, recipients_1.buildRecipientBody)(recipients_1.RecipientType.MANUAL, session, recipient, chatType);
53
+ const response = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendImage', Object.assign(Object.assign({}, recipientBody), { file: preparedUrl, caption: caption !== null && caption !== void 0 ? caption : '' }));
54
+ return response.body;
55
+ });
56
+ },
57
+ });
58
+ //# sourceMappingURL=send-image-manual.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-image-manual.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-image-manual.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,8CAA8C;AAC9C,wDAA4E;AAC5E,4DAAwD;AAE3C,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,8BAA8B;IAC3C,WAAW,EAAE,gEAAgE;IAC7E,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,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,kCAC5E,aAAa,KAChB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,IACtB,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const sendImageToChannelAction: 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
+ imageUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ }>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendImageToChannelAction = 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
+ exports.sendImageToChannelAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.whatsscaleAuth,
13
+ name: 'whatsscale_send_image_to_channel',
14
+ displayName: 'Send an Image to a Channel',
15
+ description: 'Broadcast an image to a WhatsApp Channel selected from the dropdown.',
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ channel: props_1.whatsscaleProps.channel,
19
+ imageUrl: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Image URL',
21
+ description: 'Direct URL to the image file.',
22
+ required: true,
23
+ }),
24
+ caption: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Caption',
26
+ description: 'Optional caption for the image (max 1024 characters).',
27
+ required: false,
28
+ }),
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const { session, channel, imageUrl, caption } = context.propsValue;
33
+ const apiKey = context.auth.secret_text;
34
+ const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, imageUrl);
35
+ const response = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendImage', {
36
+ session,
37
+ chatId: channel,
38
+ file: preparedUrl,
39
+ caption: caption !== null && caption !== void 0 ? caption : '',
40
+ });
41
+ return response.body;
42
+ });
43
+ },
44
+ });
45
+ //# sourceMappingURL=send-image-to-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-image-to-channel.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-image-to-channel.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AAE3C,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EAAE,sEAAsE;IACnF,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,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACjF,OAAO;gBACP,MAAM,EAAE,OAAO;gBACf,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const sendImageToContactAction: 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
+ imageUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ }>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendImageToContactAction = 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
+ exports.sendImageToContactAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.whatsscaleAuth,
13
+ name: 'whatsscale_send_image_to_contact',
14
+ displayName: 'Send an Image to a Contact',
15
+ description: 'Send an image to a WhatsApp contact selected from the dropdown.',
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ contact: props_1.whatsscaleProps.contact,
19
+ imageUrl: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Image URL',
21
+ description: 'Direct URL to the image file.',
22
+ required: true,
23
+ }),
24
+ caption: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Caption',
26
+ description: 'Optional caption for the image (max 1024 characters).',
27
+ required: false,
28
+ }),
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const { session, contact, imageUrl, caption } = context.propsValue;
33
+ const apiKey = context.auth.secret_text;
34
+ const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, imageUrl);
35
+ const response = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendImage', {
36
+ session,
37
+ chatId: contact,
38
+ file: preparedUrl,
39
+ caption: caption !== null && caption !== void 0 ? caption : '',
40
+ });
41
+ return response.body;
42
+ });
43
+ },
44
+ });
45
+ //# sourceMappingURL=send-image-to-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-image-to-contact.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-image-to-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AAE3C,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EAAE,iEAAiE;IAC9E,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,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACjF,OAAO;gBACP,MAAM,EAAE,OAAO;gBACf,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const sendImageToCrmContactAction: 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
+ imageUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ }>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendImageToCrmContactAction = 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
+ exports.sendImageToCrmContactAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.whatsscaleAuth,
13
+ name: 'whatsscale_send_image_to_crm_contact',
14
+ displayName: 'Send an Image to a CRM Contact',
15
+ description: 'Send an image to a WhatsScale CRM contact selected from the dropdown.',
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ crmContact: props_1.whatsscaleProps.crmContact,
19
+ imageUrl: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Image URL',
21
+ description: 'Direct URL to the image file.',
22
+ required: true,
23
+ }),
24
+ caption: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Caption',
26
+ description: 'Optional caption for the image (max 1024 characters).',
27
+ required: false,
28
+ }),
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const { session, crmContact, imageUrl, caption } = context.propsValue;
33
+ const apiKey = context.auth.secret_text;
34
+ const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, imageUrl);
35
+ const response = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendImage', {
36
+ session,
37
+ contact_type: 'crm_contact',
38
+ crm_contact_id: crmContact,
39
+ file: preparedUrl,
40
+ caption: caption !== null && caption !== void 0 ? caption : '',
41
+ });
42
+ return response.body;
43
+ });
44
+ },
45
+ });
46
+ //# sourceMappingURL=send-image-to-crm-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-image-to-crm-contact.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-image-to-crm-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AAE3C,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,sCAAsC;IAC5C,WAAW,EAAE,gCAAgC;IAC7C,WAAW,EAAE,uEAAuE;IACpF,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,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACjF,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,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const sendImageToGroupAction: 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
+ imageUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ caption: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ }>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendImageToGroupAction = 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
+ exports.sendImageToGroupAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.whatsscaleAuth,
13
+ name: 'whatsscale_send_image_to_group',
14
+ displayName: 'Send an Image to a Group',
15
+ description: 'Send an image to a WhatsApp group selected from the dropdown.',
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ group: props_1.whatsscaleProps.group,
19
+ imageUrl: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Image URL',
21
+ description: 'Direct URL to the image file.',
22
+ required: true,
23
+ }),
24
+ caption: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Caption',
26
+ description: 'Optional caption for the image (max 1024 characters).',
27
+ required: false,
28
+ }),
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const { session, group, imageUrl, caption } = context.propsValue;
33
+ const apiKey = context.auth.secret_text;
34
+ const preparedUrl = yield (0, prepare_file_1.prepareFile)(apiKey, imageUrl);
35
+ const response = yield (0, client_1.whatsscaleClient)(apiKey, pieces_common_1.HttpMethod.POST, '/api/sendImage', {
36
+ session,
37
+ chatId: group,
38
+ file: preparedUrl,
39
+ caption: caption !== null && caption !== void 0 ? caption : '',
40
+ });
41
+ return response.body;
42
+ });
43
+ },
44
+ });
45
+ //# sourceMappingURL=send-image-to-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-image-to-group.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-image-to-group.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,4DAAwD;AAE3C,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,+DAA+D;IAC5E,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,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC,MAAM,EAAE,0BAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE;gBACjF,OAAO;gBACP,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;aACvB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ChatType } from '../../common/types';
2
+ export declare const sendTextManualAction: 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
+ text: import("@activepieces/pieces-framework").LongTextProperty<true>;
7
+ }>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendTextManualAction = 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
+ const types_1 = require("../../common/types");
12
+ exports.sendTextManualAction = (0, pieces_framework_1.createAction)({
13
+ auth: auth_1.whatsscaleAuth,
14
+ name: 'whatsscale_send_text_manual',
15
+ displayName: 'Send a Message (Manual Entry)',
16
+ description: 'Send a text message by entering a phone number or group ID manually',
17
+ props: {
18
+ session: props_1.whatsscaleProps.session,
19
+ chatType: pieces_framework_1.Property.StaticDropdown({
20
+ displayName: 'Send To',
21
+ required: true,
22
+ options: {
23
+ disabled: false,
24
+ options: [
25
+ { label: 'Contact (Phone Number)', value: types_1.ChatType.CONTACT },
26
+ { label: 'Group', value: types_1.ChatType.GROUP },
27
+ ],
28
+ },
29
+ }),
30
+ recipient: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Phone Number or Group ID',
32
+ required: true,
33
+ description: 'For contacts: phone number with country code (e.g., +31649931832). For groups: group ID (e.g., 120363318673245672)',
34
+ }),
35
+ text: pieces_framework_1.Property.LongText({
36
+ displayName: 'Message',
37
+ required: true,
38
+ description: 'The text message to send',
39
+ }),
40
+ },
41
+ run(context) {
42
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
+ const { session, chatType, recipient, text } = context.propsValue;
44
+ const auth = context.auth.secret_text;
45
+ const body = (0, recipients_1.buildRecipientBody)(recipients_1.RecipientType.MANUAL, session, recipient, chatType);
46
+ const response = yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/api/sendText', Object.assign(Object.assign({}, body), { text }));
47
+ return response.body;
48
+ });
49
+ },
50
+ });
51
+ //# sourceMappingURL=send-text-manual.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-text-manual.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-text-manual.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,wDAA4E;AAC5E,8CAA8C;AAEjC,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EACT,qEAAqE;IACvE,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,gBAAQ,CAAC,OAAO,EAAE;oBAC5D,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,0BAA0B;YACvC,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,oHAAoH;SACvH,CAAC;QACF,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,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAClE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAEtC,MAAM,IAAI,GAAG,IAAA,+BAAkB,EAC7B,0BAAa,CAAC,MAAM,EACpB,OAAO,EACP,SAAS,EACT,QAAoB,CACrB,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 sendTextToChannelAction: 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
+ text: import("@activepieces/pieces-framework").LongTextProperty<true>;
5
+ }>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendTextToChannelAction = 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.sendTextToChannelAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.whatsscaleAuth,
13
+ name: 'whatsscale_send_text_to_channel',
14
+ displayName: 'Send a Text to a Channel',
15
+ description: 'Send a text message to a WhatsApp Channel',
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ channel: props_1.whatsscaleProps.channel,
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, channel, text } = context.propsValue;
28
+ const auth = context.auth.secret_text;
29
+ const body = (0, recipients_1.buildRecipientBody)(recipients_1.RecipientType.CHANNEL, session, channel);
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-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-text-to-channel.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-text-to-channel.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,wDAA4E;AAE/D,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,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,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACtD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAEtC,MAAM,IAAI,GAAG,IAAA,+BAAkB,EAAC,0BAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACzE,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 sendTextToContactAction: 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
+ text: import("@activepieces/pieces-framework").LongTextProperty<true>;
5
+ }>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendTextToContactAction = 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.sendTextToContactAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.whatsscaleAuth,
13
+ name: 'whatsscale_send_text_to_contact',
14
+ displayName: 'Send a Message to a Contact',
15
+ description: 'Send a text message to a WhatsApp contact selected from your contact list',
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ contact: props_1.whatsscaleProps.contact,
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, contact, text } = context.propsValue;
28
+ const auth = context.auth.secret_text;
29
+ const body = (0, recipients_1.buildRecipientBody)(recipients_1.RecipientType.CONTACT, session, contact);
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-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-text-to-contact.js","sourceRoot":"","sources":["../../../../../src/lib/actions/messaging/send-text-to-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,qCAA4C;AAC5C,gDAAuD;AACvD,8CAAqD;AACrD,wDAA4E;AAE/D,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EACT,2EAA2E;IAC7E,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,OAAO,EAAE,uBAAe,CAAC,OAAO;QAChC,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,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACtD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YAEtC,MAAM,IAAI,GAAG,IAAA,+BAAkB,EAAC,0BAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACzE,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"}