feat(feedback): route in-app feedback to Slack via Cloudflare Worker relay#2745
Open
rabanspiegel wants to merge 6 commits into
Open
feat(feedback): route in-app feedback to Slack via Cloudflare Worker relay#2745rabanspiegel wants to merge 6 commits into
rabanspiegel wants to merge 6 commits into
Conversation
…relay Replace the Discord webhook with a Cloudflare Worker that posts feedback to the team Slack #feedback channel, keeping the Slack bot token out of the shipped app. - Add services/feedback-relay: a Worker that receives feedback (text plus image and diagnostic-log attachments) and forwards it to Slack. It holds the bot token as a secret and enforces an optional shared-secret header. - Add a feedback.submit RPC. The renderer sends feedback to the main process, which POSTs to the relay, so the relay URL and shared secret stay out of the renderer bundle. - Read VITE_FEEDBACK_RELAY_URL and VITE_FEEDBACK_RELAY_SECRET at build time; wire them into release builds via the setup-build action. - Remove the hardcoded Discord webhook and its client-side POST.
Contributor
|
|
||
| const uploadUrl = String(urlData.upload_url); | ||
| const fileId = String(urlData.file_id); | ||
| const putResponse = await fetch(uploadUrl, { method: 'POST', body: file }); |
Contributor
There was a problem hiding this comment.
Misleading variable name for the upload step
The variable is called putResponse but the request uses method: 'POST'. Slack's external-upload URL does in fact expect a POST, so this is functionally correct, but the name implies PUT and will confuse anyone cross-checking against older Slack documentation that described a PUT step. Consider renaming to uploadResponse.
Prompt To Fix With AI
This is a comment left during a code review.
Path: services/feedback-relay/src/index.ts
Line: 110
Comment:
**Misleading variable name for the upload step**
The variable is called `putResponse` but the request uses `method: 'POST'`. Slack's external-upload URL does in fact expect a POST, so this is functionally correct, but the name implies PUT and will confuse anyone cross-checking against older Slack documentation that described a PUT step. Consider renaming to `uploadResponse`.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
The Slack external-upload request uses POST, so putResponse was misleading.
The Cloudflare Worker now lives in generalaction/emdash-server. This repo keeps only the client integration (feedback.submit RPC + build vars).
…k-7r8pr # Conflicts: # apps/emdash-desktop/src/renderer/lib/components/feedback-modal/use-feedback-submit.ts
Contributor
Author
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.
What
In-app feedback now goes to the team Slack #feedback channel instead of a Discord webhook. Feedback text, image attachments, and the opt-in diagnostic log all carry over.
How
services/feedback-relay/— a Cloudflare Worker that receives feedback (multipart/form-data: acontentfield plusfile0…N) and posts it to Slack. It holds the Slack bot token as a Worker secret, so no token ships in the app. Files use Slack's external upload flow; text-only feedback useschat.postMessage. An optional shared-secret header (x-emdash-feedback-secret) lets the Worker reject traffic that doesn't come from the app.feedback.submitRPC — the renderer sends feedback to the main process, which POSTs to the relay. This keeps the relay URL and shared secret out of the renderer bundle.VITE_FEEDBACK_RELAY_URLandVITE_FEEDBACK_RELAY_SECRETat build time. Thesetup-buildaction writes them into.env.productionfor release builds (same mechanism as the PostHog vars); the secret comes from theFEEDBACK_RELAY_SECRETGitHub secret.buildFeedbackContentmoved to its own module so it stays unit-testable without awindow.Why
The Discord webhook URL shipped in the client bundle. Slack gives the team a more visible feedback channel, and issues can be created from Slack via the Linear integration. The Worker keeps the Slack credential server-side.
Notes
services/feedback-relay/is deployed independently and is not part of the pnpm workspace..env.productionCI path itself has not been run end-to-end; it will be confirmed in canary. If theFEEDBACK_RELAY_SECRETGitHub secret is missing or wrong, the relay returns 401 — watchwrangler tailwhen testing.