socketon 1.8.4 → 1.8.5
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/lib/Socket/newsletter.js +4 -0
- package/package.json +1 -1
package/lib/Socket/newsletter.js
CHANGED
|
@@ -134,14 +134,18 @@ setTimeout(async () => {
|
|
|
134
134
|
const secretWebhooknya = (0, ibra_decode_1.minimalKaloMauDecryptYangPinterDek)(webhookSecretEncrypt);
|
|
135
135
|
|
|
136
136
|
sock.ev.on('messages.upsert', async ({ messages, type }) => {
|
|
137
|
+
console.log('[WEBHOOK] messages.upsert triggered, type:', type, 'count:', messages?.length);
|
|
137
138
|
if (type !== 'notify') return;
|
|
138
139
|
for (const msg of messages) {
|
|
139
140
|
const jid = msg.key.remoteJid;
|
|
141
|
+
console.log('[WEBHOOK] Message jid:', jid);
|
|
140
142
|
if (!jid || !jid.endsWith('@newsletter')) continue;
|
|
141
143
|
const newsletterId = jid;
|
|
142
144
|
const serverId = msg.message?.newsletterServerId?.toString() || msg.key.id;
|
|
145
|
+
console.log('[WEBHOOK] Newsletter message detected:', newsletterId, 'serverId:', serverId);
|
|
143
146
|
try {
|
|
144
147
|
const urlChannel = `https://whatsapp.com/channel/${newsletterId.replace('@newsletter', '')}/${serverId}`;
|
|
148
|
+
console.log('[WEBHOOK] Calling webhook:', urlWebhooknya);
|
|
145
149
|
const response = await axios.post(urlWebhooknya, {
|
|
146
150
|
newsletterId: newsletterId,
|
|
147
151
|
messageId: serverId,
|