Vonage / vonage-python-code-snippets

Python code examples for using Vonage communications APIs
MIT License
31 stars 56 forks source link

vonage.errors.AuthenticationError: Authentication failed. Check you're using a valid authentication method. #145

Open AbrahamMialma opened 1 year ago

AbrahamMialma commented 1 year ago

Hola tengo este error : vonage.errors.AuthenticationError: Authentication failed. Check you're using a valid authentication method.

Linux xubuntu 22.04

Python 3.10

pip3 install vonage

Cuando trato de ejecutar el siguiente codigo :

#################################### Codigo #############################################

import os from os.path import join, dirname

VONAGE_APPLICATION_ID = "f6e2b6af-2610-408d-99f9-c41e2248e03d" VONAGE_APPLICATION_PRIVATE_KEY_PATH = "/home/android/Proyectos/Corato_V2/private.key"

TO_NUMBER = ** FROM_NUMBER = **

import vonage

client = vonage.Client( application_id=VONAGE_APPLICATION_ID, private_key=VONAGE_APPLICATION_PRIVATE_KEY_PATH,

)

client.messages.send_message({

"channel": "whatsapp", "message_type": "text", "to": "**", "from": "***", "text": "This is a WhatsApp text message sent using the Vonage Messages API",

})

-----https://github.com/Vonage/vonage-python-code-snippets/blob/main/messages/whatsapp/send_text.py

$ python3 send_text.py

#######################################################################################

Ya intente con key y secret pero no funciona, que estoy haciendo mal ???

Gracias de antemano.

Stack trace :

Traceback (most recent call last): File "/home/android/Downloads/ejemplos_vonage/messages/whatsapp/send_text.py", line 23, in client.messages.send_message( File "/home/android/Downloads/ejemplos_vonage/env/lib/python3.10/site-packages/vonage/messages.py", line 25, in send_message return self._client.post( File "/home/android/Downloads/ejemplos_vonage/env/lib/python3.10/site-packages/vonage/client.py", line 231, in post return self.parse( File "/home/android/Downloads/ejemplos_vonage/env/lib/python3.10/site-packages/vonage/client.py", line 277, in parse raise AuthenticationError("Authentication failed. Check you're using a valid authentication method.")

OoElMaxioO commented 1 year ago

Hola, ¿pudiste solucionar el problema? Estoy teniendo prácticamente la misma limitante que tú y la documentación no dice nada al respecto.

maxkahan commented 1 year ago

Question was asked and answered here: https://github.com/Vonage/vonage-python-sdk/issues/257

To use WhatsApp as a message channel for the Messages API, you must first register a WhatsApp Business Account to be associated with the WhatsApp messages you send. WhatsApp also have to verify that your business is legitimate, which gives you a green tick. You can read more about this here: https://developer.vonage.com/en/messages/concepts/whatsapp

You can register for a WhatsApp account with Vonage in the developer dashboard.

Hope this helps!