Create a Witty Telegram Bot with AI-Powered Humor, Roasts & Stats using OpenRouter
Workflow preview
DISCOUNT 20%
Important notice
This workflow is provided as-is. Please review and test before using in production.
Overview
GiggleGPTBot ā Witty Telegram Bot with AI & Postgres
š Overview
GiggleGPTBot is a witty Telegram bot built with n8n, OpenRouter, and Postgres. It delivers short jokes, motivational one-liners, and playful roasts, responds to mentions, and posts scheduled witty content. The workflow also tracks user activity and provides lightweight statistics and leaderboards.
⨠Features
- š¤ AI-powered humor engine ā replies with jokes, motivation, random witty lines, or sarcastic roasts.
- š¬ Command support ā
/joke,/inspire,/random,/roast,/help,/stats,/top. - šÆ Mention detection ā replies when users tag
@GiggleGPTBot. - ā° Scheduled posts ā morning jokes, daily motivation, and random wisdom at configured times.
- š User analytics ā counts messages, commands, reactions, and generates leaderboards.
- šļø Postgres persistence ā robust schema with tables for messages, responses, stats, and schedules.
š ļø How It Works
Triggers
Telegram Triggerā receives all messages and commands from a chat.Schedule Triggerā runs hourly to check for planned posts.
Processing
Switchroutes commands (/joke,/inspire,/random,/roast,/help,/stats,/top).Chat historyfetches the latest context.Mention Analysisdetermines if the bot was mentioned.Generating an information responsebuilds replies for/help,/stats,/top.- AI nodes (
AI response to command,AI response to mention,AI post generation) craft witty content via OpenRouter.
Persistence
Init Databaseensures tables exist (user_messages,bot_responses,bot_commands,message_reactions,scheduled_posts,user_stats).- Logging nodes update stats and store every bot/user interaction.
Delivery
- Replies are sent back via
Telegram Sendnodes (Send AI response,Send info reply,Reply to Mention,Submit scheduled post).
- Replies are sent back via
āļø Setup Instructions
Create a Telegram Bot with @BotFather and get your API token.
Add credentials in n8n:
Telegram API(your bot token)OpenRouter(API key from openrouter.ai)Postgres(use your DB, Supabase works well).
Run the
Init Databasenode once to create all required tables.(Optional) Seed schedule with the
Adding a schedulenode ā it inserts:- Morning joke at 06:00
- Daily motivation at 09:00
- Random wisdom at 17:00
(Adjust
chat_idto your group/channel ID.)
Activate workflow and connect Telegram Webhook or Polling.
š Database Schema
- user_messages ā stores user chat messages.
- bot_responses ā saves bot replies.
- bot_commands ā logs command usage.
- message_reactions ā tracks reactions.
- scheduled_posts ā holds scheduled jokes/wisdom/motivation.
- user_stats ā aggregates per-user message/command counts and activity.
š Example Commands
/jokeā witty one-liner with light irony./inspireā short motivational phrase./randomā unexpected witty remark./roastā sarcastic roast (no offensive targeting)./statsā shows your personal stats./topā displays leaderboard./helpā lists available commands.@GiggleGPTBot+ message ā bot replies in context.
š Customization Ideas
- Add new command categories (
/quote,/fact,/news). - Expand analytics with reaction counts or streaks.
- Localize prompts into multiple languages.
- Adjust CRON schedules for posts.
ā Requirements
- Telegram Bot token
- OpenRouter API key
- Postgres database
š¦ Import this workflow, configure credentials, run the DB initializer ā and your witty AI-powered Telegram companion is ready!