Repository navigation
[CHA-5933] feat: add scheduled messages - #242
Open
nijeesh-stream wants to merge 3 commits into
Open
nijeesh-stream wants to merge 3 commits into
nijeesh-stream wants to merge 3 commits into
Conversation
Schedule a message with send_message(scheduled_at=...), and manage scheduled messages with update_scheduled_message, delete_scheduled_message, send_scheduled_message_now and query_scheduled_messages, on both the sync and async clients. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nijeesh-stream
requested review from
10printhello and
slavabobik
as code owners
October 14, 2026 22:22
2 of 3 tasks
mogita
previously approved these changes
Oct 19, 2026
The CI app has chat_scheduled_messages_enabled on, so a disabled feature or a response without scheduled_message must fail the test instead of skipping it. Co-Authored-By: Claude Opus 5.5 <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.
Submit a pull request
CLA
Description of the pull request
TLDR
Lets a backend schedule a chat message to be sent later on behalf of a user, and then edit, cancel, send now or list those scheduled messages. Adds SDK methods only (sync and async). Existing behavior is unchanged unless
scheduled_atis passed.Risk: if
scheduled_atis sent to a backend that does not know it yet, the backend ignores the field and sends the message immediately. The response then has noscheduled_message, which is how callers (and the integration tests) can tell.Ticket
What's added
Channel.send_message(..., scheduled_at=datetime | str): adatetimeis converted to UTC ISO 8601 (naive datetimes are taken as UTC). The response then carriesscheduled_message.update_scheduled_message(scheduled_message_id, message=None, scheduled_at=None)→PATCH /scheduled_messages/{id}(at least one of the two is required).delete_scheduled_message(scheduled_message_id)→DELETE /scheduled_messages/{id}(cancel, or remove a failed one).send_scheduled_message_now(scheduled_message_id)→POST /scheduled_messages/{id}/send_now.query_scheduled_messages(user_id, filter=None, sort=None, options=None)→POST /scheduled_messages/query, mirroringquery_drafts(filter bycidandstatus; sortscheduled_atascending only;limit1-100;nextcursor).stream_chat/types/scheduled_messages.py:QueryScheduledMessagesFilter,QueryScheduledMessagesOptions,ScheduledMessageStatus.docs/messages/scheduled_messages.md(includes thescheduled_message.*events; this SDK does not model event types).Not added:
include_scheduled_messageson channel query. The backend ignores it on server-side requests, so it has no effect from this SDK. App settings for the feature are not exposed by the app settings API.Tests
test_scheduled_messages_unit.py: mock-based tests (liketest_channel_delete.py) for the request each new call sends, sync and async, plus datetime formatting.test_scheduled_messages.pyandasync_chat/test_scheduled_messages.py: integration tests (schedule → query → update → delete, and send now). They skip when the app does not have scheduled messages enabled (scheduled_messages_disabled) or the API does not returnscheduled_message. The flag is set per app by Stream and is not in the app settings API, so the CI app cannot be baselined into it. Against a local backend with the flag off, they skip as intended.black,flake8,mypyclean on the changed files. CHANGELOG is generated at release time, so it is not edited here.🤖 Generated with Claude Code
Note
Medium Risk
New message-send path and tight coupling to a per-app backend flag; on servers that ignore
scheduled_at, messages may send immediately withoutscheduled_messagein the response.Overview
Adds scheduled messages support to the sync and async Stream Chat Python clients, wired to the new
scheduled_messages/*APIs.Scheduling:
Channel.send_message(..., scheduled_at=...)now accepts a UTCdatetimeor ISO 8601 string (viaformat_scheduled_at) and includes that field on the channel message POST when set; responses can includescheduled_messageinstead of publishing immediately.Lifecycle APIs on the client:
update_scheduled_message,delete_scheduled_message,send_scheduled_message_now, andquery_scheduled_messages(filter bycid/status, paginate withlimit/next), with matching abstract methods onStreamChatInterfaceand typed helpers instream_chat/types/scheduled_messages.py.Also adds user-facing docs in
docs/messages/scheduled_messages.mdand unit plus integration tests for request shapes and the schedule → query → update → delete / send-now flows.Reviewed by Cursor Bugbot for commit 7addceb. Bugbot is set up for automated code reviews on this repo. Configure here.