How to add feedback to an app with sign-in
In an app where people sign in, the feedback dialog belongs in the account menu, and each note should be stored with the name and email of its sender so you can write back.
-
Tell the backend who is signed in and who sent a note. The
actor_hookreturns the user’s id, and thesender_hookreturns"Name <email>":def actor(request):uid = request.state.get("user_id") # set by your auth codereturn f"user:{uid}" if uid else Nonedef sender(request):user = current_user(request) # your app's own sign-inreturn f"{user.name} <{user.email}>" if user else Nonett.actor_hook = actortt.sender_hook = senderThe sender replaces anything typed in the dialog’s contact box.
-
Send feedback with your app’s sign-in. Give the browser package the fetch function your app uses for authenticated calls:
import { configure } from './vendor/telltale/telltale-web.js'configure({ authFetch: myAuthedFetch }) -
Open the dialog from your menu, with the floating button hidden:
const [open, setOpen] = useState(false)<MenuItem onClick={() => setOpen(true)}>Send feedback</MenuItem><FeedbackButton open={open} onOpenChange={setOpen} hideTriggersignedInAs={user?.name} showContact={false} />signedInAsshows “Sending as …” in the dialog. If the menu sits inside a header with its own stacking context, renderFeedbackButtonthrough a portal todocument.body, or the dialog can be drawn under other parts of the page. -
Keep signed-out visitors from leaving a contact.
showContact={false}hides the box in the page; on the server, set:Terminal window export TELLTALE_ANON_CONTACT=false -
Check it. Sign in, send a note, and open it in the console as an admin. It shows your name and email. Key holders, such as the reviewer, see the note without the sender.