Skip to content

How to send a file by URL#

Installation#

pip install whatsapp-api-client-python

Import#

from whatsapp_api_client_python import API

Examples#

You may see the full example at: sendPictureByLink.py

How to initialize an object#

restApi = API.RestApi(ID_INSTANCE, API_TOKEN_INSTANCE)
Please note that keys can be obtained from environment variables:
from os import environ

ID_INSTANCE = environ['ID_INSTANCE']
API_TOKEN_INSTANCE = environ['API_TOKEN_INSTANCE']

How to send a file by URL#

result = restApi.sending.sendFileByUrl('120363025955348359@g.us', 
        'https://www.google.ru/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png', 
        'googlelogo_color_272x92dp.png', 'Google logo')

The full list of examples#

Description Module
Example of sending text sendTextMessage.py
Example of sending a picture by URL sendPictureByLink.py
Example of sending a picture by uploading from the disk sendPictureByUpload.py
Example of a group creation and sending a message to the group createGroupAndSendMessage.py
Example of incoming webhooks receiving receiveNotification.py