Skip to content

How to send a file by link#

Installation#

python -m pip install telegram-api-client-python

Import#

from telegram_api_client_python import API

Example#

How to initialize an object#

greenAPI = API.GreenAPI(ID_INSTANCE, API_TOKEN_INSTANCE)

A synchronous example:

response = greenAPI.sending.sendFileByUrl(
    "79876543210@c.us",
    "https://download.samplelib.com/png/sample-clouds2-400x300.png",
    "sample-clouds2-400x300.png",
    "Sample PNG"
)
print(response.data)

An asynchronous example:

response = await greenAPI.sending.sendFileByUrlAsync(
    "79876543210@c.us",
    "https://download.samplelib.com/png/sample-clouds2-400x300.png",
    "sample-clouds2-400x300.png",
    "Sample PNG"
)
print(response.data)

The full list of examples#

Description Module
An example of sending text sendtMessage.py
An example of sending an image by URL sendFileByUrl.py
An example of sending an image by uploading it from disk sendFileByUpload.py
An example of creating a group and sending a message to the group createGroupAndSendMessage.py
An example of receiving incoming notifications receiveNotification.py