Configures NotificationClient handlers, implements async dispatch workflows, and handles DispatchError failures for the pidge v3 notification library in async Python services. Use when working with pidge, pidge v3, pidge notifications, NotificationClient, async notifications, or pidge integration — including setting up API keys, dispatching messages, and handling delivery errors.
config = NotificationConfig(api_key=os.environ.get("PIDGE_API_KEY", ""))
async with NotificationClient(config=config) as client:
msg = Message(to=email, subject=subject, body=body)
result = await client.dispatch(msg)
The result object returned by client.dispatch() confirms delivery. Check its properties before trusting the send succeeded:
result = await client.dispatch(msg)
if result.success:
logger.info("Notification dispatched: id=%s", result.message_id)
notification_sent = True