A modern Python client for the Evolution API v2 (WhatsApp) — the twin of the R 'evolution' package.
Project description
evolution-whatsapp
A modern Python client for Evolution API v2 — send and receive WhatsApp messages from Python.
evolution-whatsapp is the Python twin of the R package
evolution
(source). It keeps the same
mental model — a preconfigured client, snake_case send_* helpers, jid() —
and adds a modern Python stack:
httpxwith sync and async clients (EvoClient/AsyncEvoClient)pydanticv2 models for webhook events +parse_webhook()structlogstructured, timed logging viaverbose=True- local-file → base64 auto-encoding, automatic retries, typed errors
- optional FastAPI webhook router and pandas
as_dataframe()for pipelines
This package is an independent wrapper for the Evolution API and is not affiliated with WhatsApp or Meta.
Installation
pip install evolution-whatsapp
# with extras:
pip install "evolution-whatsapp[fastapi]" # webhook_router()
pip install "evolution-whatsapp[pandas]" # as_dataframe()
The distribution is
evolution-whatsapp; the import name isevolution_api(the bareevolutionimport is already taken on PyPI — seeDECISIONS.md).
Quick start
from evolution_api import EvoClient, jid
client = EvoClient(
base_url="https://YOUR-HOST",
api_key="...", # or set the EVO_APIKEY env var
instance="yourInstance",
timeout=30, # or the EVOLUTION_TIMEOUT env var (default 60)
)
# Send a simple message (verbose logs timing + a response preview)
client.send_text("5581999990000", "Hello from Python!", verbose=True)
jid("+55 81 99999-0000") # -> "5581999990000@s.whatsapp.net"
Async
import asyncio
from evolution_api import AsyncEvoClient
async def main():
async with AsyncEvoClient(base_url="https://YOUR-HOST", api_key="...", instance="inst") as client:
await client.send_text("5581999990000", "Hello from async Python!")
asyncio.run(main())
Functions overview
| Method | Description | Key arguments |
|---|---|---|
EvoClient() / AsyncEvoClient() |
Preconfigured client | base_url, api_key, instance, timeout |
send_text() |
Plain text message | number, text, delay, verbose |
send_status() |
Status / story (text or media) | type, content, caption |
send_media() |
Image / video / document (URL, base64, or file) | number, mediatype, mimetype, media, file_name |
send_whatsapp_audio() |
Voice note (PTT) | number, audio |
send_sticker() |
Sticker (URL, base64, or file) | number, sticker |
send_location() |
Location pin | number, latitude, longitude, name |
send_contact() |
One or more contacts (auto wuid) |
number, contact |
send_reaction() |
Emoji reaction | key, reaction |
send_buttons() |
Interactive buttons ⚠️ | number, buttons |
send_poll() |
Poll | number, name, values |
send_list() |
Interactive list ⚠️ | number, sections, button_text |
check_is_whatsapp() / check_numbers() |
Check if numbers are on WhatsApp | numbers |
connection_state() |
Channel connection / health check | — |
jid() |
Build a WhatsApp JID from a phone number | number |
⚠️
send_buttons()/send_list(): interactive buttons and lists are not supported on the Baileys (WhatsApp Web) connector and may be discontinued — they work only on the Cloud API connector. Both emit a warning and suggestsend_poll().💡 Local files:
send_media(),send_sticker()andsend_whatsapp_audio()accept local paths (including~/...), auto-encoded to base64.
Examples
# Media from a URL
client.send_media("5581999990000", "image", "image/png",
media="https://www.r-project.org/logo/Rlogo.png",
file_name="Rlogo.png", caption="R Logo")
# Media from a local file (auto base64)
client.send_media("5581999990000", "document", "application/pdf",
media="~/report.pdf", file_name="report.pdf")
# Poll
client.send_poll("5581999990000", "Favourite language?",
["R", "Python", "Julia"], selectable_count=1)
# Contact (wuid auto-generated)
client.send_contact("5581999990000", {
"fullName": "Jane Doe", "phoneNumber": "+5581999990000",
"organization": "Company Ltd.", "email": "jane@example.com",
})
# Check numbers
client.check_is_whatsapp(["5581999990000", "5511988887777"])
Receiving webhooks
from evolution_api.webhooks import parse_webhook
event = parse_webhook(request_json)
if event.event_type == "MESSAGES_UPSERT":
print(event.data.key.remote_jid, event.data.message)
FastAPI router (extra fastapi):
from fastapi import FastAPI
from evolution_api.webhooks import webhook_router
async def on_event(event):
if event.event_type == "MESSAGES_UPSERT":
...
app = FastAPI()
app.include_router(webhook_router(on_event))
Drain to a DataFrame (extra pandas):
from evolution_api.webhooks import as_dataframe
df = as_dataframe([parse_webhook(p) for p in payloads])
Configuration
| Setting | Default | Description |
|---|---|---|
EVO_APIKEY (env) |
— | API key if api_key is not passed |
EVO_INSTANCE (env) |
— | Instance if instance is not passed |
EVOLUTION_TIMEOUT (env) / timeout= |
60 |
HTTP timeout in seconds |
verbose=True |
per-call | Structured logging with timing + response preview |
Relationship to the R package
This is a faithful port of StrategicProjects/evolution
(CRAN). See the Parity with the R package page in the docs and DECISIONS.md
for where Python idioms intentionally differ.
License
MIT © 2026 Andre Leite, Hugo Vasconcelos & Diogo Bezerra. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evolution_whatsapp-0.1.0.tar.gz.
File metadata
- Download URL: evolution_whatsapp-0.1.0.tar.gz
- Upload date:
- Size: 179.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcabd06a6686198c15c64aede3fbba3dc10314ff784eb66381ffcc37f9c0bded
|
|
| MD5 |
5234d327c2f4361382b1138d12fa1d14
|
|
| BLAKE2b-256 |
f532f63bad4d82fd0f4a856ad65585dd7d6d521ee175b6b1263d7817fff9faef
|
Provenance
The following attestation bundles were made for evolution_whatsapp-0.1.0.tar.gz:
Publisher:
release.yml on StrategicProjects/evolution-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evolution_whatsapp-0.1.0.tar.gz -
Subject digest:
bcabd06a6686198c15c64aede3fbba3dc10314ff784eb66381ffcc37f9c0bded - Sigstore transparency entry: 1817567865
- Sigstore integration time:
-
Permalink:
StrategicProjects/evolution-python@5d8892a69275b2461093efb4b14d3bde778a55f0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/StrategicProjects
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5d8892a69275b2461093efb4b14d3bde778a55f0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file evolution_whatsapp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: evolution_whatsapp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
073e5d5cacb1516a9283aefae362bae4f12855906d5a415a0073c3330d9061bc
|
|
| MD5 |
071cbbff301e63dd163c4d3c016ec435
|
|
| BLAKE2b-256 |
9a1b1697b18bc40bf513937c8bf2cf70023fb545dfcfa3cdb6da82887eda40a4
|
Provenance
The following attestation bundles were made for evolution_whatsapp-0.1.0-py3-none-any.whl:
Publisher:
release.yml on StrategicProjects/evolution-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evolution_whatsapp-0.1.0-py3-none-any.whl -
Subject digest:
073e5d5cacb1516a9283aefae362bae4f12855906d5a415a0073c3330d9061bc - Sigstore transparency entry: 1817568001
- Sigstore integration time:
-
Permalink:
StrategicProjects/evolution-python@5d8892a69275b2461093efb4b14d3bde778a55f0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/StrategicProjects
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5d8892a69275b2461093efb4b14d3bde778a55f0 -
Trigger Event:
push
-
Statement type: