Repository navigation
feat: [SDK-5373] add sessions API client - #1569
Merged
Merged
Conversation
This was referenced Nov 12, 2026
nan-li
approved these changes
Nov 12, 2026
nan-li
left a comment
There was a problem hiding this comment.
Approving, with two small notes:
- A create that returns 2xx without a
session_idkeeps retrying until the 30-day limit. Both native SDKs give up after 3 tries. The session's updates wait behind the create, so a cap seems worth adding, here or in the sender. - A short comment saying these requests are never signed, like the one on
sendOutcome, would save the next reader from wondering about the missing JWT.
Request helpers for POST /apps/{app_id}/sessions and
PATCH /apps/{app_id}/sessions/{session_id}, classifying failures as
retry (network, 5xx, 408, 429, create without session id) or drop.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fadi-george
force-pushed
the
fadi/sdk-5373
branch
from
November 12, 2026 23:10
724d2d2 to
eb4cdb8
Compare
14 of 16 tasks
sherwinski
reviewed
Nov 13, 2026
sherwinski
left a comment
Contributor
There was a problem hiding this comment.
Old sessions did not need JWT for Identity Verification. Can we confirm this is still the case for new session events?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
1 Line Summary
Add
createSession/updateSessionforPOST /apps/{app_id}/sessionsandPATCH /apps/{app_id}/sessions/{session_id}.Details
Motivation
Typed request/response layer for the sessions API, used by the upcoming persistent queue (SDK-5377). Mirrors Android (OneSignal/OneSignal-Android-SDK#2775) and iOS (OneSignal/OneSignal-iOS-SDK#1763).
Scope
src/shared/api/sessions.ts, callable from the service worker, built onapi/base.ts.SessionsApiResultinstead of throwing, like iOS:success(create carriesdata.session_id)retryfor network failure, non-JSON response,5xx,408,429, or a create202without a usable session id. CarriesRetry-Afterwhen present and numeric.dropfor other4xx, or an invalid app id.idempotency_key; a retried create returns the originalsession_id.OneSignal/sessionssessions-http/openapi.yaml: the public create route takessubscription_type(string), notdevice_type. Times are passed as epoch ms and sent as ISO 8601 UTC (2023-11-14T22:13:20.000Z).Retry-Afteron a429without the header; the queue owns backoff.Open questions
SafariLegacyPushis not in the spec'ssubscription_typeenum, so legacy Safari creates would400. Needs a backend decision before wiring.base.tsalready retries network errors up to 5 times with backoff before rejecting, so aretryfrom a network failure can take a couple of minutes. Left as is to avoid changing shared request behavior.Systems Affected
Validation
Tests
Info
sessions.test.ts(msw): request bodies with and without optional fields,202parsing, malformed create responses, retry vs drop by status,Retry-Afterpassthrough and non-numeric values, network failure, non-JSON response, invalid app id.vp check, fullvp test, andbuild:prod(size limits) pass.Not tested in a browser; no callers yet.
Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Checklist
Related Tickets
🤖 Generated with Claude Code