From c38015a65e460b2e1db7edc61f9e83f885cf8ad4 Mon Sep 17 00:00:00 2001 From: Ruslan Ushakov Date: Thu, 26 Feb 2026 18:10:54 +0300 Subject: [PATCH] Capture apns-update-token response header for Live Activity start pushes When payload contains "input-push-token": 1 (iOS 18+), APNs returns a new push token in the apns-update-token header. Add ApnsUpdateToken field to Response and populate it in PushWithContext. Co-Authored-By: Claude Sonnet 4.6 --- client.go | 1 + response.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/client.go b/client.go index c389bd74..46d38d14 100644 --- a/client.go +++ b/client.go @@ -205,6 +205,7 @@ func (c *Client) PushWithContext(ctx Context, n *Notification) (*Response, error r := &Response{} r.StatusCode = response.StatusCode r.ApnsID = response.Header.Get("apns-id") + r.ApnsUpdateToken = response.Header.Get("apns-update-token") decoder := json.NewDecoder(response.Body) if err := decoder.Decode(r); err != nil && err != io.EOF { diff --git a/response.go b/response.go index 99d63456..dd5f13e9 100644 --- a/response.go +++ b/response.go @@ -132,6 +132,11 @@ type Response struct { // If the value of StatusCode is 410, this is the last time at which APNs // confirmed that the device token was no longer valid for the topic. Timestamp Time + + // ApnsUpdateToken is returned by APNs when the notification payload contains + // "input-push-token": 1. It can be used to send subsequent Live Activity + // update pushes without waiting for the app to register the token. + ApnsUpdateToken string } // Sent returns whether or not the notification was successfully sent.