Push Notifications (Python)
Send push notifications to your users' registered devices via the OpenCDP API.
Sending a Push Notification
You must provide user identifiers and a transactional_message_id.
from cdp_client.client import CDPClient
from cdp_client.models import PushPayload, Identifiers
async def push_alert(client: CDPClient):
payload = PushPayload(
identifiers=Identifiers(id="user_456"),
transactional_message_id="new_message_alert",
# Optional: Override template content
title="New Message Received",
body="You have a new message from a colleague.",
# Data payload for custom app logic (e.g., deep linking)
message_data={
"conversation_id": "chat_888",
"priority": "high"
}
)
await client.send_push(payload)
Note on Device Tokens
Before a user can receive a push notification, their device must be registered with the SDK using client.register_device(). See the Basic Usage guide for details.