Repository navigation
[CHA-5933] feat: add scheduled messages support - #219
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
Add SendMessageOptions.ScheduledAt and ScheduleMessageAsync (SendMessage with scheduled_at), plus UpdateScheduledMessageAsync, DeleteScheduledMessageAsync, SendScheduledMessageNowAsync and QueryScheduledMessagesAsync, the ScheduledMessage models, and the scheduled_message fields on GenericMessageResponse and EventResponse. A scheduled send leaves out is_pending_message when it is false: the API rejects scheduled_at combined with any pending field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d_at Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Leaving out is_pending_message: false made scheduled sends into channel types that mark messages pending fail with pending_not_supported, while the same live send succeeds. The API accepts false with scheduled_at since GetStream/chat#18727. 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.
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 adds new methods and nullable fields. One send-path tweak applies only when
ScheduledAtis set (details below).Linear: https://linear.app/stream/issue/CHA-5933
CLA
Description of the pull request
New
IMessageClientmethods, next to the reminder methods:ScheduleMessageAsync(type, id, msg, userId, scheduledAt, options), orSendMessageAsyncwithSendMessageOptions.ScheduledAtPOST /channels/{type}/{id}/messagewithscheduled_at; the response's newGenericMessageResponse.ScheduledMessageis setUpdateScheduledMessageAsync(id, UpdateScheduledMessageRequest)PATCH /scheduled_messages/{id}DeleteScheduledMessageAsync(id)DELETE /scheduled_messages/{id}SendScheduledMessageNowAsync(id)POST /scheduled_messages/{id}/send_nowQueryScheduledMessagesAsync(QueryScheduledMessagesRequest)POST /scheduled_messages/query(UserId,Filter.Cid,Filter.Status,Sort,Limit,Next)Models (
src/Models/ScheduledMessage.cs):ScheduledMessage,ScheduledMessageContent(custom fields viaGetData),ScheduledMessageLocation,ScheduledMessageChannel, the request and response types, and theScheduledMessageStatus/ScheduledMessageFailureReasonstring constants.EventResponsegainsScheduledMessageandMessageId, soWebhookHelpers.ParseEventexposes thescheduled_message.sent/.failedwebhooks.Send-path note:
SendMessageAsyncalways sendsis_pending_message(falseby default), and scheduled sends do the same, exactly like a live send. An explicitfalseoverrides the channel type'smark_messages_pendingsetting, so a scheduled message into such a channel is sent normally instead of failing withpending_not_supported. Requires a backend with GetStream/chat#18727, which acceptsis_pending_message: falsewithscheduled_at(older backends answered 400scheduled_at cannot be combined with pending). Merge and release only after that is deployed everywhere.IsPendingMessage = truewithScheduledAtis still rejected by the API.Docs: new
docs/messages/scheduled_messages.md, plus the webhook events indocs/webhooks/webhook_events.md. CHANGELOG is left to the release tooling.Not added:
include_scheduled_messageson GetOrCreateChannel (the backend ignores it for server-side calls), app settings (thechat_scheduled_messages_*flags aren't exposed through the app settings API), and a permission constant (Resourceonly lists legacy v1 permissions).Tests
tests/ScheduledMessageRequestTests.cs: checks request and response shapes, and webhook parsing, against a stubbedHttpMessageHandler. It needs no credentials and always runs.MessageClientTests: live round trip (schedule, query, update, send now, delete). It callsAssert.Ignorewhen the app has the feature off or the backend ignoresscheduled_at, so CI stays green until the flag is on for the CI app.feature/cha-5924-scheduled-messages-channel-state, using an app with the flag on. They show as ignored against an app with the flag off. The net6.0 build has no new warnings.🤖 Generated with Claude Code