Skip to content

feat(webchat): customizable CSAT rating in chat widget#52

Draft
rgrjnr wants to merge 1 commit into
masterfrom
claude/peaceful-cerf-bavqlw
Draft

feat(webchat): customizable CSAT rating in chat widget#52
rgrjnr wants to merge 1 commit into
masterfrom
claude/peaceful-cerf-bavqlw

Conversation

@rgrjnr

@rgrjnr rgrjnr commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a Customer Satisfaction (CSAT) rating to the webchat widget. When a conversation ends, visitors are shown a 1–5 emoji scale under a prompt that defaults to "How would you rate the support you received today?". Both the prompt text and an enable/disable toggle are configurable per‑organization from the dashboard webchat settings page.

What changed

Backend

  • webchat_settings: new csat_enabled (bool, default true) and csat_question (text, default copy) columns.
  • conversations: new csat_rating (smallint, nullable) and csat_rated_at (timestamptz, nullable) columns — one rating per conversation, no new table.
  • Migration 1781300000000-AddCsatToWebchat.
  • publicConversations.submitCsat mutation — DPoP‑verified like sendMessage, with NONCE_EXPIRED retry support.
  • webchat.getPublicConfig now returns the CSAT config; getMessages returns the existing csatRating.
  • webchat.updateSettings accepts the new fields.

Widget

  • New CsatRating.vue (emoji scale + thank‑you state), rendered in the existing closed‑conversation footer when CSAT is enabled.
  • useChat.submitCsat posts the rating via DPoP; already‑rated conversations restore the thank‑you state on load/refresh.
  • CSAT strings (csat.defaultQuestion, csat.thankYou) added across all 13 widget locales.

Dashboard

  • New "Customer Satisfaction (CSAT)" card on the webchat settings page (enable toggle + question textarea), wired through load/save.
  • en and pt-BR settings strings.

How it works

The rating is shown only when the conversation is closed/resolved (reusing existing closure detection) and CSAT is enabled. The default question lives in the DB and is served to the widget via the public config endpoint, so changes in settings take effect without re‑embedding.

Verification

  • npm run typecheck:server — ✅ pass
  • npm run typecheck:dashboard — ✅ pass (exit 0)
  • webchat build — ✅ pass; typecheck clean (only the pre‑existing, unrelated fake-indexeddb test‑setup error remains)

Note

A DB migration is included — run npm run migration:run before deploying.

🤖 Generated with Claude Code


Generated by Claude Code

@rgrjnr

rgrjnr commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Status check (2026-07-14 branch audit): Feature is complete and coherent (~550 insertions across 29 files: CsatRating.vue, conversation entity + migration 1781300000000-AddCsatToWebchat, public-conversations endpoints, dashboard settings, 13 locales). Zero trace of CSAT in master — not superseded, just parked since 2026-06-17.

Next steps:

  • Rebase onto current master (customer-identity and conversation-view changes landed since)
  • Verify the migration timestamp still sorts after the latest master migrations
  • Review + un-draft, or close if CSAT is off the roadmap

Show a 1–5 emoji satisfaction rating when a conversation ends. The prompt
("How would you rate the support you received today?") and an enable toggle
are configurable per-organization from the dashboard webchat settings page.

Backend
- webchat_settings: csat_enabled, csat_question
- conversations: csat_rating, csat_rated_at
- migration AddCsatToWebchat
- publicConversations.submitCsat (DPoP-verified); getPublicConfig and
  getMessages expose CSAT config / existing rating

Widget
- CsatRating.vue (emoji scale + thank-you) in the closed-conversation footer
- useChat.submitCsat with NONCE_EXPIRED retry; restores thank-you state for
  already-rated conversations
- CSAT strings across all 13 locales

Dashboard
- CSAT settings card (toggle + question), wired through load/save (en, pt-BR)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TCDQXq5krP6d9Wi2NBCyam
@rgrjnr
rgrjnr force-pushed the claude/peaceful-cerf-bavqlw branch from eb81f5c to 3788e2f Compare July 14, 2026 17:24
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.

2 participants