Repository navigation
[CHA-5933] feat: support scheduled messages - #278
Open
nijeesh-stream wants to merge 4 commits into
Open
nijeesh-stream wants to merge 4 commits into
nijeesh-stream wants to merge 4 commits into
Conversation
Message.send gains scheduledAt, and its response carries the stored scheduled message. A new ScheduledMessage model lists (query), edits (update), cancels (delete) and sends early (sendNow) the scheduled messages of any user. Event reads scheduled_message and message_id for the scheduled_message.* events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The v1 API returns a scheduled message's custom fields as top-level keys of its message object, as for regular messages, not under "custom". Drop the custom field so they land in getAdditionalFields(), as on Message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
TLDR
Backends can now schedule a chat message to be sent later, on behalf of any user, and then list, edit, cancel or send early those scheduled messages.
Message.send(...).scheduledAt(date)stores the message instead of sending it; the newScheduledMessageclass covers the rest. Risk is low: the change is additive (one new optional request field, two new optional response fields, one new model and service). The backend endpoints are behind a per-app flag and not yet released, so merge after backend CHA-5924 ships.Ticket
CHA-5933
CLA
Description of the pull request
Backend endpoints are behind a per-app flag and not yet released; merge after backend CHA-5924 ships.
API surface
Message.send(type, id).scheduledAt(date)POST /channels/{type}/{id}/messagewithscheduled_at; response gainsscheduled_messageScheduledMessage.query().userId(..).filter(..).sort(..).limit(..).next(..)POST /scheduled_messages/query(user_idis required server-side; filtercidandstatus; onlyscheduled_atascending; limit 1-100, default 20; cursornext)ScheduledMessage.update(id).message(..).scheduledAt(..)PATCH /scheduled_messages/{id}(either or both)ScheduledMessage.delete(id)DELETE /scheduled_messages/{id}(cancel, or remove a failed one)ScheduledMessage.sendNow(id)POST /scheduled_messages/{id}/send_nowScheduledMessagemirrors the backendScheduledMessageResponse:id,cid,user,message(content without an ID;mentioned_usersholds user IDs),scheduled_at,status,failure_reason,created_at,updated_at, andchannel(query results only). Status values are exposed asSTATUS_*constants.EventgainsscheduledMessageandmessageId(the sent message's ID onscheduled_message.sent).docs/messages/scheduled_messages.md.Not added, on purpose:
include_scheduled_messageson GetOrCreateChannel: the backend marks itignore_if_server_side, so it does nothing for a server SDK.chat_scheduled_messages_enabled, max lead time): not exposed through the app settings API.CHANGELOG.md: generated at release time.How to verify
./gradlew test --tests '*ScheduledMessageTest*'passes (8 serialization tests, no API credentials needed)../gradlew spotlessCheck javadocpasses.ScheduledMessageIntegrationTest(schedule, query, update, delete, send now against a real app) runs only withSTREAM_SCHEDULED_MESSAGES_ENABLED=true, because the feature is behind a per-app flag that is off on the CI app. It has not been run yet: no app with the feature is available until the backend ships.🤖 Generated with Claude Code