Closed spock123 closed 1 year ago
@spock123 All set - released in 11.1.0 https://github.com/AndrewBarba/apns2/releases/tag/11.1.0
@spock123 how did you go about using the pass's certificate and key to send the push notification?
@tjcarrel It sounds like you only need to match the topic
to passKitType
.
So for example if passKitType = com.example.Acme.PassKit
then you could:
import { SilentNotification } from 'apns2'
const notification = new SilentNotification(deviceToken, {
topic: 'com.example.Acme.PassKit'
})
client.send(notification)
@AndrewBarba appreciate the quick response!
Apple's documentation made it seem like I needed to use the same certificate and private key used to generate the pass. Turns out I can just use a normal APNS2 key along with the code you provided.
When using PassKit, (Apple Wallet), the server sends a silent notifications to those clients that should update their wallet passes.
This is done by sending a Silent Notification. However, this library does not allow for setting the topic when creating a SilentNotification.
PassKit requires the topic to match the passKitType. The issue is that if you have more than 1 passKit type, (example: bookings and membership cards), it's not possible to specify them when creating the SilentNotification.
The only way is to set a default topic when creating the client. But that means that we need to create a new client instance for each type of wallet pass that we support.
It would be really beneficial if SilentNotification would accept a topic to be sent.
Imagine a company with 10 wallet pass type (booking, giftcard etc), they'd be required to create 10 different clients.
Thanks in advance