A comprehensive Discord bot for Glific support with AI-powered responses, ticket management, and analytics tracking.
- AI-Powered Support: Automated responses to support questions using OpenAI Assistant
- Ticket Management: Complete support ticket lifecycle with closure tracking
- Rating System: User feedback collection with thumbs up/down reactions and star ratings
- Google Sheets Integration: Automatic logging of tickets, feedback for analytics
- Metrics & Analytics: Support performance tracking and reporting
- Node.js (v16 or higher)
- Discord Bot Token
- Create a new bot in Discord Developer Portal and enabled
Message Contentintent. - Install the bot in a test server using Discord Provided Link (You need to be a server admin)
- After installing limit bot to test channel in Server Settings > Integrations > Bots > Manage
- Create a new bot in Discord Developer Portal and enabled
- OpenAI API Key (For first AI Response)
- You also need to create a new prompt in OpenAI Platform for the assistant response and save id into
OPENAI_PROMPT_ID
- You also need to create a new prompt in OpenAI Platform for the assistant response and save id into
- Google Cloud Service Account (For Google Sheets Integration)
- Create a new service account and download the JSON key file.
- Add the service account email to the Google Sheet and grant it
Editoraccess.
cp .env.example .envFill in the required values in .env:
| Variable | Where to find it |
|---|---|
BOT_TOKEN |
Discord Developer Portal → Your App → Bot → Token |
GUILD_ID |
Discord → Server Settings → Widget → Server ID (enable Developer Mode first) |
CHANNEL_ID |
Right-click the forum channel in Discord → Copy Channel ID |
OPENAI_API_KEY |
OpenAI Platform |
OPENAI_PROMPT_ID |
OpenAI Platform → Prompt for Assistant Response |
GCP_CLIENT_EMAIL |
Google Cloud → IAM → Service Accounts → your service account email |
GCP_PRIVATE_KEY |
Google Cloud → Service Account → Keys → Add Key (JSON) — copy the private_key field |
SPREADSHEET_ID |
From the Google Sheet URL: docs.google.com/spreadsheets/d/<SPREADSHEET_ID>/edit |
GITHUB_TOKEN |
GitHub → Settings → Developer settings → Personal access tokens (needs repo scope) |
GITHUB_REPO_OWNER |
GitHub username or org name |
GITHUB_REPO_NAME |
Repository name |
LOG_FLARE_SOURCE and LOG_FLARE_API are optional — the bot runs fine without them.
GITHUB_* is optional — the bot runs fine without them.
yarn installyarn devThe bot will connect to Discord and log Bot is ready! when it starts. Slash commands are registered automatically on startup.
- Open the configured forum channel in Discord
- Post a new thread — the bot should reply automatically with an AI response and feedback buttons
- Use
/close-ticketinside the thread to close it - Check the Google Sheet — the row should populate with timestamps, the conversation transcript, and (after a few seconds) an AI-assigned Issue Category
- Bot doesn't respond to new threads: confirm
CHANNEL_IDmatches the forum channel, not a text channel - Sheet not updating: verify the service account has Editor access to the spreadsheet
Issue Categorycolumn empty: ensure theConversationandIssue Categorycolumn headers exist in the "Tickets" sheet tab
/askglific <question>- Ask a question to the AI assistant/post <link>- Share a social media post with the team/close-ticket [description] [closed-on]- Close a support ticket/support-metrics <days>- Get support metrics for specified time period
- Thread Creation: Automatically responds to new support threads with AI-generated answers
- Feedback Collection: Adds reaction buttons for rating AI responses
- Ticket Closure: Collects ratings when tickets are closed
The bot automatically tracks:
- Response times
- Closure times
- User satisfaction ratings
- AI response effectiveness
- Support volume metrics
All data is stored in Google Sheets for easy analysis and reporting.