-
I am trying to send a simple message with the API using this code:-
This works fine, as long as the phone number and other information is correct. I get the whole array properly. But, when I try to type a wrong number or a wrong token, no response is printed. Instead, I get this PHP error:-
There is nothing in the response section. I checked the browser's response section and also on terminal, but, nothing. If I am not wrong, the response class is supposed to print the exact error "Recipient phone number not in allowed list", right? But, that's not what I see. Maybe I am doing something wrong. Can someone confirm? BTW, some info. like phone number, etc. has been redacted in the above code. And, also thanks a lot to Netflies for this awesome API. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I am not sure, but, I don't think the Response class within WhatsAppCloudApi can handle errors such as wrong numbers and stuff as in the example above, probably cause this is being handled by GuzzleHttp. Not sure if this is a bug or it was meant to be like this. Please clarify if possible. |
Beta Was this translation helpful? Give feedback.
-
If you are using the current stable version of this package (version 1.x) you have to catch the GuzzleHttp\Exception\ClientException exception. This behavior will be fixed from 2.x version (in beta stage currently): 1219b01 |
Beta Was this translation helpful? Give feedback.
-
Thanks for this. For the time being I have added a similar method in my copy of the API, where the process dies and shows error message if an exception is caught. |
Beta Was this translation helpful? Give feedback.
If you are using the current stable version of this package (version 1.x) you have to catch the GuzzleHttp\Exception\ClientException exception.
This behavior will be fixed from 2.x version (in beta stage currently): 1219b01