tambahannya

This commit is contained in:
bipproduction
2025-10-30 01:45:46 +08:00
parent e63ec05f2f
commit 4da0401247
3 changed files with 21 additions and 16 deletions

View File

@@ -232,6 +232,11 @@ async function handleIncomingMessage(msg: WAWebJS.Message) {
return; return;
} }
if (msg.hasMedia) {
const media = await msg.downloadMedia();
(msg as any).media = media;
}
console.log("kirim ke webhook") console.log("kirim ke webhook")
const res = await fetch("https://n8n.wibudev.com/webhook/dc164759-b7ba-47d5-b5d8-ffd9d5840090", { const res = await fetch("https://n8n.wibudev.com/webhook/dc164759-b7ba-47d5-b5d8-ffd9d5840090", {
body: JSON.stringify(msg), body: JSON.stringify(msg),
@@ -245,20 +250,20 @@ async function handleIncomingMessage(msg: WAWebJS.Message) {
console.log(json); console.log(json);
try { try {
const notifyName = (msg as any)._data.notifyName; // const notifyName = (msg as any)._data.notifyName;
const dataMessage: DataMessage = { // const dataMessage: DataMessage = {
from: msg.from, // from: msg.from,
fromNumber: msg.from.split('@')[0] || '', // fromNumber: msg.from.split('@')[0] || '',
fromMe: msg.fromMe, // fromMe: msg.fromMe,
body: msg.body, // body: msg.body,
hasMedia: msg.hasMedia, // hasMedia: msg.hasMedia,
type: msg.type, // type: msg.type,
to: msg.to, // to: msg.to,
deviceType: msg.deviceType, // deviceType: msg.deviceType,
media: {}, // media: (msg as any).media,
notifyName, // notifyName,
}; // };
// === KIRIM KE WEBHOOK === // === KIRIM KE WEBHOOK ===
// try { // try {

6
x.sh
View File

@@ -1,3 +1,3 @@
curl -X POST https://n8n.wibudev.com/webhook/dc164759-b7ba-47d5-b5d8-ffd9d5840090 \ curl -X POST https://n8n.wibudev.com/form/82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d \
-H "Content-Type: application/json" \ -H "Content-Type: multipart/form-data" \
-d '{"question": "kirimkan pesan ke 089697338821 pesannya hari ini bagaimana ya?", "sessionId": "dc164759-b7ba-47d5-b5d8-ffd9d5840090"}' -F "file=@/Users/bip/Documents/projects/jenna/wajs-server/xarif.pdf"

BIN
xarif.pdf Normal file

Binary file not shown.