feedback-bot-kit
v1.0.1
Published
Feedback system with Telegram bot, GitHub issues, and optional AI agent triggers
Downloads
51
Maintainers
Readme
feedback-bot-kit
Collect user feedback from your Next.js app. Creates GitHub issues automatically, sends Telegram notifications, captures screenshots, and can trigger AI agents to auto-fix bugs.
Environment Variables
# Required
GITHUB_TOKEN=ghp_xxx # GitHub token (setup below)
GITHUB_REPO=owner/repo # Your repo in owner/repo format
# Optional - Telegram notifications
TELEGRAM_BOT_TOKEN=123456:ABC # From @BotFather (setup below)
TELEGRAM_CHAT_ID=-100xxx # Chat ID to receive notifications
# Optional - Screenshot storage (any S3-compatible)
S3_ENDPOINT=https://xxx.r2.cloudflarestorage.com
S3_ACCESS_KEY_ID=xxx
S3_SECRET_ACCESS_KEY=xxx
S3_BUCKET=feedback
S3_PUBLIC_URL=https://your-public-url.com
# Optional - AI agent webhook
FEEDBACK_AGENT_WEBHOOK_URL=https://your-webhook.com
FEEDBACK_AGENT_WEBHOOK_SECRET=optional-bearer-tokenGitHub Setup
- Go to github.com/settings/tokens
- Click Generate new token (classic)
- Select the
reposcope (orpublic_repofor public repos only) - Copy the token → set as
GITHUB_TOKEN - Set
GITHUB_REPOto your repo (e.g.,myusername/myproject)
Optional - Create labels (auto-applied to issues):
gh label create bug --color d73a4a
gh label create enhancement --color a2eeef
gh label create user-feedback --color 0e8a16Telegram Setup
- Open Telegram and message @BotFather
- Send
/newbotand follow the prompts to create your bot - Copy the token → set as
TELEGRAM_BOT_TOKEN - Get your chat ID:
- Add @userinfobot to your chat, or
- Check
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdatesafter sending a message
- Set
TELEGRAM_CHAT_ID - After deploying your app, register the webhook by visiting:
https://yourapp.com/api/telegram/webhook?action=setup - Test by sending
/startto your bot
Bot Commands:
| Command | Description |
|---------|-------------|
| /new | Create new issue |
| /issues | List open issues |
| /issues bug | Filter by label |
| /close 123 | Close issue #123 |
Screenshot Storage (Optional)
Without storage configured, issues are created without screenshots. Any S3-compatible storage works:
Cloudflare R2 (free tier):
S3_ENDPOINT=https://ACCOUNT_ID.r2.cloudflarestorage.com
S3_ACCESS_KEY_ID=xxx
S3_SECRET_ACCESS_KEY=xxx
S3_BUCKET=feedback
S3_PUBLIC_URL=https://pub-xxx.r2.devAWS S3:
S3_ENDPOINT=https://s3.us-east-1.amazonaws.com
S3_ACCESS_KEY_ID=xxx
S3_SECRET_ACCESS_KEY=xxx
S3_BUCKET=my-bucket
S3_REGION=us-east-1
S3_PUBLIC_URL=https://my-bucket.s3.us-east-1.amazonaws.comAI Agent Webhook (Optional)
When FEEDBACK_AGENT_WEBHOOK_URL is set, each feedback triggers a POST request you can use to start automated fixes:
{
"event": "feedback_created",
"issue": { "number": 123, "title": "[🐛 BUG] ...", "url": "https://github.com/..." },
"feedback": { "category": "bug", "description": "...", "screenshotUrl": "..." },
"timestamp": "2024-01-15T10:30:00Z"
}Installation
npm install feedback-bot-kit modern-screenshotAdd API Routes
// app/api/feedback/route.ts
export { feedbackHandler as POST, feedbackStatusHandler as GET } from 'feedback-bot-kit';
// app/api/telegram/webhook/route.ts (if using Telegram)
export { telegramWebhookHandler as POST, telegramWebhookSetup as GET } from 'feedback-bot-kit';Add Feedback Button
// app/layout.tsx
import { FeedbackButton } from 'feedback-bot-kit';
export default function Layout({ children }) {
return (
<html>
<body>
{children}
<FeedbackButton />
</body>
</html>
);
}Props:
<FeedbackButton
position="bottom-right" // bottom-right | bottom-left | top-right | top-left
buttonLabel="Feedback"
enableScreenshots={true}
categories={[
{ value: 'bug', label: 'Bug', emoji: '🐛' },
{ value: 'enhancement', label: 'Enhancement', emoji: '✨' },
]}
/>Programmatic Usage
import { createFeedback, createGitHubIssue } from 'feedback-bot-kit';
await createFeedback({
category: 'bug',
description: 'Something broke',
pageUrl: '/dashboard',
});Requirements
- Next.js 14+ (App Router)
- Any hosting: Vercel, Netlify, AWS, Railway, Docker, etc.
License
MIT
