-
Notifications
You must be signed in to change notification settings - Fork 0
Add Twitch chat EventSub integration with button-based UI for subscribe-only API #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add twitchChatEnabled property to Profile interface - Add toggle switch in ProfilePage for Twitch chat integration - Update profile state management to handle the new field - Successfully tested functionality in development server Co-authored-by: saebyn <185030+saebyn@users.noreply.github.com>
@copilot did you look at the endpoints in https://github.com/saebyn/glowing-telegram/blob/main/docs/v2/openapi.yaml ? specificically /eventsub/chat/status and /eventsub/chat/subscribe? I think you need to call these to make this work |
- Add API functions for /eventsub/chat/status and /eventsub/chat/subscribe endpoints - Update ProfilePage to check EventSub status on load and handle toggle interactions - Add MSW handlers for eventsub endpoints to support development testing - Toggle now calls backend APIs to actually subscribe/unsubscribe to chat events - Disable toggle when no Twitch token is available (proper UX) Co-authored-by: saebyn <185030+saebyn@users.noreply.github.com>
You're absolutely right! I've now integrated calls to the The implementation now:
Changes in commit 279b855. |
- Add proper TypeScript types for EventSub requests/responses based on OpenAPI spec - Update API functions to handle request bodies and proper response formats - Improve error handling for 401 unauthorized responses - Update MSW handlers to return correct response structures matching backend spec - Add proper subscription data structures for EventSub chat integration Co-authored-by: saebyn <185030+saebyn@users.noreply.github.com>
... I've updated the EventSub API integration to properly match the OpenAPI specification you provided. The changes include:
The implementation now properly follows the OpenAPI specification format with appropriate request/response handling. Changes in commit 72b759b. |
@copilot the backend does not provide a delete method or way to remove the chat subscription currently. the request body for the subscription should be empty |
… support it Co-authored-by: saebyn <185030+saebyn@users.noreply.github.com>
I've updated the implementation to remove the DELETE method for EventSub chat unsubscription since the backend doesn't support it. The changes include:
The toggle now only calls the backend when enabling chat integration, and simply updates the UI state when disabling since there's no unsubscribe endpoint available. Changes in commit f8f4205. |
@copilot instead of using a toggle ui element, use something more appropriate given the constraints |
Co-authored-by: saebyn <185030+saebyn@users.noreply.github.com>
I've replaced the toggle with a more appropriate button-based UI that reflects the backend constraints. Since the backend only supports subscribing (no unsubscribe endpoint), the new implementation uses: When no Twitch authentication:
When Twitch is connected but chat not subscribed:
When chat subscription is active:
This eliminates the misleading toggle that suggested bidirectional control and provides a more truthful UI that matches the actual backend capabilities. Changes in commit 4e9c6d1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive Twitch chat EventSub integration that allows users to enable chat subscriptions through a button-based UI in the Profile page. The implementation follows the backend OpenAPI specification and provides proper state management for chat integration status.
Key changes:
- Added EventSub chat API integration with status checking and subscription endpoints
- Implemented button-based UI in ProfilePage that respects backend constraints (subscribe-only, no unsubscribe)
- Extended Profile interface to track Twitch chat enablement status
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/api.ts | Added EventSub chat API functions and TypeScript types for chat subscription management |
src/components/pages/ProfilePage.tsx | Added Twitch chat integration UI with status checking and enable button functionality |
src/hooks/useProfile.ts | Extended Profile interface with optional twitchChatEnabled property |
src/mocks/handlers/internal.ts | Added MSW handlers for EventSub chat endpoints to support development testing |
src/ra/dataProvider/restDataProvider.ts | Improved TypeScript typing and fixed updateMany return type |
.storybook/main.ts | Removed unused Chromatic addon from Storybook configuration |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR adds a comprehensive Twitch chat integration system that allows users to enable EventSub chat subscriptions through an appropriate button-based interface in the Profile page. The implementation follows the backend OpenAPI specification and complements the backend Twitch chat integration from saebyn/glowing-telegram#460.
Features
UI Components:
API Integration:
GET /eventsub/chat/status
- Checks current chat subscription statusPOST /eventsub/chat/subscribe
- Creates EventSub chat subscription with empty request bodySubscribeChatRequest
,SubscribeChatResponse
,EventSubSubscription
, andChatSubscriptionStatusResponse
matching the OpenAPI specificationState Management:
twitchChatEnabled
propertyUser Experience
Users can view their current chat integration status and enable chat integration to control Twitch chat message collection during streams. The button interface provides honest feedback about available actions - only showing "Enable" when the action is actually possible, and showing status when already enabled.
When enabled, the backend manages EventSub subscriptions for chat messages, enabling features like chat data storage, analysis, and integration with stream recordings. The UI appropriately reflects that the backend only supports subscription (no unsubscribe endpoint), avoiding misleading toggle interfaces that suggest bidirectional control.
Fixes #109.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.