-
Notifications
You must be signed in to change notification settings - Fork 6
Expose related token for created Ticket #5
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
base: main
Are you sure you want to change the base?
Conversation
|
Are you really not seeing the push tokens in the errors anymore? Because I think we do. |
|
We do get push token on /api/v2/push/send But /api/v2/push/getReceipts would result with this response {
"data": {
"1cf1e47b-50dd-4dd9-ae17-4e1deef855e1": {
"status": "error",
"message": "The recipient device is not registered with FCM.",
"messageEnum": 7,
"messageParamValues": [],
"details": {
"error": "DeviceNotRegistered",
"errorCodeEnum": 3,
"sentAt": 1686110797
},
"__debug": {}
}
}
} |
|
Ok, and before it would give us the push token in THAT error and now it doesn't? If so, I understand this PR and will happily look at it and get it merged :) |
|
Sorry for taking while to reply Based on the this library code I assumed yes it was returning the token in error. But I have no indication of way to confirm what's previous behavior exactly. The issue I saw here expo/expo#7795 indicate some people do get token but I also can't confirm are they hitting send endpoint or the check receipt endpoint. From my latest test expo didn't include such token on checking receipt |
|
By the way @SleeplessByte , sorry it took me so long to reply to you last time. If you have any more questions or need any changes after reviewing, I'll be able to respond pretty quickly going forward. Thanks again for taking a look at this! |
|
@ikusa sorry I didn't get to this. I ended up being hospitalised and didn't touch a computer for half a year (see my GitHub profile). Do you still think this is the best implementation? Should I test it or do you use it already? Let me know where this is at so we can look at getting it merged. |
Background
This pull request aims to address the issue of handling receipts with error status. Currently, the expo-server-sdk-ruby implementation on the
original_push_tokenrelies on field message exposed by the Expo API response to access the push token associated with a receipt.Problem
An issue has been identified (see GitHub issue #7795) where the Expo API response no longer includes the push token for the respective receipt. Consequently, there is currently no way to retrieve the push token from a receipt.
Proposed Solution
To overcome this problem, we propose the following solution: since the Expo API returns the receipt results in the same order as the push notifications are sent, we can determine the token associated with each receipt ID.
Changes
all_recipientsmethod to theChunkclass, which retrieves all the tokens to which push notifications are being sent.tokenparameter to the constructor of theTicketclass.original_push_tokenmethod with the new token supplied in the constructor.token_by_receipt_idmethod, which returns a hash mapping tokens to their respective receipt IDs.Example Usage
Here is a small code snippet demonstrating the usage of the newly added functions:
These changes will enable the retrieval of push tokens associated with receipts, allowing for proper handling of receipts with error status.