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.2

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.2
File
async_notify-1.6.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
async_notify-1.6.2-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.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
async_notify-1.6.2-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.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
async_notify-1.6.2-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.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
async_notify-1.6.2-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.2-cp314-cp314-win_amd64.whl

Download URL async_notify-1.6.2-cp314-cp314-win_amd64.whl
Size 340.4 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
8ce1a354fda8cf05f80df84f179648865fb43ddb74d3a04a609c9858ef4646b2
BLAKE2b-256 checksum
How to use checksums
acf62ebe13e2d3c6e6d3edaf575c18d282b210113aa9d94be2ec395617eab231
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.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 717.7 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9c0add0fc6116f138eac16a820178e4a8127b988f6a4ded8c02faca344859c89
BLAKE2b-256 checksum
How to use checksums
ca476e0aae374365d87cdeaf943885c465e27abf5c56b49adc75c4085b4d0c4b
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.2-cp313-cp313-win_amd64.whl

Download URL async_notify-1.6.2-cp313-cp313-win_amd64.whl
Size 340.4 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
c85af9f5e735db0b2b49cb26593a12067710e8da0a4a4efa54b2bed4ea702f68
BLAKE2b-256 checksum
How to use checksums
bb76956109eaf177a4a649ee819613ad098922a66de031e572dc6d3252732c0c
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.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 724.3 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d8a29477878c120182a720379342c804f1e5b3cf12520a821364aa97d4a2621c
BLAKE2b-256 checksum
How to use checksums
0de91384db0df98936c53cccb01da13f53eb86cd8b7919e55647a3091b86ba86
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.2-cp312-cp312-win_amd64.whl

Download URL async_notify-1.6.2-cp312-cp312-win_amd64.whl
Size 341.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
0e0bef00cffc49f0168de9f8a03d1a8a9d37bdf2cec6a8439366dbac4e375f22
BLAKE2b-256 checksum
How to use checksums
edc747e0ceb22e07d660a7586c1a700515b13d181b6b895cf7b7506790260236
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.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 703.0 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b1ec425792585f68e4a2352f4336d374007854ba46e2bbd479d320e0e15b468e
BLAKE2b-256 checksum
How to use checksums
2c65fc89484f727e238515fa93aa02e0e6d9d048573bb24020126794a58eb403
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.2-cp311-cp311-win_amd64.whl

Download URL async_notify-1.6.2-cp311-cp311-win_amd64.whl
Size 343.7 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
452f27bc9482bd5ca83aa288a97a278b1c726f97616db97bd45f36c3a0177787
BLAKE2b-256 checksum
How to use checksums
394ce0ff92b825a9fdf33368ae2b03d96d83f25803f9400d7cbd65e284508693
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.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL async_notify-1.6.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 669.3 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b787ad6ecdf4c44f64a9c0284e36be952e030d694dd368aac677c0b0dcf250a3
BLAKE2b-256 checksum
How to use checksums
8917fc5a7cd77272e9b3e3a72a38df5945e78bd96061fcfbd38f540b8208537d
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

This release

1.6.2 This release

8 release files

1.6.1

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