Closed elbeicktalat closed 4 months ago
There could be multiple reasons for pdf not being sent
/api/method/frappe.utils.print_format.download_pdf
make sure its available as public.It doesn't matter if your still on dev mode, you should still get the message.
You can check whatspp notification logs for more details.
@shridarpatil Thanks for the answer,
- Check whether your template is approved or not
Yes, it's approved .
- Meta should be able to access this endpoint /api/method/frappe.utils.print_format.download_pdf make sure its available as public.
How can I make this endpoint as public? Because as you said I tried to print without login it didn't work so probably this is the problem. I have to do something on meta side or only on ERPNext side? Please explain in detail.
- As you said your still on dev mode make sure that the number for which your trying to send message is registered on meta
If I'm in prod mode I still have to register the receiver number? Probably not?
Now the question is how to allow the print without authentication? I saw that the frappe.utils.print_format.download_pdf
method is allow_guest
I think this means it's public see here
Traceback (most recent call last):
File "apps/frappe/frappe/utils/pdf.py", line 87, in get_pdf
filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
File "env/lib/python3.10/site-packages/pdfkit/api.py", line 75, in from_string
return r.to_pdf(output_path)
File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf
self.handle_error(exit_code, stderr)
File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 155, in handle_error
raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: ContentOperationNotPermittedError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 110, in application
response = frappe.api.handle(request)
File "apps/frappe/frappe/api/__init__.py", line 49, in handle
data = endpoint(**arguments)
File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 49, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/__init__.py", line 1684, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
File "apps/frappe/frappe/utils/print_format.py", line 134, in download_pdf
pdf_file = frappe.get_print(
File "apps/frappe/frappe/__init__.py", line 2093, in get_print
return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
File "apps/frappe/frappe/utils/pdf.py", line 95, in get_pdf
frappe.throw(_("PDF generation failed because of broken image links"))
File "apps/frappe/frappe/__init__.py", line 578, in throw
msgprint(
File "apps/frappe/frappe/__init__.py", line 550, in msgprint
_raise_exception()
File "apps/frappe/frappe/__init__.py", line 501, in _raise_exception
raise exc
frappe.exceptions.ValidationError: PDF generation failed due to broken image links
Looking at the above error I can see that pdf generation is failing due to some image link can you check that and fix? After that it should work fine.
Oh, it does make sense since some image is private.
My bad 😅Now it's working
Hi, Thanks for the awesome plugin,
I have exact 2 Whatsapp templates, one plain text the other comes with document, the issue is that when i use the first one plain text (no media) it's working perfectly, but if i use the one with document, no message begins sent, i think it's related to the pdf file download.
I have already test the print via
/api/method/frappe.utils.print_format.download_pdf
there is no issue.WhatsApp Message
Plain text
With (pdf) Attachment
Please try to fix this or inform me if there is any hidden step to do.
Ah just to be sure, my app on meta still in dev mode, can be this the issue? Note that I'm able to send text messages, but only with pdf not working.