Account-level getMessages with filters and a cursor iterator - #2
Merged
Conversation
getMessages(options) now calls GET /gateway/messages with deviceIds, direction, status, search, from/to, order, and cursor support; the device-scoped getMessages(deviceId, options) form keeps working but is marked deprecated. iterateMessages() follows the pagination cursor to drain every match, which is the loop pollers would otherwise hand-roll. Message gains direction, channel, and device fields. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The SDK is days old with no consumers, so getMessages takes a single options object and always calls the account-level endpoint. Anyone on 0.0.x keeps working against the still-served device-scoped route. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Companion to the API's new GET /gateway/messages endpoint.
getMessages(options)targets the account-level endpoint:deviceIds,smsBatchId,direction,status,search,from/to(Date or string, serialized to the explicit-timezone form the API requires),order,cursor.getMessages(deviceId, options)form is removed rather than deprecated: the SDK just launched with no consumers, so there is nothing to keep compatible. 0.0.x installs keep working against the still-served device-scoped route.iterateMessages(options)is an async generator that followsmeta.nextCursoruntil exhaustion, so pollers do not hand-roll the cursor loop.Messagegainsdirection(lowercase, feeds straight back into filters),channel, and the populateddeviceobject;typeis deprecated in TSDoc.🤖 Generated with Claude Code