Tapback Documentation
Everything you need to integrate microfeedback into your application
Quick Start
Get up and running with Tapback in just 3 steps. No API keys required for basic integration!
Create a Site in Dashboard
Sign up and create your first site in the Tapback dashboard. This gives you a unique site ID for your feedback collection.
https://tapback.dev/register
Add Widget to Your Page
Add the widget container to your HTML where you want the feedback form to appear:
<div data-widget-id="YOUR_WIDGET_UUID" data-source="homepage"></div>
Include the Widget Script
Add the Tapback widget script to your page (preferably before the closing </body> tag):
<script src="https://tapback.dev/widget.js"></script>
That's it!
Your feedback widget is now live and collecting reactions from your users. Check your dashboard to see the results!
Interactive Demo
Try out the Tapback widget with different customization options. See how it looks and behaves in real-time!
Customize Your Widget
Generated Code
<div data-tapback-widget="demo-site" data-source="demo"></div>
Live Preview
Widget preview will appear here
Widget Embedding
The Tapback widget automatically initializes when the page loads. Simply add a container element with the appropriate data attributes.
Basic Usage
<!-- Basic widget with widget UUID -->
<div data-widget-id="your-widget-uuid"></div>
<!-- Widget with custom source tracking -->
<div data-widget-id="your-widget-uuid" data-source="product-page"></div>
<!-- Widget with custom API base -->
<div data-widget-id="your-widget-uuid" data-api-base="https://api.example.com/api"></div>
Required Attributes
data-tapback-widget
- Your site or widget UUIDdata-source
- Identifier for the page/section (optional, defaults to "default")
Customization
Customize the appearance and behavior of your Tapback widgets using data attributes.
Attribute | Values | Default | Description |
---|---|---|---|
data-primary-color | CSS color | #3B82F6 | Active emoji button color |
data-secondary-color | CSS color | #6B7280 | Button border color |
data-background-color | CSS color | #FFFFFF | Widget background |
data-text-color | CSS color | #1F2937 | Text color |
data-font-size | small, medium, large | medium | Font size |
data-border-radius | small, medium, large | medium | Border radius |
data-show-branding | true, false | true | Show Tapback branding |
data-layout-type | horizontal, vertical, grid, compact | horizontal | Layout arrangement |
Customization Example
<div
data-widget-id="your-widget-uuid"
data-source="hero-section"
data-primary-color="#10B981"
data-secondary-color="#374151"
data-background-color="#F9FAFB"
data-text-color="#111827"
data-font-size="large"
data-border-radius="large"
data-layout-type="vertical"
data-show-branding="false"
></div>
API Overview
Tapback provides a RESTful API for managing sites, widgets, and reactions. All API endpoints are versioned under /api/v1
.
Base URL
https://your-domain.com/api/v1
Authentication
Most API endpoints require authentication using API tokens. Include your token in the Authorization header:
Authorization: Bearer YOUR_API_TOKEN
Response Format
All API responses are returned in JSON format with appropriate HTTP status codes.
Sites API
The Sites API is the recommended way to organize your feedback collection. Sites can contain multiple widgets and provide better organization.
List Sites
GET /api/v1/sites
Retrieve all sites for the authenticated user
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://your-domain.com/api/v1/sites
Create Site
POST /api/v1/sites
Create a new site
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "My Website", "domain": "example.com"}' \
https://your-domain.com/api/v1/sites
Request Body
{
"name": "string (required, max 255 chars)",
"domain": "string (optional, max 255 chars)",
"settings": "object (optional)"
}
Get Site
GET /api/v1/sites/{uuid}
Retrieve a specific site with its reactions
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://your-domain.com/api/v1/sites/SITE_UUID
Update Site
PUT /api/v1/sites/{uuid}
Update site settings
curl -X PUT \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Name"}' \
https://your-domain.com/api/v1/sites/SITE_UUID
Delete Site
DELETE /api/v1/sites/{uuid}
Delete a site and all associated data
curl -X DELETE \
-H "Authorization: Bearer YOUR_TOKEN" \
https://your-domain.com/api/v1/sites/SITE_UUID
Site Analytics
GET /api/v1/sites/{uuid}/analytics
Get analytics data for a site
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://your-domain.com/api/v1/sites/SITE_UUID/analytics
Widgets API
The Widgets API is maintained for backwards compatibility. For new implementations, consider using the Sites API instead.
List Widgets
GET /api/v1/widgets
Retrieve all widgets for the authenticated user
Create Widget
POST /api/v1/widgets
Create a new feedback widget
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Product Feedback",
"question": "How helpful was this feature?",
"emoji_set": ["👍", "👎"]
}' \
https://your-domain.com/api/v1/widgets
Request Body
{
"name": "string (required, max 255 chars)",
"question": "string (optional, max 255 chars)",
"emoji_set": "array (required, 1-10 emojis, max 8 chars each)"
}
Update Widget
PUT /api/v1/widgets/{uuid}
Update widget settings
curl -X PUT \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"emoji_set": ["👍", "😐", "👎"]}' \
https://your-domain.com/api/v1/widgets/WIDGET_UUID
Widget Analytics
GET /api/v1/widgets/{uuid}/analytics
Get analytics data for a widget
Reactions API
The Reactions API handles collecting and retrieving user feedback. It supports both site-based and widget-based reactions.
Submit Reaction
POST /api/v1/reactions
Submit a reaction to a widget or site
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"widget_id": "SITE_OR_WIDGET_UUID",
"source": "homepage",
"emoji": "👍"
}' \
https://your-domain.com/api/v1/reactions
Request Body
{
"widget_id": "string (required, UUID of site or widget)",
"source": "string (required, max 64 chars, alphanumeric + dash)",
"emoji": "string (required, max 8 chars, valid emoji)"
}
Headers (Optional)
X-Session-Hash: "unique_session_identifier"
Get Reactions
GET /api/v1/reactions
Retrieve reactions (rate limited)
curl https://your-domain.com/api/v1/reactions
Important Notes
- • Reactions are rate limited to 20 per minute per IP/session
- • Duplicate reactions from the same session are prevented
- • The API automatically detects whether you're using a site or widget UUID
- • Session tracking helps prevent spam while maintaining user privacy
Authentication
API tokens are used to authenticate requests to protected endpoints. You can manage your tokens through the API.
Create Token
POST /api/v1/tokens
Create a new API token
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "My API Token"}' \
https://your-domain.com/api/v1/tokens
Response
{
"token": "plain_text_token_here",
"id": "token_id",
"name": "My API Token"
}
List Tokens
GET /api/v1/tokens
List all your API tokens
Delete Token
DELETE /api/v1/tokens/{id}
Revoke an API token
Security Best Practices
- • Keep your API tokens secure and never expose them in client-side code
- • Use different tokens for different applications or environments
- • Regularly rotate your tokens
- • Monitor token usage for any suspicious activity
Code Examples
Ready-to-use code examples for popular frameworks and languages. Copy, paste, and customize!
React Component
import { useEffect } from 'react';
function FeedbackWidget({ siteId, source = 'default', className = '' }) {
useEffect(() => {
const script = document.createElement('script');
script.src = 'https://tapback.dev/widget.js';
script.async = true;
document.body.appendChild(script);
return () => {
const existingScript = document.querySelector('script[src="https://tapback.dev/widget.js"]');
if (existingScript) {
document.body.removeChild(existingScript);
}
};
}, []);
return (
<div
data-tapback-widget={siteId}
data-source={source}
className={className}
></div>
);
}
export default FeedbackWidget;
Usage Example
import React from 'react';
import FeedbackWidget from './components/FeedbackWidget';
function App() {
return (
<div className="App">
<h1>My Website</h1>
<p>Welcome to our amazing product!</p>
<FeedbackWidget
siteId="your-site-uuid"
source="homepage"
className="mt-8"
/>
</div>
);
}
export default App;
Rate Limiting
Tapback implements rate limiting to ensure fair usage and prevent abuse of the API.
Endpoint | Limit | Window | Description |
---|---|---|---|
POST /reactions | 20 requests | 1 minute | Submit reactions |
GET /reactions | 60 requests | 1 minute | Retrieve reactions |
Public endpoints | 60 requests | 1 minute | Emoji sets, analytics |
Rate Limit Headers
API responses include rate limit information in headers:
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 15
X-RateLimit-Reset: 1640995200
Need help? Check out our support page or visit our GitHub repository.
API Overview
Tapback provides a comprehensive RESTful API for managing sites, widgets, and reactions. All endpoints are versioned and include rate limiting.
Base URL
https://tapback.dev/api/v1
Authentication
Most endpoints require API key authentication
Authorization: Bearer YOUR_API_KEY
Quick Start with API
Get started with the API by creating your first site and generating an API key.
API Playground
Test API endpoints directly in your browser. No setup required!
Make API Request
Response
Response will appear here...
Authentication
API tokens are used to authenticate requests to protected endpoints. You can manage your tokens through the dashboard or API.
Creating API Tokens
Create API tokens through your dashboard or using the API. Each token has a name and optional expiration date.
POST https://tapback.dev/api/v1/tokens
Authorization: Bearer YOUR_EXISTING_TOKEN
Content-Type: application/json
{
"name": "My API Token",
"expires_at": "2024-12-31T23:59:59Z"
}
Response
{
"id": "123",
"name": "My API Token",
"key": "tb_ABC123DEF456GHI789JKL012",
"is_active": true,
"expires_at": "2024-12-31T23:59:59Z",
"created_at": "2024-01-01T00:00:00Z"
}
Security Best Practices
- • Keep your API tokens secure and never expose them in client-side code
- • Use different tokens for different applications or environments
- • Regularly rotate your tokens
- • Monitor token usage for any suspicious activity
Sites API
The Sites API is the recommended way to organize your feedback collection. Sites can contain multiple widgets and provide better organization.
List Sites
GETRetrieve all sites for the authenticated user
curl -H "Authorization: Bearer YOUR_TOKEN" https://tapback.dev/api/v1/sites
Create Site
POSTCreate a new site for feedback collection
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "My Website", "domain": "example.com"}' \
https://tapback.dev/api/v1/sites
Response
{
"id": "123",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Website",
"domain": "example.com",
"user_id": "456",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}