code-chat-br / whatsapp-api

CodeChat - WhatsApp Api

Home Page:https://docs.codechat.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to send media images

sunilsankar opened this issue · comments

When I try to send a image I get this error

import requests

url = "http://192.168.1.15:8084/message/sendMedia/chatbot"

payload = {
    "number": "XXXXXXXX@s.whatsapp.net",
    "options": {
        "presence": "composing",
        "quotedMessageId": 1
    },
    "mediaMessage": {
        "mediatype": "image",
        "fileName": "15814577162.png",
        "caption": "string",
        "media": "https://www.speedtest.net/result/15814577162.png"
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "password"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())

This is error I see in the log

0|chatbot-whatsapp  | [CodeChat]  45519   -  Thu Jun 06 2024 09:52:44     ERROR                                                                                                                                  [JwtGuard]  [object]
0|chatbot-whatsapp  | { status: 401, error: 'Unauthorized', message: undefined }

syntax error I fixed it thanks