:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { z } from 'zod'
export const PushNotificationPayloadSchema = z.object({
// `android_data_only` leaves the notification out on Android so the app draws it, and still shows it on iOS.
// `silent` shows nothing on any device and only wakes the app with the data.
delivery: z.enum(['notification', 'android_data_only', 'silent']).optional(),
// Common notification fields
title: z.string().optional(),
body: z.string().optional(),
image: z.string().url().optional(),
data: z.record(z.string(), z.string()).optional(),
collapseKey: z.string().optional(),
ttlSeconds: z.number().int().min(0).optional(),
// Android-specific overrides (used by FCM)
android: z
.object({
priority: z.enum(['normal', 'high']).optional(),
channelId: z.string().optional(),
sound: z.string().optional(),
tag: z.string().optional(),
icon: z.string().optional(),
color: z.string().optional(),
clickAction: z.string().optional(),
})
.optional(),
// iOS-specific overrides (used by FCM APNS bridge and direct APNS)
apns: z
.object({
sound: z
.union([
z.string(),
z.object({
name: z.string(),
critical: z.boolean().optional(),
volume: z.number().min(0).max(1).optional(),
}),
])
.optional(),
badge: z.number().int().optional(),
category: z.string().optional(),
threadId: z.string().optional(),
interruptionLevel: z.enum(['passive', 'active', 'time-sensitive', 'critical']).optional(),
relevanceScore: z.number().min(0).max(1).optional(),
subtitle: z.string().optional(),
contentAvailable: z.boolean().optional(),
mutableContent: z.boolean().optional(),
targetContentId: z.string().optional(),
})
.optional(),
})