Open arvind1kumar1 opened 3 years ago
I'm with same problema
In my case, when I tried to send a pdf file, it always send a corrupted file (in my phone I got a TXT file instead of a PDF and on my laptop I received a corrupt PDF). Any clues of how to fix this?
Please tell me how upload pdf in whatsapp. When i tried to upload a pdf it throw a error that message does not have save_media method.
can you upload to a cloud service as aws s3? in my case my client upload to s3 and send link to API equal on Positus Business WhatsApp API.
def convert_media_url_to_base64(self, url):
mime = magic.Magic(mime=True)
archive = ''
buffer = urllib.request.urlopen(url).read()
content_type = mime.from_buffer(buffer)
archive = b64encode(buffer)
archive = archive.decode('utf-8')
return 'data:' + content_type + ';base64,' + archive
def send_media_from_url(self, url, chatid, caption):
imgBase64 = self.convert_media_url_to_base64(url)
filename = url.split('/')[-1]
return self.wapi_functions.sendImage(imgBase64, chatid, filename, caption)
Please tell me how upload pdf in whatsapp. When i tried to upload a pdf it throw a error that message does not have save_media method.