Skip to content

[CHA-5933] feat: add scheduled messages support - #221

Merged
nijeesh-stream merged 3 commits into
masterfrom
feature/cha-5933-scheduled-messages
Oct 21, 2026
Merged

nijeesh-stream merged 3 commits into
masterfrom
feature/cha-5933-scheduled-messages

Conversation

@nijeesh-stream

Copy link
Copy Markdown
Contributor

TLDR

Adds server-side support for Chat scheduled messages: schedule a message for a user, then edit it, cancel it, send it right away, or list a user's scheduled messages. Backend endpoints are behind a per-app flag and not yet released; merge after backend CHA-5924 ships. Risk is low: the change only adds new methods, and existing calls are untouched.

Linear: https://linear.app/stream/issue/CHA-5933

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

New methods, mirroring the reminders / drafts layout:

Method API
Channel#schedule_message(message, user_id, scheduled_at, **options) POST /channels/{type}/{id}/message with scheduled_at; the response carries scheduled_message
Client#update_scheduled_message(id, message:, scheduled_at:) PATCH /scheduled_messages/{id}
Client#delete_scheduled_message(id) DELETE /scheduled_messages/{id}
Client#send_scheduled_message_now(id) POST /scheduled_messages/{id}/send_now
Client#query_scheduled_messages(user_id, filter:, sort:, **options) POST /scheduled_messages/query (filter.cid, filter.status, limit, next)

scheduled_at accepts DateTime, Time or an RFC 3339 string, normalized like remind_at. Docs: new docs/messages/scheduled_messages.md, plus the scheduled_message.sent / scheduled_message.failed webhook events in docs/webhooks/webhook_events.md. CHANGELOG is left to the release tooling.

Not added: include_scheduled_messages on GetOrCreateChannel (the backend ignores it for server-side calls), app settings (the chat_scheduled_messages_* flags aren't exposed through the app settings API), and a permission constant (the SDK has no list of v2 permission actions).

Tests

  • spec/scheduled_messages_spec.rb: checks the request shape against a stubbed Faraday adapter. It needs no credentials and always runs.
  • spec/client_spec.rb → scheduled messages: live round trip (schedule, query, update, send now, delete). It skips when the app has the feature off (scheduled messages are not enabled) or the backend ignores scheduled_at, so CI stays green until the flag is on for the CI app.
  • Local results: the live specs pass (5/5) against a local backend built from the backend branch feature/cha-5924-scheduled-messages-channel-state, using an app with the flag on. They skip as expected against an app with the flag off. Rubocop and srb tc are clean (no new Sorbet errors).

🤖 Generated with Claude Code

Add Channel#schedule_message (SendMessage with scheduled_at) and
Client#update_scheduled_message, #delete_scheduled_message,
#send_scheduled_message_now and #query_scheduled_messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nijeesh-stream

Copy link
Copy Markdown
Contributor Author

CI note: the 💎 Ruby 3.4 failure is unrelated to this PR. Its lint step runs srb tc, which reports 2 errors from the vendored sorbet/rbi/hidden-definitions/hidden.rbi:9107 (extend ::URI::Escape, which no longer resolves). The docs-only PR #220 fails the same way, and srb tc on master shows the same 2 errors locally. Ruby 3.0 and 3.1 pass. The live scheduled-message specs are pending there because the CI app's backend doesn't return scheduled_message yet.

🤖 Generated with Claude Code

shaljam
shaljam previously approved these changes Oct 19, 2026

@shaljam shaljam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I checked all five methods against the chat backend (routes, payload fields, server-side owner lookup, query filter/sort/cursor) along with the claims in the docs page, and they all match. There's one optional note inline about the live-spec skip.

Comment thread spec/client_spec.rb Outdated
mogita
mogita previously approved these changes Oct 19, 2026
A response without scheduled_message means the backend posted the
message immediately; that is the failure mode the spec should catch.
Keep the skip only for the "scheduled messages are not enabled" error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nijeesh-stream
nijeesh-stream dismissed stale reviews from mogita and shaljam via cff3de4 October 19, 2026 13:23
@nijeesh-stream
nijeesh-stream enabled auto-merge (squash) October 21, 2026 11:22

@shaljam shaljam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nijeesh-stream
nijeesh-stream merged commit 65f5573 into master Oct 21, 2026
10 of 21 checks passed
@nijeesh-stream
nijeesh-stream deleted the feature/cha-5933-scheduled-messages branch October 21, 2026 11:29
@slavabobik slavabobik mentioned this pull request Oct 29, 2026
slavabobik pushed a commit that referenced this pull request Oct 29, 2026
standard-version skipped both: their subjects start with a [CHA-...]
prefix, so they don't parse as conventional commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slavabobik slavabobik mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants