Trigv home

Search docs

Getting started
  • Overview
  • How Trigv works
Help
  • Send test
  • API keys
  • Channels
  • Image attachments
Guides
  • All guides
  • cURL
  • Laravel
  • AI coding agents
  • Cursor
  • Claude Code
  • OpenAI Codex
  • Other agents
SDKs
  • All SDKs
  • JavaScript
  • Python
  • PHP
  • Go
  • Ruby
  • CLI
API reference
  • API overview
  • POST /api/v1/events
  • Errors & rate limits
  • API security
More
  • OpenAPI spec
Open in ChatGPT ↗ Ask questions about this page Open in Claude ↗ Ask questions about this page Open Markdown https://trigv.com/docs-md/sdks/python.md

Python SDK

Use the official Trigv Python SDK to send push notifications from scripts, cron jobs, backend services, automation workers, and CI pipelines.

Install

Code
pip install trigv

Requires Python 3.10 or newer and has no runtime dependencies beyond the standard library.

Send a notification

Code
import os
from trigv import Trigv

trigv = Trigv(api_key=os.environ["TRIGV_API_KEY"])

result = trigv.send_event(
	{
		"channel": "general",
		"title": "Script finished",
		"description": "Nightly import completed",
		"level": "success",
		"event_type": "script.completed",
	}
)

print(result.event.public_id, result.event.status)

Event fields

FieldRequiredDescription
channelYesChannel slug, such as general, deploys, or payments.
titleYesPush notification title.
descriptionNoBody text shown in the notification.
image_urlNoHTTPS image URL for screenshots, charts, camera snapshots, or previews.
urlNoDestination URL opened from the notification.
levelNoinfo, success, warning, or error. Defaults to info.
delivery_urgencyNostandard or time_sensitive. Defaults to standard.
event_typeNoFree-form event label such as deploy.completed or cron.failed.
idempotency_keyNoDeduplication key for safe retries.

Do not send api_key in the payload. The SDK sends it through the Authorization header.

Safe retries with idempotency

Code
result = trigv.send_event(
	{
		"channel": "deploys",
		"title": "Production deploy complete",
		"idempotency_key": "deploy-prod-42",
	}
)

if result.duplicate:
	print("Already sent:", result.event.public_id)

Configuration

Code
trigv = Trigv(
		api_key="trgv_your_api_key",
		base_url="https://api.trigv.com/api",
		timeout=30.0,
		max_retries=2,
)
OptionDefaultDescription
api_keyTRIGV_API_KEYWorkspace API key.
base_urlhttps://api.trigv.com/apiAPI base URL.
timeout30.0Request timeout in seconds.
max_retries2Retry count for retryable failures.

Verify the API key

Code
connection = trigv.verify_connection()
print(connection.workspace.name)
print(connection.api_key.prefix)

Error handling

Code
from trigv import (
	AuthenticationError,
	AuthorizationError,
	NotFoundError,
	RateLimitError,
	Trigv,
	ValidationError,
)

trigv = Trigv()

try:
	trigv.send_event({"channel": "general", "title": "Hello"})
except ValidationError as exc:
	print(exc.errors)
except AuthenticationError:
	print("Check your API key")
except AuthorizationError:
	print("Key is valid but not allowed")
except NotFoundError:
	print("Channel does not exist")
except RateLimitError as exc:
	print("Retry shortly" if exc.retryable else "Monthly cap reached")

Good places to use it

  • Cron jobs and scheduled scripts
  • Data pipelines, model training runs, and long-running workers
  • Django, Flask, FastAPI, or backend automation code

Additional resources

PyPI PyPI package Install the official Trigv Python SDK from PyPI. Source code View the Python SDK source on GitHub.
Previous JavaScript Next PHP

On this page

    Native push alerts for developers. Send alerts from webhooks, cron jobs, and scripts. We deliver alerts to your devices, but don't keep the message or notification history on our servers.

    Follow @trigvapp →

    Built by Harish Chouhan

    Product

    • Features
    • How it works
    • Pricing
    • Docs
    • Integrations
    • SDKs
    • API
    • Full LLMs text

    Company

    • About
    • Support
    • Changelog

    Legal

    • Terms & Conditions
    • Privacy Policy
    • Cookie Policy
    • API Security
    All systems ok. Get back to coding.

    © 2026 Webtions OU (dba Trigv)