Feedback
Collecting feedback shouldn’t mean standing up a backend, configuring email forwarding, or wiring up a third-party service. One SDK call sends a user’s thoughts to your Tribe dashboard, and that’s it.
Basic usage
Section titled “Basic usage”import { Tribe } from "@tribecloud/sdk";
await tribe.feedback("Love the new dashboard!");That single line sends feedback to Tribe, where it shows up in your dashboard. Nothing else to set up.
Add metadata
Section titled “Add metadata”You can attach a feedback type and an optional email address for follow-up:
await tribe.feedback("The export button is broken", { type: "bug",});Common types: "bug", "feature-request", "general"
Build a feedback form
Section titled “Build a feedback form”function FeedbackForm() { const [message, setMessage] = useState(""); const [type, setType] = useState("general"); const [sent, setSent] = useState(false); const [error, setError] = useState("");
const handleSubmit = async (e) => { e.preventDefault(); try { await tribe.feedback(message, { type }); setSent(true); } catch (err) { setError(err.message); } };
if (sent) return <p>Thanks for your feedback!</p>;
return ( <form onSubmit={handleSubmit}> <select value={type} onChange={(e) => setType(e.target.value)}> <option value="general">General</option> <option value="bug">Bug Report</option> <option value="feature-request">Feature Request</option> </select> <textarea value={message} onChange={(e) => setMessage(e.target.value)} placeholder="What's on your mind?" required /> {error && <p style={{ color: "red" }}>{error}</p>} <button type="submit">Send Feedback</button> </form> );}<form id="feedback-form"> <select id="feedback-type"> <option value="general">General</option> <option value="bug">Bug Report</option> <option value="feature-request">Feature Request</option> </select> <textarea id="feedback-message" placeholder="What's on your mind?" required></textarea> <button type="submit">Send Feedback</button></form>
<script src="https://api.tribe.utopian.build/sdk.js?site=YOUR_SITE_ID" defer></script><script defer> document.getElementById("feedback-form").addEventListener("submit", async (e) => { e.preventDefault(); try { await Tribe.feedback( document.getElementById("feedback-message").value, { type: document.getElementById("feedback-type").value } ); alert("Thanks for your feedback!"); } catch (err) { alert("Error: " + err.message); } });</script>Dashboard
Section titled “Dashboard”All feedback lands in the Tribe dashboard under your site’s Feedback section. You’ll see:
- The message itself
- The feedback type
- When it was submitted
- Which user sent it, if they were logged in