Skip to main content

herfy-push

Web Push SDK for Herfy applications. Send browser push notifications using only your Control Center client_id and client_secret — no VAPID private key handling in app config.

Installation

pip install herfy-push

Usage

from herfy_push import HerfyPushClient, AsyncHerfyPushClient

# Sync
client = HerfyPushClient.from_credentials(
    client_id="app_customer_care",
    client_secret="your_secret",
    control_center_url="https://cc.herfy.com",
)
client.send(
    subscription={"endpoint": "...", "keys": {"p256dh": "...", "auth": "..."}},
    payload={"title": "SLA breach", "body": "Ticket #123", "url": "https://app/tickets/123"},
)

# Async (FastAPI)
client = AsyncHerfyPushClient.from_env()
await client.send(subscription=..., payload=...)
public_key = await client.get_public_key()  # hand to the browser's pushManager.subscribe()

How it works

  1. SDK authenticates with Control Center via POST /oauth/token (cached, TTL configurable via PUSH_TOKEN_CACHE_TTL).
  2. SDK fetches VAPID keys from GET /api/config/push (cached for the client's process lifetime).
  3. SDK sends directly to the browser's push service via the Web Push protocol (pywebpush) — no further Control Center round-trip per send.

Error handling

  • AuthError — Control Center rejected the client credentials.
  • ConfigError — Control Center push config endpoint failed or is missing VAPID keys.
  • PushSubscriptionExpiredError — the push service returned 404/410: the subscription is dead, delete it from your database.
  • SendError — any other send failure.

Environment variables

  • CONTROL_CENTER_URL, AUTH_CLIENT_ID, AUTH_CLIENT_SECRET — required, used by .from_env().
  • PUSH_TOKEN_CACHE_TTL (default 240), PUSH_REQUEST_TIMEOUT (default 15) — optional.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

herfy_push-1.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

herfy_push-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file herfy_push-1.0.0.tar.gz.

File metadata

  • Download URL: herfy_push-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for herfy_push-1.0.0.tar.gz
Algorithm Hash digest
SHA256 283095aee5373219e13b9ef21af62a83f77b5d9d1280b80d573bc84bc20d5397
MD5 8cf276ef15416b3d07eedd8de331451f
BLAKE2b-256 17d1d14a04f5f3e9f1d296727d65c309f3f15476bf56105b8ee1670a8feed609

See more details on using hashes here.

Provenance

The following attestation bundles were made for herfy_push-1.0.0.tar.gz:

Publisher: publish-push-sdk.yml on Herfy-Food-Services/herfy-shared-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file herfy_push-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: herfy_push-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for herfy_push-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87436fa95fb853d0e86dec868370b59516f7bc1135835f584bfc4c1427f9643f
MD5 5bb1e63d5c106590c2b193c04f4c6691
BLAKE2b-256 a733b1936750322a76b7ac09138156f58f197b6ccb8c413c58f5b1a385632211

See more details on using hashes here.

Provenance

The following attestation bundles were made for herfy_push-1.0.0-py3-none-any.whl:

Publisher: publish-push-sdk.yml on Herfy-Food-Services/herfy-shared-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page