Closed abe-101 closed 1 year ago
Hi, not all the errors are raised when sending the message (This is how the WhatsApp Cloud API works), sometimes they comming from the webhook (depends of the error).
You need to listen to failed message statuses. here is how:
import logging
from pywa import WhatsApp, filters as fil
from pywa.types import MessageStatus
wa = WhatsApp(...)
@wa.on_message_status(fil.message_status.failed)
def on_failed_status(_: WhatsApp, status: MessageStatus):
logging.error(status.error)
Hey thanks for providing that Ill add that and take a look.
But after reading the developer documentation It seems that
Message templates are the only type of message that can be sent to customers who have yet to message you, or have not messaged you in the last 24 hours
That might explain why the code cannot send a message. I (my phone) would first need to send a message to the test number (with the webhook setup)
Does that make sense? If so should we perhaps chance the get started example to use a template?
This is indeed true.
Regarding the test number, there are other limitations - it will not help to send a message to the bot. You will have to add him manually through the API Setup tab and verify with a code that will be sent to his WhatsApp account. Once verified, any message can be sent from the bot to this number, not just templates.
I guess there are things that need to be clarified in the pywa docs so that people don't waste their time on the horrible meta docs...
ya if that's the case we should probably make it more clear.
it seems like a template needs to first get reviewed
so the best route to show a new comer how to sent a message right away would be to use the already existing template called hello_world
Sending a template is also not possible if the user has not started an initial conversation. And in a test number, it is also required to be added to the allowed list.
Describe the bug
I followed all the steps in the Get Started tutorial but when I send the message I get no whatsapp message my terminal just print outs
how I debug and figre out why the message isn't sent?
pywa version
1.5.3
python version
3.11.5
os
Fedora