-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notifications not working when using "non-Mac-Steps" #33
Comments
@figuerb Hi I don't know anything also about the certificates: have you tried with the "official steps" in the Readme? If not, can you try and let me know? It may be possible there is something I didn't knew while creating "non official steps" for Terminal. Also, can you please provide me where you read this thing of notifications? Thank you very much! 😊 |
Thanks for the quick reply. This link here shows a diagram for showing how push notifications work |
I was looking at the same page before. What I was reading in that page, is this sentence:
Are you doing this? So, we have these steps:
And you are blocking in between the last two steps, or, as I don't know how APNs work, after the second step. Are you perhaps receiving a request from the device, with the following info?
Or a one with these?
Another thing I can suggest you is to try to do this: Let me know! |
Hi @alexandercerutti thanks for your prompt responses and sorry for the delayed response. Yesterday was a holiday as you know Regarding the steps I know for sure the registration step is working, I have all the information I need. Push token, device id etc The step where I seem to be stuck on is after I create a notification request. I send a request to Apple's notification server and Apple replies with no error and tells me the notification was received I m going to show you some of the information I am hitting and what is coming from the logging URL too because I did implement that URL
I get the following response
If it had failed we would get data in the failed array instead of sent. So I know Apple received the notification
Here I am outputting snippets in the code to make sure it hits this code and looking in the logs and I see this..
You can see here we hit the URL for
Here I am outputting the card that will be returned and I know this URL is working because as I mentioned, if I go to my card/ pass on my phone and click on info and pull down to refresh, it hits the URL and grabs the right data and updates the pass. The only thing not working here is the notification step :/ I have been checking things over and over and over and the fact that the "update pass" url works when I manually pull to refresh just confirms the problem is the notification step and since I receive a response that says Apple received it, I don't even know what else it could be |
Hi @figuerb Mmm, about your information... wait, which kind of info are you updating? Because, for example, fields emit notifications only if they have an object field called So, are you compliant with Field Dictionary / changeMessage? Furthermore, can I ask you again to retry to generate certificates through the steps in the main README? So through macOS' Keychain Access. Just to try to isolate the issue. Another thing that came in my mind is this: if you have a Mac, you can try to debug through |
Sorry I assumed you were in the United States. Last week was 4th of July so I was off from work Thursday and Friday Regarding changeMessage, what makes you think this field is necessary? Our pass.json does not have a field for it. The documentation says it is Optional and that is probably why it was left out Regarding the last part I will do some research on how to do this. |
@figuerb Don't worry 😊 Okay, let me know! 👍 |
So if are you saying that if I want to receive a notification, I need to add the changeMessage field with the actual field I would like it to send a update notification for? i.e. for the name field I can do the following... {
"formatVersion": 1,
"passTypeIdentifier": "pass.xxx.xxxx.xxxxxxxxxx",
"serialNumber": "xxxxxxxxxx",
"teamIdentifier": "XXXXXXXXXX",
"organizationName": "abc",
"description": "xyz",
"backgroundColor": "rgb(0, 175, 215)",
"secondaryFields": [
{
"key": "name",
"label": "Name",
"changeMessage": "Your name was updated"
}
],
"storeCard": {}
} And if that is the case, do I have to add each field that I want to get a "notification" for? I am going to try to make this change now, I might have an answer before you reply but let me know please. Thanks |
@figuerb Yes about. I've never tried this, but it should be like this: when you insert "changeMessage" in a field with the characters @% (which are mandatory for a notification), those two will be replaced with the key associated to the value that changed. In a field you can have a lot of field, like semantics (they are over 70 if I remember correctly). Anyway, secondaryFields must be inserted under storeCard. |
So doing this in JavaScript using your tool this is what I have const pass = new Pass({
overrides: this.overrides,
...defaults
});
...
pass.secondaryFields.push({
key: 'name',
label: 'Name',
value: cardholderName,
changeMessage: 'Your name has changed'
}); Is this wrong? or does your code add those fields to the storeCard? The |
Apple says this:
So I was wrong about the character sequence and the explanation. Of course, this is valid only if you want to receive a notification for an update to one of the fields. I'm saying this because all the fields, except Anyway, pushing to Wait, no that is not correct: |
That was it. The problem was that we did not have I read through so many of these documents and searched all of the webpages for "notification" and missed "notified" right there in the Anyways, here is the notification I know this is in Apple's documentation but it would be great if you should add something like a notification section that says you must include Regarding the pass.json. We have one with the basics and then when we create the Pass programmatically, we pass that in with the override option and dynamically add the fields etc your docs explain this... For
Anyways, thanks a ton! I really appreciate your help |
Awesome! About the overrides, that is clear, but if you give You should do instead something like: const pass = new Pass({
...
overrides: { ...defaults, ...this.overrides }
}); Anyway, this is not needed: in fact, you can insert your default So, as we resolved this, can I ask you to leave a star ⭐️ to the project? It is really important to me 😊Thank you very much! |
Thanks you for the help! Regarding the pass being passed in, that was a mistake on my part. The defaults object we pass looks like this const defaults = {
model: './passes/membership',
certificates: {
wwdr: './config/security/iOS/certs/AppleWWDRCA.pem',
signerCert: './config/security/iOS/certs/signerCert.pem',
signerKey: {
keyFile: './config/security/iOS/certs/passkey.pem',
passphrase: passphrase
}
},
shouldOverwrite: true
}; and this.overrides looks like this (TypeScript) private get overrides(): Schema.SupportedOptions {
return {
serialNumber: this.card.serialNumber,
webServiceURL: this.webServiceURL,
authenticationToken: authenticationToken
};
} |
Awesome 😉I'm closing this! Thank you for using this package ❤ |
Excellent work helping and excellent work on the package. I appreciate it. Have a good one |
Although I am pretty late at this, but I have been scratching my head for days wondering why am I not receiving any push notification for my Passes even though they are being updated. I forgot adding "changeMessage" in the backfields that I want to update (I am an idiot). Anyways, thanks alot @figuerb for raising this issue as it pointed out my mistake, and not least, @alexandercerutti for this awesome library :). Keep it up 🥇 💯 |
@DevFromPAK don't say you are an idiot, because developing Passes with Apple is always a battle 🤣 |
@alexandercerutti Yeah but changeMessage field was so obvious 😄. Anyway, I am just glad its resolved. Thanksalot 😃 |
@figuerb @alexandercerutti Thanks for all the info. I have setup PK WebServices as per docs. Im able to update my pass Ie: Touch to pull on back of pass says "Updated just now" and shows the changes. But dont get notifications of changes. In "Get Pass" api call I have this header On Get Serial function, I am returning in the body like below: body: {
serialNumbers: ["12312312", "123123"],
lastUpdated : new Date().toUTCString()
} Using Node APN for push Created a token from Apple Dev portal. https://developer.apple.com/account/resources/authkeys/list var apnProvider = new apn.Provider({
token: {
key: AuthKey_xxx.p8", // Path to the key p8 file
keyId: "xxx", // The Key ID of the p8 file
teamId: "nnn", // The Team ID of your Apple Developer Account
},
production: true,
});
var notification = new apn.Notification();
notification.topic = passTypeIdentifier;
notification.payload = { }; I get this response: {
"sent": [
{
"device": "8cxxx4"
}
],
"failed": []
} So Apple sent it successfully I dont get any notifications. {
"key": "aux1",
"label": "Aux1",
"value": "Value",
"row":0,
"textAlignment": "PKTextAlignmentLeft",
"changeMessage": "This changed to %@"
} Now the logs call says there is an error in Get Serial function. Logs only show when there was an error, dont have any logs on success. Dont get any logs during device register, Pass Get or update.
"Get serial" call was getting / couldnt read "last updated (null)". |
I am having an issue getting notifications when using the steps in this link...
non-macOS-steps
Passes should be able to receive notifications if a device id and push token were generated when they first downloaded their pass (this is logic we have in our application to handle on the server and storage/ db level)
I have confirmed that if I update a pass in our database and then do a pull to refresh on a pass, it updates the data so I know it is not my webhooks that are a problem. The webhooks were implemented using these docs...
PassKit Web Service Reference
I continue to receive notification from apple's notification server that they have received my request but the devices registered never receive a notification
I think I have an idea why. I have read that when creating the certificate for a pass, you can select it to allow notification. I think that the instructions in the "non Mac steps" no not seem to have a way to make the certificate receive notifications. Is this correct?
I think in order to receive notifications I would have to re-create the certificate using Apple's developer dashboard, after creating the pass type id and then creating a production certificate to download
Please let me know if this is something you know to be true or if the steps in the "non Mac steps" somehow create a certificate that allows for push notifications
Thanks
The text was updated successfully, but these errors were encountered: