Skip to main content

API Alerts • Python Client

PyPI Python License: MIT

PyPI • GitHub • API Alerts

Effortless project notifications. Send once, deliver everywhere.

Installation

pip install apialerts

Quick Start

from apialerts import ApiAlerts, Event

ApiAlerts.configure('your-api-key')
ApiAlerts.send(Event(message='Deploy complete'))

Usage

Global singleton

Call configure once at startup, then use send / send_async anywhere.

from apialerts import ApiAlerts, Event

ApiAlerts.configure('your-api-key')

# Fire-and-forget. Never raises, silently drops errors.
# Pass debug=True to configure() to log them via stdlib logging.
ApiAlerts.send(Event(message='Deploy complete'))

# Or get the result back. Never raises, check result.success.
result = await ApiAlerts.send_async(Event(message='Deploy complete'))
if result.success:
    print(f'Sent to {result.workspace} ({result.channel})')
else:
    print(f'Error: {result.error}')

Enable debug logging

ApiAlerts.configure('your-api-key', debug=True)

The SDK uses Python's stdlib logging module under the logger name 'apialerts'. Critical errors (missing API key, not yet configured) always log via logger.error(...). Debug success/warning messages log via logger.info(...) and only fire when debug=True. Configure the apialerts logger to route output anywhere you like:

import logging
logging.getLogger('apialerts').setLevel(logging.INFO)
logging.basicConfig()

Event fields

Only message is required. All other fields are optional and omitted from the request body when not set.

from apialerts import Event

event = Event(
    message='Deploy complete',
    channel='releases',
    event='ci.deploy',
    title='Deployed',
    tags=['CI/CD', 'Python'],
    link='https://github.com/apialerts/apialerts-python/actions',
    data={'version': '1.2.0'},
)

result = await ApiAlerts.send_async(event)
Field Type Required Description
message str Yes Human-readable notification text. This is what appears on the push notification lock screen.
channel str No Workspace channel the push notification fires on. Defaults to the workspace default channel when omitted.
event str No Identifies what kind of thing happened. Optional but recommended. Use dotted notation (e.g. ci.deploy.success, payment.failed, user.signup) so routing rules can match glob patterns like ci.* or *.failed.
title str No Short headline some destinations render separately from the message body.
tags list[str] No Categorisation tags for filtering and search.
link str No URL associated with the event. Available as a deeplink for push notifications and as a call-to-action for routed destinations.
data dict[str, Any] No Arbitrary key-value metadata. Available to non-push destinations for templating (Slack message bodies, email templates, webhook payloads).

Send to multiple workspaces

Pass an api_key as the optional second argument to override the configured key for one call.

ApiAlerts.send(Event(message='Deploy complete'), api_key='other-workspace-api-key')

result = await ApiAlerts.send_async(
    Event(message='Deploy complete'),
    api_key='other-workspace-api-key',
)

API

Method Description
ApiAlerts.configure(api_key, debug=False) Initialise the singleton. First call wins; subsequent calls are no-ops.
ApiAlerts.send(event, api_key=None) Fire-and-forget. Never raises, drops errors silently unless debug is on.
ApiAlerts.send_async(event, api_key=None) Awaitable, returns SendResult. Never raises; check result.success.

SendResult fields

Field Type Description
success bool True if the alert was delivered
workspace str or None Workspace name (present on success)
channel str or None Channel name (present on success)
warnings list[str] Non-fatal warnings from the server
error str or None Error message (present on failure)

Links

Metadata

Release files for apialerts 1.2.0

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

Source distribution (sdist)

Source distribution for apialerts 1.2.0
File Size Uploaded Provenance Actions
apialerts-1.2.0.tar.gz 12.1 kB With provenance Details for apialerts-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apialerts 1.2.0
File Interpreter ABI Platform Actions
apialerts-1.2.0-py3-none-any.whl Python 3 none any Details for apialerts-1.2.0-py3-none-any.whl

Total release size: 22.2 kB

Release files / apialerts-1.2.0.tar.gz

Download URL apialerts-1.2.0.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bcd7e13c942bc41d9b91e45d7ba48eabac7a4302d5fcc6b655e9185ce91ab190
BLAKE2b-256 checksum
How to use checksums
3e14b02044df465dd705d15f6e77acca85c6ebf6282507f39cb0942501a3e44b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / apialerts-1.2.0-py3-none-any.whl

Download URL apialerts-1.2.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c942863f8833b413d606d79c76f08f962804215da2bff4fc8fff3212643ec35a
BLAKE2b-256 checksum
How to use checksums
acdf5e9a9840617e52203e5e9c39ce75b2631b91418e1f63e1c021fec70506a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Security for apialerts 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for apialerts-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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