devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
813 stars 248 forks source link

[BUG][NOWEB] - Attachment: file.data & file.url is not working #313

Closed jktan0504 closed 2 months ago

jktan0504 commented 2 months ago

Describe the bug I am using this example: https://waha.devlike.pro/docs/how-to/send-messages/#send-image-imagesversionspluspng

Docker Image:

# Waha Image
  whatsapp-http-api-plus:
    image: devlikeapro/whatsapp-http-api-plus:noweb

Body:

{
  "session": "default",
  "chatId": "60167488864@c.us",
  "file": {
    "mimetype": "image/jpeg",
    "url": "https://github.com/devlikeapro/whatsapp-http-api/raw/core/examples/dev.likeapro.jpg",
    "filename": "filename.jpeg"
  },
  "caption": "string"
}

Response:

"exception": {
        "stack": "TypeError: Cannot read properties of undefined (reading 'match')\n    at extractUrlFromText (/app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:41:67)\n    at generateLinkPreviewIfRequired (/app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:45:48)\n    at generateWAMessageContent (/app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:246:71)\n    at generateWAMessage (/app/node_modules/@adiwajshing/baileys/lib/Utils/messages.js:515:102)\n    at Object.sendMessage (/app/node_modules/@adiwajshing/baileys/lib/Socket/messages-send.js:617:69)\n    at WhatsappSessionNoWebPlus.sendText (/app/dist/core/engines/noweb/session.noweb.core.js:238:26)\n    at ChattingController.sendText (/app/dist/api/chatting.controller.js:42:25)\n    at /app/node_modules/@nestjs/core/router/router-execution-context.js:38:29\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28",
        "message": "Cannot read properties of undefined (reading 'match')",
        "name": "TypeError"
    },

patron:PLUS

allburov commented 2 months ago

@jktan0504 Please make sure you're using POST /api/sendImage, I see in the exception WhatsappSessionNoWebPlus.sendText - likely you used POST /api/sendText

patron:PRO

allburov commented 2 months ago

Tried and send using your payload - worked perfectly (sorry for spam, I hope it isnot night)

patron:PRO