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

6
x.sh
View File

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

BIN
xarif.pdf Normal file

Binary file not shown.