@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,14 @@
1
+ /**
2
+ * Reusable dropdown props shared across actions.
3
+ *
4
+ * Sprint 1: session only.
5
+ * Sprint 2: contact, group, channel, crmContact, crmTag added.
6
+ */
7
+ export declare const whatsscaleProps: {
8
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
9
+ contact: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
10
+ group: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
11
+ channel: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
12
+ crmContact: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
13
+ crmTag: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
14
+ };
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.whatsscaleProps = 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("./client");
9
+ /**
10
+ * Reusable dropdown props shared across actions.
11
+ *
12
+ * Sprint 1: session only.
13
+ * Sprint 2: contact, group, channel, crmContact, crmTag added.
14
+ */
15
+ exports.whatsscaleProps = {
16
+ session: pieces_framework_1.Property.Dropdown({
17
+ auth: auth_1.whatsscaleAuth,
18
+ displayName: 'WhatsApp Session',
19
+ required: true,
20
+ refreshers: [],
21
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
22
+ if (!auth) {
23
+ return {
24
+ disabled: true,
25
+ options: [],
26
+ placeholder: 'Please connect your account',
27
+ };
28
+ }
29
+ try {
30
+ const response = yield (0, client_1.whatsscaleClient)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/make/sessions');
31
+ const sessions = response.body;
32
+ if (!sessions || sessions.length === 0) {
33
+ return {
34
+ disabled: true,
35
+ options: [],
36
+ placeholder: 'No sessions found. Connect WhatsApp at whatsscale.com',
37
+ };
38
+ }
39
+ return {
40
+ disabled: false,
41
+ options: sessions,
42
+ };
43
+ }
44
+ catch (e) {
45
+ console.debug(e);
46
+ return {
47
+ disabled: true,
48
+ options: [],
49
+ placeholder: 'Error loading sessions',
50
+ };
51
+ }
52
+ }),
53
+ }),
54
+ contact: pieces_framework_1.Property.Dropdown({
55
+ auth: auth_1.whatsscaleAuth,
56
+ displayName: 'Contact',
57
+ required: true,
58
+ refreshers: ['session'],
59
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, session }) {
60
+ if (!auth) {
61
+ return {
62
+ disabled: true,
63
+ options: [],
64
+ placeholder: 'Please connect your account',
65
+ };
66
+ }
67
+ if (!session) {
68
+ return {
69
+ disabled: true,
70
+ options: [],
71
+ placeholder: 'Please select a session first',
72
+ };
73
+ }
74
+ try {
75
+ const response = yield (0, client_1.whatsscaleClient)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/make/contacts', undefined, { session: session });
76
+ const contacts = response.body;
77
+ if (!contacts || contacts.length === 0) {
78
+ return {
79
+ disabled: true,
80
+ options: [],
81
+ placeholder: 'No contacts found',
82
+ };
83
+ }
84
+ return { disabled: false, options: contacts };
85
+ }
86
+ catch (e) {
87
+ console.debug(e);
88
+ return {
89
+ disabled: true,
90
+ options: [],
91
+ placeholder: 'Error loading contacts',
92
+ };
93
+ }
94
+ }),
95
+ }),
96
+ group: pieces_framework_1.Property.Dropdown({
97
+ auth: auth_1.whatsscaleAuth,
98
+ displayName: 'Group',
99
+ required: true,
100
+ refreshers: ['session'],
101
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, session }) {
102
+ if (!auth) {
103
+ return {
104
+ disabled: true,
105
+ options: [],
106
+ placeholder: 'Please connect your account',
107
+ };
108
+ }
109
+ if (!session) {
110
+ return {
111
+ disabled: true,
112
+ options: [],
113
+ placeholder: 'Please select a session first',
114
+ };
115
+ }
116
+ try {
117
+ const response = yield (0, client_1.whatsscaleClient)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/make/groups', undefined, { session: session });
118
+ const groups = response.body;
119
+ if (!groups || groups.length === 0) {
120
+ return {
121
+ disabled: true,
122
+ options: [],
123
+ placeholder: 'No groups found',
124
+ };
125
+ }
126
+ return { disabled: false, options: groups };
127
+ }
128
+ catch (e) {
129
+ console.debug(e);
130
+ return {
131
+ disabled: true,
132
+ options: [],
133
+ placeholder: 'Error loading groups',
134
+ };
135
+ }
136
+ }),
137
+ }),
138
+ channel: pieces_framework_1.Property.Dropdown({
139
+ auth: auth_1.whatsscaleAuth,
140
+ displayName: 'Channel',
141
+ required: true,
142
+ refreshers: ['session'],
143
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, session }) {
144
+ if (!auth) {
145
+ return {
146
+ disabled: true,
147
+ options: [],
148
+ placeholder: 'Please connect your account',
149
+ };
150
+ }
151
+ if (!session) {
152
+ return {
153
+ disabled: true,
154
+ options: [],
155
+ placeholder: 'Please select a session first',
156
+ };
157
+ }
158
+ try {
159
+ const response = yield (0, client_1.whatsscaleClient)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/make/channels', undefined, { session: session });
160
+ const channels = response.body;
161
+ if (!channels || channels.length === 0) {
162
+ return {
163
+ disabled: true,
164
+ options: [],
165
+ placeholder: 'No channels found',
166
+ };
167
+ }
168
+ return { disabled: false, options: channels };
169
+ }
170
+ catch (e) {
171
+ console.debug(e);
172
+ return {
173
+ disabled: true,
174
+ options: [],
175
+ placeholder: 'Error loading channels',
176
+ };
177
+ }
178
+ }),
179
+ }),
180
+ crmContact: pieces_framework_1.Property.Dropdown({
181
+ auth: auth_1.whatsscaleAuth,
182
+ displayName: 'CRM Contact',
183
+ required: true,
184
+ refreshers: ['auth'],
185
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
186
+ if (!auth) {
187
+ return {
188
+ disabled: true,
189
+ options: [],
190
+ placeholder: 'Please connect your account',
191
+ };
192
+ }
193
+ try {
194
+ const response = yield (0, client_1.whatsscaleClient)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/make/crm/contacts');
195
+ const contacts = response.body;
196
+ if (!contacts || contacts.length === 0) {
197
+ return {
198
+ disabled: true,
199
+ options: [],
200
+ placeholder: 'No CRM contacts found',
201
+ };
202
+ }
203
+ return {
204
+ disabled: false,
205
+ options: contacts.map((contact) => ({
206
+ label: contact.name,
207
+ value: contact.id,
208
+ })),
209
+ };
210
+ }
211
+ catch (e) {
212
+ console.debug(e);
213
+ return {
214
+ disabled: true,
215
+ options: [],
216
+ placeholder: 'Error loading CRM contacts',
217
+ };
218
+ }
219
+ }),
220
+ }),
221
+ crmTag: pieces_framework_1.Property.Dropdown({
222
+ auth: auth_1.whatsscaleAuth,
223
+ displayName: 'Tag',
224
+ required: true,
225
+ refreshers: [],
226
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
227
+ if (!auth) {
228
+ return {
229
+ disabled: true,
230
+ options: [],
231
+ placeholder: 'Please connect your account',
232
+ };
233
+ }
234
+ try {
235
+ const response = yield (0, client_1.whatsscaleClient)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/make/crm/tags');
236
+ const tags = response.body;
237
+ if (!tags || tags.length === 0) {
238
+ return {
239
+ disabled: true,
240
+ options: [],
241
+ placeholder: 'No tags found',
242
+ };
243
+ }
244
+ return { disabled: false, options: tags };
245
+ }
246
+ catch (e) {
247
+ console.debug(e);
248
+ return {
249
+ disabled: true,
250
+ options: [],
251
+ placeholder: 'Error loading tags',
252
+ };
253
+ }
254
+ }),
255
+ }),
256
+ };
257
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAAyE;AACzE,+DAAyD;AACzD,kCAAyC;AACzC,qCAA4C;AAE5C;;;;;GAKG;AACU,QAAA,eAAe,GAAG;IAC7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,EAAE,EAAE;QACd,OAAO,EAAE,KAAiD,EAAE,oDAA5C,EAAE,IAAI,EAAE;YACtB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,6BAA6B;iBAC3C,CAAC;YACJ,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EACrC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,gBAAgB,CACjB,CAAC;gBACF,MAAM,IAAI,GAAG,QAAQ,CAAC,IAA0C,CAAC;gBACjE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC/B,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,eAAe;qBAC7B,CAAC;gBACJ,CAAC;gBACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC5C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,oBAAoB;iBAClC,CAAC;YACJ,CAAC;QACH,CAAC,CAAA;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { ChatType } from './types';
2
+ /**
3
+ * Recipient types for WhatsScale actions.
4
+ *
5
+ * DROPDOWN recipients (Contact, Group, Channel) return pre-formatted
6
+ * chatId values from the proxy RPC endpoints — no suffix needed.
7
+ *
8
+ * MANUAL recipient appends @c.us or @g.us based on ChatType.
9
+ *
10
+ * CRM_CONTACT uses a different body shape entirely — no chatId,
11
+ * instead sends contact_type + crm_contact_id.
12
+ */
13
+ export declare enum RecipientType {
14
+ CONTACT = "contact",
15
+ GROUP = "group",
16
+ CHANNEL = "channel",
17
+ MANUAL = "manual",
18
+ CRM_CONTACT = "crm_contact"
19
+ }
20
+ /**
21
+ * Build the message body for any recipient type.
22
+ *
23
+ * @param type - The recipient type
24
+ * @param session - WhatsApp session ID
25
+ * @param recipientValue - The dropdown value or manual entry
26
+ * @param chatType - Only used for MANUAL type (ChatType.CONTACT or ChatType.GROUP)
27
+ * @returns Object to spread into the API request body
28
+ */
29
+ export declare function buildRecipientBody(type: RecipientType, session: string, recipientValue: string, chatType?: ChatType): Record<string, string>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecipientType = void 0;
4
+ exports.buildRecipientBody = buildRecipientBody;
5
+ const types_1 = require("./types");
6
+ /**
7
+ * Recipient types for WhatsScale actions.
8
+ *
9
+ * DROPDOWN recipients (Contact, Group, Channel) return pre-formatted
10
+ * chatId values from the proxy RPC endpoints — no suffix needed.
11
+ *
12
+ * MANUAL recipient appends @c.us or @g.us based on ChatType.
13
+ *
14
+ * CRM_CONTACT uses a different body shape entirely — no chatId,
15
+ * instead sends contact_type + crm_contact_id.
16
+ */
17
+ var RecipientType;
18
+ (function (RecipientType) {
19
+ RecipientType["CONTACT"] = "contact";
20
+ RecipientType["GROUP"] = "group";
21
+ RecipientType["CHANNEL"] = "channel";
22
+ RecipientType["MANUAL"] = "manual";
23
+ RecipientType["CRM_CONTACT"] = "crm_contact";
24
+ })(RecipientType || (exports.RecipientType = RecipientType = {}));
25
+ /**
26
+ * Build the message body for any recipient type.
27
+ *
28
+ * @param type - The recipient type
29
+ * @param session - WhatsApp session ID
30
+ * @param recipientValue - The dropdown value or manual entry
31
+ * @param chatType - Only used for MANUAL type (ChatType.CONTACT or ChatType.GROUP)
32
+ * @returns Object to spread into the API request body
33
+ */
34
+ function buildRecipientBody(type, session, recipientValue, chatType) {
35
+ const base = { session };
36
+ switch (type) {
37
+ case RecipientType.CONTACT:
38
+ case RecipientType.GROUP:
39
+ case RecipientType.CHANNEL:
40
+ // Dropdown values are pre-formatted (e.g., 31649931832@c.us, xxx@newsletter)
41
+ return Object.assign(Object.assign({}, base), { chatId: recipientValue });
42
+ case RecipientType.MANUAL: {
43
+ const suffix = chatType === types_1.ChatType.CONTACT ? '@c.us' : '@g.us';
44
+ return Object.assign(Object.assign({}, base), { chatId: recipientValue.includes('@') ? recipientValue : recipientValue + suffix });
45
+ }
46
+ case RecipientType.CRM_CONTACT:
47
+ return Object.assign(Object.assign({}, base), { contact_type: 'crm_contact', crm_contact_id: recipientValue });
48
+ default:
49
+ throw new Error(`Unknown recipient type: ${type}`);
50
+ }
51
+ }
52
+ //# sourceMappingURL=recipients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipients.js","sourceRoot":"","sources":["../../../../src/lib/common/recipients.ts"],"names":[],"mappings":";;;AA8BA,gDA8BC;AA5DD,mCAAmC;AAEnC;;;;;;;;;;GAUG;AACH,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;AAC7B,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB;AAED;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAChC,IAAmB,EACnB,OAAe,EACf,cAAsB,EACtB,QAAmB;IAEnB,MAAM,IAAI,GAA2B,EAAE,OAAO,EAAE,CAAC;IAEjD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,aAAa,CAAC,OAAO,CAAC;QAC3B,KAAK,aAAa,CAAC,KAAK,CAAC;QACzB,KAAK,aAAa,CAAC,OAAO;YACxB,6EAA6E;YAC7E,uCAAY,IAAI,KAAE,MAAM,EAAE,cAAc,IAAG;QAE7C,KAAK,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;YAC1B,MAAM,MAAM,GAAG,QAAQ,KAAK,gBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YACjE,uCAAY,IAAI,KAAE,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,GAAG,MAAM,IAAG;QACtG,CAAC;QAED,KAAK,aAAa,CAAC,WAAW;YAC5B,uCACK,IAAI,KACP,YAAY,EAAE,aAAa,EAC3B,cAAc,EAAE,cAAc,IAC9B;QAEJ;YACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Chat type for Manual Entry actions only.
3
+ *
4
+ * Used by the "Send To" static dropdown in manual entry actions
5
+ * to determine the chatId suffix:
6
+ * - CONTACT → appends @c.us
7
+ * - GROUP → appends @g.us
8
+ *
9
+ * Channels (@newsletter) are NOT included here because they are
10
+ * handled by dedicated channel actions with a dropdown that returns
11
+ * pre-formatted values. See recipients.ts (Sprint 2) for the full
12
+ * recipient resolution logic.
13
+ */
14
+ export declare enum ChatType {
15
+ CONTACT = "contact",
16
+ GROUP = "group"
17
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatType = void 0;
4
+ /**
5
+ * Chat type for Manual Entry actions only.
6
+ *
7
+ * Used by the "Send To" static dropdown in manual entry actions
8
+ * to determine the chatId suffix:
9
+ * - CONTACT → appends @c.us
10
+ * - GROUP → appends @g.us
11
+ *
12
+ * Channels (@newsletter) are NOT included here because they are
13
+ * handled by dedicated channel actions with a dropdown that returns
14
+ * pre-formatted values. See recipients.ts (Sprint 2) for the full
15
+ * recipient resolution logic.
16
+ */
17
+ var ChatType;
18
+ (function (ChatType) {
19
+ ChatType["CONTACT"] = "contact";
20
+ ChatType["GROUP"] = "group";
21
+ })(ChatType || (exports.ChatType = ChatType = {}));
22
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/common/types.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,2BAAe,CAAA;AACjB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB"}
@@ -0,0 +1,10 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const watchChannelMessagesTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
6
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
8
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
10
+ }>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.watchChannelMessagesTrigger = 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.watchChannelMessagesTrigger = (0, pieces_framework_1.createTrigger)({
11
+ auth: auth_1.whatsscaleAuth,
12
+ name: 'watch_channel_messages',
13
+ displayName: 'Watch Channel Messages',
14
+ description: 'Triggers when a new message is posted to any WhatsApp Channel (includes own posts).',
15
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ },
19
+ sampleData: {
20
+ message_id: 'false_123123@newsletter_1111111111111111111111',
21
+ channel_id: '120363401850139775@newsletter',
22
+ body: 'New product launch announcement!',
23
+ has_media: false,
24
+ media_type: 'text',
25
+ media_url: '',
26
+ media_mimetype: '',
27
+ media_filename: '',
28
+ timestamp: '2026-02-18T10:30:00.000Z',
29
+ session_name: 'my_session',
30
+ },
31
+ onEnable(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const auth = context.auth.secret_text;
34
+ yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/make/hooks/subscribe', {
35
+ session: context.propsValue.session,
36
+ webhook_url: context.webhookUrl,
37
+ platform: 'activepieces',
38
+ trigger_type: 'channel',
39
+ });
40
+ });
41
+ },
42
+ onDisable(context) {
43
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
44
+ const auth = context.auth.secret_text;
45
+ yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/make/hooks/unsubscribe', {
46
+ webhook_url: context.webhookUrl,
47
+ });
48
+ });
49
+ },
50
+ run(context) {
51
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+ return [context.payload.body];
53
+ });
54
+ },
55
+ });
56
+ //# sourceMappingURL=watch-channel-messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-channel-messages.js","sourceRoot":"","sources":["../../../../src/lib/triggers/watch-channel-messages.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAyD;AACzD,kCAAyC;AACzC,6CAAoD;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C,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const watchGroupMessagesTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
6
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
8
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
10
+ }>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.watchGroupMessagesTrigger = 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.watchGroupMessagesTrigger = (0, pieces_framework_1.createTrigger)({
11
+ auth: auth_1.whatsscaleAuth,
12
+ name: 'watch_group_messages',
13
+ displayName: 'Watch Group Messages',
14
+ description: 'Triggers when a new message is received in any WhatsApp group.',
15
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ },
19
+ sampleData: {
20
+ message_id: '3EB0A1B2C3D4E5F6G7H8I9',
21
+ group_id: '120363423663126276@g.us',
22
+ participant_id: '43001330020491@lid',
23
+ participant_name: 'Jane Smith',
24
+ body: 'Hey everyone, meeting at 3pm today!',
25
+ has_media: false,
26
+ media_type: 'text',
27
+ media_url: '',
28
+ media_mimetype: '',
29
+ media_filename: '',
30
+ timestamp: '2026-02-18T10:30:00.000Z',
31
+ is_forwarded: false,
32
+ quoted_message_id: '',
33
+ quoted_body: '',
34
+ is_reply: false,
35
+ from_name: 'Jane Smith',
36
+ chat_id: '120363423663126276@g.us',
37
+ session_name: 'my_session',
38
+ },
39
+ onEnable(context) {
40
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
41
+ const auth = context.auth.secret_text;
42
+ yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/make/hooks/subscribe', {
43
+ session: context.propsValue.session,
44
+ webhook_url: context.webhookUrl,
45
+ platform: 'activepieces',
46
+ trigger_type: 'group',
47
+ });
48
+ });
49
+ },
50
+ onDisable(context) {
51
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+ const auth = context.auth.secret_text;
53
+ yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/make/hooks/unsubscribe', {
54
+ webhook_url: context.webhookUrl,
55
+ });
56
+ });
57
+ },
58
+ run(context) {
59
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
60
+ return [context.payload.body];
61
+ });
62
+ },
63
+ });
64
+ //# sourceMappingURL=watch-group-messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-group-messages.js","sourceRoot":"","sources":["../../../../src/lib/triggers/watch-group-messages.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAyD;AACzD,kCAAyC;AACzC,6CAAoD;AACpD,2CAAkD;AAErC,QAAA,yBAAyB,GAAG,IAAA,gCAAa,EAAC;IACrD,IAAI,EAAE,qBAAc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AAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const watchIncomingMessagesTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
6
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
8
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
+ session: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
10
+ }>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.watchIncomingMessagesTrigger = 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.watchIncomingMessagesTrigger = (0, pieces_framework_1.createTrigger)({
11
+ auth: auth_1.whatsscaleAuth,
12
+ name: 'watch_incoming_messages',
13
+ displayName: 'Watch Incoming Messages',
14
+ description: 'Triggers when a new 1-on-1 WhatsApp message is received.',
15
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
16
+ props: {
17
+ session: props_1.whatsscaleProps.session,
18
+ },
19
+ sampleData: {
20
+ message_id: '3EB0A1B2C3D4E5F6G7H8I9',
21
+ chat_id: '31612345678',
22
+ from_number: '31612345678',
23
+ from_name: 'John Doe',
24
+ body: 'Hello, I have a question about your product',
25
+ has_media: false,
26
+ media_type: 'text',
27
+ media_url: '',
28
+ media_mimetype: '',
29
+ media_filename: '',
30
+ timestamp: '2026-02-04T10:30:00.000Z',
31
+ is_forwarded: false,
32
+ quoted_message_id: '',
33
+ quoted_body: '',
34
+ is_reply: false,
35
+ session_name: 'my_session',
36
+ },
37
+ onEnable(context) {
38
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
39
+ const auth = context.auth.secret_text;
40
+ yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/make/hooks/subscribe', {
41
+ session: context.propsValue.session,
42
+ webhook_url: context.webhookUrl,
43
+ platform: 'activepieces',
44
+ // No trigger_type — proxy defaults to '1on1' when absent
45
+ });
46
+ });
47
+ },
48
+ onDisable(context) {
49
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
50
+ const auth = context.auth.secret_text;
51
+ yield (0, client_1.whatsscaleClient)(auth, pieces_common_1.HttpMethod.POST, '/make/hooks/unsubscribe', {
52
+ webhook_url: context.webhookUrl,
53
+ });
54
+ });
55
+ },
56
+ run(context) {
57
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+ return [context.payload.body];
59
+ });
60
+ },
61
+ });
62
+ //# sourceMappingURL=watch-incoming-messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-incoming-messages.js","sourceRoot":"","sources":["../../../../src/lib/triggers/watch-incoming-messages.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAyD;AACzD,kCAAyC;AACzC,6CAAoD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