Skip to content

feat!: [CHA-5933] add scheduled messages - #78

Open
nijeesh-stream wants to merge 2 commits into
masterfrom
feat/cha-5933-scheduled-messages
Open

nijeesh-stream wants to merge 2 commits into
masterfrom
feat/cha-5933-scheduled-messages

Conversation

@nijeesh-stream

@nijeesh-stream nijeesh-stream commented Oct 14, 2026 •

Copy link
Copy Markdown

TLDR

Adds Chat scheduled messages to the PHP SDK. SendMessageRequest takes scheduledAt, and the response then carries scheduledMessage instead of posting to the channel. ChatClient gets four methods to manage pending messages: queryScheduledMessages, updateScheduledMessage, sendScheduledMessageNow and deleteScheduledMessage.

This is a plain regeneration from the backend spec, plus one integration test and a one-file marker interface the generator now requires. The SDK was behind chat master, so the regeneration also brings in other API changes (listed below). Two of them break callers, so the title has !.

Risk: merge only after backend CHA-5924 is deployed. Older backends ignore scheduled_at and send the message immediately.

Ticket

Summary

Generated from protocol release openapi-v239.72.0 (chat v239.72.0). Merge after backend CHA-5924 is deployed, because older backends ignore scheduled_at and send immediately.

The first version of this PR was generated from a local spec at chat master 39c07c8b. Regenerating from the release changed only two doc comments, ScheduledMessageResponse and ScheduledMessagesFilter status, from GetStream/chat#18730.

How it was built: generate.sh ran unchanged, with ../chat checked out at tag v239.72.0. Its make openapi output is byte-identical to the protocol release spec. The script runs the generator, generate-webhook-fixtures (no fixture changes), the CallParticipant sed fix, PHP CS Fixer, PHPStan (no errors) and composer dump-autoload. PHP 8.5 and Composer 2 ran from the composer:2 image.

Open PR #77 (regen from v239.67.0) covers a subset of these unrelated changes. This PR supersedes it.

Scheduled messages (backend CHA-5924: GetStream/chat#18596, #18597, #18655, #18656)

  • SendMessageRequest::$scheduledAt and SendMessageResponse::$scheduledMessage
  • ChatClient::queryScheduledMessages() (POST /api/v2/chat/scheduled_messages/query); server-side calls need userID
  • ChatClient::updateScheduledMessage($id, …) (PATCH /api/v2/chat/scheduled_messages/{id})
  • ChatClient::sendScheduledMessageNow($id, …) (POST …/{id}/send_now)
  • ChatClient::deleteScheduledMessage($id) (DELETE …/{id})
  • ChannelStateResponse::$scheduledMessages
  • The ScheduledMessage* models
  • The scheduled_message.sent / scheduled_message.failed webhook events in Webhook

Scheduled messages are off by default per app; Stream turns them on. The new tests/Integration/ChatScheduledMessagesIntegrationTest.php schedules a message, then queries, updates, sends it now, and deletes one. It skips on error 114 (feature disabled) and when the backend ignores scheduled_at. I ran it locally against a chat master server with the feature on, and both tests passed (20 assertions). Integration tests run in the daily job, not on PRs.

MultipartRequest marker (hand-written, src/GeneratedModels/MultipartRequest.php)

Since GetStream/chat#17967 (CHA-5084), the generator marks the four upload request models implements MultipartRequest. The interface itself was meant to ship in a separate SDK PR, which hasn't landed yet. Without it, PHPStan fails and those four classes fatal on load. This PR adds the empty interface only. Client::makeRequest still picks multipart from its own list, so upload behaviour is unchanged. Switching the transport to the marker is left to the CHA-5084 SDK PR.

Unrelated changes picked up since the last release

Breaking:

  • FeedsTrait::getActivity() gained ?bool $skipOwnFollowings before $userID, so positional callers now bind to the wrong parameters.
  • AIVideoConfig::$provider is removed.
  • As usual for this generator, many model constructors gained nullable parameters in the middle of the list (e.g. ActivityResponse, CreatePollRequest, EventHook, SubmitActionRequest). Named-argument callers are unaffected; positional ones are not.

Additive:

  • Chat: queryChannelBans and the ChannelBan* models; cooldownRemainingMs; AppResponseFields::$defaults; poll i18n fields and configKey/configTeam on poll writes; expiresAt on reminders; getPollOption(…, ?string $userID).
  • Common: checkGCPPubSub and GCP Pub/Sub fields on EventHook.
  • Feeds: retention policy get/set/delete/runs, commentFeedback, user interests upsert/delete, skipExisting, async batch follow/unfollow, includeGroupCounts, ranking config, hidden on comments, top-level comment counts, deleteCollections(…, ?bool $hardDelete).
  • Video: queryCallRingAttempts and CallRingSettledEvent.
  • Moderation: intent config and scores, countryCode, delete_poll* review actions, ReviewQueueItemResponse::$poll.

Checklist

  • make lint (PHPStan clean) and make test-unit (322 tests) pass locally on PHP 8.1
  • New integration test, run locally against chat master
  • CI green

🤖 Generated with Claude Code

nijeesh-stream and others added 2 commits October 15, 2026 01:18
Regenerate from chat master 39c07c8b1ce1a145a754e883721796c66467f313,
add the MultipartRequest marker interface the generator now emits, and
cover the scheduled message endpoints with an integration test.

BREAKING CHANGE: getActivity gained $skipOwnFollowings before $userID, so positional callers bind to different parameters; AIVideoConfig::$provider is gone.

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

This branch has not been deployed

No deployments
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.

1 participant