Przejdź do treści

Multimedia

Dołącz plik obrazu, wideo lub audio. iOS pobiera i renderuje załącznik bezpośrednio, gdy użytkownik rozwinie powiadomienie; Android wyświetla obrazy.

Notification with rich media attachment on the lock screen
PushWard app detail view of the notification with an inline video player and tap link

The media object

FieldTypeRequiredDescription
media.urlstringYesHTTPS URL to the asset (max 2048 chars). HTTP is rejected.
media.typestringYesOne of image, video, or audio.

The request takes a nested media object; responses flatten it into top-level media_url and media_type fields.

⚠ Ostrzeżenie

Apple enforces strict size caps on notification attachments — image 10 MB, audio 5 MB, video 50 MB. Larger files are silently dropped by the iOS notification service extension and the notification falls back to a plain alert with no media.

Image

JPEG, PNG, GIF, and HEIC are supported. iOS shows the image inline on the lock screen and in the expanded notification. On Android the expanded notification shows it as a large picture, and the notification's detail screen in the app shows it too.

Załącznik z obrazem
curl -X POST https://api.pushward.app/notifications \
  -H "Authorization: Bearer hlk_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Front Door",
    "body": "Someone is at the front door",
    "level": "time-sensitive",
    "media": {
      "url": "https://example.com/snapshots/doorbell.jpg",
      "type": "image"
    },
    "push": true
  }'

Video

MP4 (H.264) is the most reliable format. iOS shows a play button on the inline preview and plays the clip when the user expands the notification. Android has no video in notifications: the notification arrives with its text only.

Załącznik z wideo
curl -X POST https://api.pushward.app/notifications \
  -H "Authorization: Bearer hlk_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Garage Camera",
    "body": "10 seconds of motion captured",
    "level": "time-sensitive",
    "media": {
      "url": "https://example.com/clips/motion.mp4",
      "type": "video"
    },
    "push": true
  }'

Audio

MP3, WAV, and M4A are supported. On iOS the expanded notification shows audio playback controls directly. On Android the notification arrives with its text only.

Załącznik z audio
curl -X POST https://api.pushward.app/notifications \
  -H "Authorization: Bearer hlk_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Voice memo",
    "body": "Tap to expand and play",
    "media": {
      "url": "https://example.com/voice/memo-15s.mp3",
      "type": "audio"
    },
    "push": true
  }'
💡 Wskazówka

Host media on a CDN with cache headers — iOS downloads the attachment on every device that receives the push, and slow downloads can cause the notification to fall back to a plain alert before the asset arrives.