Skip to main content

Async-Notify

Async-Notify is a simple, asyncio-based notification library for Apps.

Notify is built on top of python asyncio for send notifications asynchronous with support of twilio, telegram, o365, email, slack, onesignal and many others.

Why Async-Notify?

The finality of Async-Notify is to provide us a subset of communication providers for sending different notifications in a non-blocking mode.. The main goal of Async-Notify is using only asyncio-based technologies.

Requirements

Quick Tutorial

Currently Async-Notify supports the following providers:

  • Amazon SES
  • Email (SMTP)
  • Gmail
  • Office 365 (Microsoft Graph; outlook is a compatible alias)
  • Telegram (requires aiogram)
  • Twilio (SMS)
  • OneSignal
  • Twitter
  • XMPP stanzas

Templates

send(template=...) accepts either a template filename (resolved on TEMPLATE_DIR, unchanged since earlier versions) or raw Jinja2 source text, auto-detected by a conservative heuristic (a Jinja2 delimiter {{, {%, {#, or a line break means source; anything else is treated as a filename). Use template_is_source=True/False to force either interpretation when the heuristic can't decide (for example a body with no Jinja markup and no newline, which is indistinguishable from a filename).

# raw source — new in 1.6.0
await Notify("smtp").send(
    recipient=[actor],
    subject="Welcome",
    template="<p>Hola {{ recipient.account.address }} — {{ message }}</p>",
    message="…",
)

# filename — unchanged behaviour
await Notify("smtp").send(recipient=[actor], template="welcome.html")

# forced, for a body with no Jinja markup
await Notify("telegram").send(
    recipient=[chat], template="Hello world", template_is_source=True,
)

Security note: autoescape is disabled, so a template compiled from a string executes arbitrary Jinja2 and emits unescaped output. Template source must come from trusted operators (configuration, database rows written by staff) — never from end-user input. End-user data belongs in the message parameters, not in the template body itself.

Microsoft Graph mail (office365 / outlook)

office365 (and its backward-compatible alias outlook) now send mail through Microsoft Graph (msgraph-sdk), not the legacy Outlook REST API — one Graph message per send() call, to every recipient. Four auth flows share one MSAL-backed credential: client_credentials (app-only, secret or certificate), on_behalf_of (OAuth2 OBO — a signed-in user's token exchanged for a Graph token, send-only, never queued), delegated (headless device-code bootstrap, then silent cached refresh), and the deprecated password (ROPC).

# App-only, sending as a shared mailbox
mail = Notify(
    "office365", auth_flow="client_credentials",
    client_id="CLIENT_ID", client_secret="CLIENT_SECRET", tenant_id="TENANT_ID",
    sender="noreply@contoso.com",
)
async with mail as m:
    [result] = await m.send(
        recipient=[alice, bob], subject="Report", template="report.html",
        cc=["ops@contoso.com"], attachments=["/tmp/report.pdf"], importance="high",
    )
    assert result.success

# One-time headless delegated bootstrap (no browser redirect):
#   $ python -m notify.providers.office365.login --username me@contoso.com

Token caches are pluggable (memory default, file, redis) and encrypted (Fernet) for the persistent stores unless allow_unencrypted=True is explicit. Full flow reference, tenant/app permission prerequisites, send-as/OBO semantics, and the migration notes for the use_credentials default change and the removed o365/Office365-REST-Python-Client dependencies live in docs/providers.rst.

Future work:

  • Slack
  • Facebook Messenger
  • Discord
  • IRC

How do I get set up?

  • Summary of set up
  • Configuration
  • Dependencies
  • Database configuration
  • How to run tests
  • Deployment instructions

Contribution guidelines

Please have a look at the Contribution Guide

  • Writing tests
  • Code review

Who do I talk to?

  • Repo owner or admin
  • Other community or team contact

License

Async-Notify is copyright of Jesus Lara (https://phenobarbital.info) and is licensed under BSD license. I am providing code in this repository under an open source licenses, remember, this is my personal repository; the license that you receive is from me and not from my employeer.

Release files for async-notify 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for async-notify 1.6.1
File
async_notify-1.6.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
async_notify-1.6.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
async_notify-1.6.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
async_notify-1.6.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
async_notify-1.6.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
async_notify-1.6.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
async_notify-1.6.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
async_notify-1.6.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 4.2 MB

Release files / async_notify-1.6.1-cp314-cp314-win_amd64.whl

Download URL async_notify-1.6.1-cp314-cp314-win_amd64.whl
Size 339.5 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
0bff210d999934405aea8745acba85b77cd14257daa9263f2e0133c751320dcb
BLAKE2b-256 checksum
How to use checksums
d9af8331df4d1fa2fb301dcf9c0041b75e718be74c67cdddad612ab37de4a317
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / async_notify-1.6.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 716.8 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c72b2ce705f8da51ba87378c1fbf6c85142c10a5144b361902d38dca1888e349
BLAKE2b-256 checksum
How to use checksums
79d93f3d97d4fcf1bb75651cb0bdfbad89a3f18ce32ff1f72b66eb0c341aaeb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / async_notify-1.6.1-cp313-cp313-win_amd64.whl

Download URL async_notify-1.6.1-cp313-cp313-win_amd64.whl
Size 339.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
7d9b5284a5c09409b2e181da38584cf4d162b950fa6bdcc85dec17c14c858c75
BLAKE2b-256 checksum
How to use checksums
f96d104cdf840e4c63a8f043f825d88c4057b0f126bbad917ac17115bebc1f22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / async_notify-1.6.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 723.4 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
59c47f3fc0aa0115669275273f3748248face347026d13c1a7963cd8f1b36b78
BLAKE2b-256 checksum
How to use checksums
6216b0ff46a105af97c0668a26680c591143cfd8ebf360ee17a9695f57eab0a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / async_notify-1.6.1-cp312-cp312-win_amd64.whl

Download URL async_notify-1.6.1-cp312-cp312-win_amd64.whl
Size 341.1 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
e6ed7de336c29e9f9da51d4d8703bc73ec5731685aeea5a794a7c693c8ffd680
BLAKE2b-256 checksum
How to use checksums
2cf1ba00065d29a11708abecbc31d51d73eb81aa246d518ec195349d8f2f45f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / async_notify-1.6.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 702.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
fc66af307adf2add2e62a005279bb06ac99e8e3f9adc1f48c07a1ef5c5b3d49a
BLAKE2b-256 checksum
How to use checksums
6e273ec5ec97fb15b34b090e44aaca2d0128e4867eb7c07b0d9383ed619cf894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / async_notify-1.6.1-cp311-cp311-win_amd64.whl

Download URL async_notify-1.6.1-cp311-cp311-win_amd64.whl
Size 342.8 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
fb68c9a50d13cd4eae648f0eab4d3cbe3e40de1fb4cb7e0f009d580ad1409950
BLAKE2b-256 checksum
How to use checksums
15274c1d60520d1c23dbcbdd421e1d5fe80e8cf818e310d037a764affd8396ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / async_notify-1.6.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 668.4 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d3cfa2e89dd11da7a7a725a0408302b7303cc3da2676235c569b84dd5e54f572
BLAKE2b-256 checksum
How to use checksums
d1b196045de91bffb95973ca538c61129215afc447adf75d0b095820d870ac40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

1.6.2

8 release files

This release

1.6.1 This release

8 release files

1.6.0

4 release files

1.5.7

4 release files

1.5.5

3 release files

1.5.4

3 release files

1.5.3

3 release files

1.5.2

3 release files

1.5.1

3 release files

1.5.0

3 release files

1.4.2

4 release files

1.4.1

4 release files

1.4.0

4 release files

1.3.10

4 release files

1.3.9

4 release files

1.3.8

4 release files

1.3.7

4 release files

1.3.6

4 release files

1.3.5

4 release files

1.3.4

4 release files

1.3.3

4 release files

1.3.2

4 release files

1.3.1

4 release files

1.3.0

4 release files

1.2.4

4 release files

1.2.3

3 release files

1.2.2

3 release files

1.2.1

3 release files

1.2.0

3 release files

1.1.5

3 release files

1.1.4

3 release files

1.1.3

3 release files

1.1.2

3 release files

1.1.1

3 release files

1.1.0

3 release files

1.0.1

3 release files

1.0.0

3 release files

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

2 release files

0.9.0

2 release files

0.8.13

2 release files

0.8.12

2 release files

0.8.10

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.27

2 release files

0.5.23

2 release files

0.5.21

2 release files

0.5.20

2 release files

0.5.19

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page