📜 Mobile Escrow Packet & Closing Pin Dispatcher
Mobile signing agents waste tons of time in parking lots wrestling with clunky document portals just to grab a buyer's signing sheet, an escrow officer's direct line, and a map pin. This automation lets an on-the-road notary text a single file reference to get an all-in-one dispatch bundle delivered natively inside Telegram. The bot pings the title API, streams the PDF closing document with
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Firing
#FlexGram
Mobile signing agents waste tons of time in parking lots wrestling with clunky document portals just to grab a buyer's signing sheet, an escrow officer's direct line, and a map pin. This automation lets an on-the-road notary text a single file reference to get an all-in-one dispatch bundle delivered natively inside Telegram. The bot pings the title API, streams the PDF closing document with
sendDocument, pushes the title officer's phone card via sendContact, and drops an exact destination coordinate with sendLocation so the agent can launch navigation with a single tap.📁 Filename:
closing.js👨💻 Code:
sendMessage("Enter the 6-digit escrow file ID to retrieve your closing packet:", {
buttons: [{ text: "Cancel", command: "/cancel" }]
});
waitForAnswer("get_closing");📁 Filename:
get_closing.js👨💻 Code:
clearWait();
sendChatAction("upload_document");
const res = await HTTP.get({ url: `https://api.titleops.internal/files/${encodeURIComponent(message)}` });
if (!res || !res.data || !res.data.pdf_url) {
return sendMessage("Escrow file not found. Please verify the ID and run /closing again.");
}
pushDB("signings", { file: message, notary: user.id, at: Date.now() });
sendDocument(res.data.pdf_url, { caption: `*Escrow File #${message}* Ready for execution.` });
sendContact(res.data.officer_phone, res.data.officer_name);
sendLocation(res.data.lat, res.data.lng);
📁 Filename:
cancel.js👨💻 Code:
clearWait();
sendMessage("Request cancelled. Enter /closing whenever you are ready.");
💡 Firing
sendChatAction('upload_document') right before your HTTP call gives agents instant UI feedback in the Telegram header while third-party PDFs are being negotiated.⚠️ Note: Replace the title API URL with your actual document service endpoint and ensure it returns direct downloadable file URLs.
#FlexGram
❤1👍1
🔧 Step-by-Step Hardware Repair Ticket Intake
Clients DMing blurry photos of broken gear with zero context used to wreck my entire morning workbench flow. Instead of playing twenty questions over chat, this three-step
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Calling
#FlexGram
Clients DMing blurry photos of broken gear with zero context used to wreck my entire morning workbench flow. Instead of playing twenty questions over chat, this three-step
waitForAnswer pipeline collects the hardware model, captures the failure symptoms, and commits the ticket without cluttering permanent storage until the customer finishes.📁 Filename:
repair.js👨💻 Code:
sendMessage('🛠️ *Hardware Repair Intake*\n\nWhat is the exact make and model of the device needing service?');
waitForAnswer('repair_issue');📁 Filename:
repair_issue.js👨💻 Code:
TEMP.setProp('device_model', message);
sendMessage('Got it. Please describe the exact symptoms, error codes, or physical damage:');
waitForAnswer('repair_finish');📁 Filename:
repair_finish.js👨💻 Code:
const model = await TEMP.getProp('device_model').value();
clearWait();
TEMP.deleteProp('device_model');
USER.setProp('active_ticket', `${model} - ${message}`);
sendMessage(`✅ *Ticket Logged*\n\nDevice: *${model}*\nReport: ${message}\n\nA bench technician has been queued.`);💡 Calling
clearWait() right at the start of your final step prevents follow-up chatter from getting trapped in the conversation pipeline.#FlexGram
❤1👍1🎉1
⏱️ Shared Client Retainer Hour Burn Ledger
Running a dev shop with prepaid client retainers usually means either fighting clunky time-tracking SaaS or losing billable hours because nobody wants to open an external app for a 15-minute bug fix. Wiring a burn ledger directly into our team chat lets engineers log fractional hours instantly without interrupting their flow. The engine uses persistent Firebase global and user properties with atomic additions and subtractions, keeping the team's combined client pool synchronized in real time.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Both
#FlexGram
Running a dev shop with prepaid client retainers usually means either fighting clunky time-tracking SaaS or losing billable hours because nobody wants to open an external app for a 15-minute bug fix. Wiring a burn ledger directly into our team chat lets engineers log fractional hours instantly without interrupting their flow. The engine uses persistent Firebase global and user properties with atomic additions and subtractions, keeping the team's combined client pool synchronized in real time.
📁 Filename:
burn.js👨💻 Code:
const amount = parseFloat(params);
if (!amount || isNaN(amount) || amount <= 0) {
sendMessage('Provide hours to deduct: `/burn 1.5 staging db patch`', { parse_mode: 'Markdown' });
return;
}
BOT.remove('retainer_hours', amount);
USER.add('hours_billed', amount);
const pool = (await BOT.getProp('retainer_hours').value()) || 0;
sendMessage(`Burned <b>${amount} hrs</b> by ${user.first_name}.\nActive retainer pool: <b>${pool} hrs</b> remaining.`);
📁 Filename:
pool.js👨💻 Code:
const pool = (await BOT.getProp('retainer_hours').value()) || 0;
const billed = (await USER.getProp('hours_billed').value()) || 0;
sendMessage(`<b>Current Retainer Balance</b>\nClient Pool: <b>${pool} hrs</b> remaining\nYour personal logged time: <b>${billed} hrs</b>`);📁 Filename:
topup.js👨💻 Code:
const added = parseFloat(params);
if (!added || isNaN(added) || added <= 0) {
sendMessage('Pass an allotment to credit: `/topup 40`', { parse_mode: 'Markdown' });
return;
}
BOT.add('retainer_hours', added);
const balance = await BOT.getProp('retainer_hours').value();
sendMessage(`Credited <b>${added} hrs</b>. Active client allotment is now <b>${balance} hrs</b>.`);
💡 Both
BOT and USER mutate properties instantly without await, but always remember to await the .value() call whenever reading the updated numbers back to display them.⚠️ Note: Lock thetopup.jscommand to your Telegram user ID by checkinguser.idoruser.telegramidagainst your admin ID before running the credit math.
#FlexGram
👍1🤩1
🎛️ Live Production Feature Flag Switchboard
Flipping an emergency killswitch or toggling maintenance mode while away from your desk usually means fumbling through sluggish cloud consoles on mobile Safari. We mapped our team's core runtime flags into an instant inline button switchboard backed by global bot properties. Tapping any toggle updates shared Firebase state across all microservices, updates the button matrix in place, and logs an audit record.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Calling
#FlexGram
Flipping an emergency killswitch or toggling maintenance mode while away from your desk usually means fumbling through sluggish cloud consoles on mobile Safari. We mapped our team's core runtime flags into an instant inline button switchboard backed by global bot properties. Tapping any toggle updates shared Firebase state across all microservices, updates the button matrix in place, and logs an audit record.
📁 Filename:
command/flags.js👨💻 Code:
const [m, b] = await Promise.all([BOT.getProp('maint_mode').value(), BOT.getProp('beta_gate').value()]);
const buttons = [
[{ text: `Maintenance: ${m === 'ON' ? '🔴 ACTIVE' : '🟢 OFF'}`, command: '/toggle maint_mode' }],
[{ text: `Beta Gate: ${b === 'ON' ? '🚀 OPEN' : '🔒 CLOSED'}`, command: '/toggle beta_gate' }]
];
sendMessage('🎛️ <b>Live Feature Flags</b>\nTap to flip runtime configurations across active services:', { buttons });📁 Filename:
command/toggle.js👨💻 Code:
if (!params) return;
const val = (await BOT.getProp(params).value()) === 'ON' ? 'OFF' : 'ON';
BOT.setProp(params, val);
pushDB('flag_audit', { flag: params, val, by: user.username || user.id, at: Date.now() });
answerCallback(`${params}: ${val}`);
const [m, b] = await Promise.all([BOT.getProp('maint_mode').value(), BOT.getProp('beta_gate').value()]);
const buttons = [
[{ text: `Maintenance: ${m === 'ON' ? '🔴 ACTIVE' : '🟢 OFF'}`, command: '/toggle maint_mode' }],
[{ text: `Beta Gate: ${b === 'ON' ? '🚀 OPEN' : '🔒 CLOSED'}`, command: '/toggle beta_gate' }]
];
editCallbackMessage('🎛️ <b>Live Feature Flags</b>\nTap to flip runtime configurations across active services:', buttons, message_id);
📁 Filename:
command/flagaudit.js👨💻 Code:
const logs = (await getDB('flag_audit')) || {};
const entries = Object.values(logs).slice(-5).reverse();
if (!entries.length) return sendMessage('No flag modifications found in audit trail.');
const text = entries.map(e => `${e.flag} turned ${e.val} by @${e.by}`).join('\n');
sendMessage(`📋 <b>Recent Runtime Adjustments:</b>\n\n${text}`);💡 Calling
editCallbackMessage with message_id repaints the keyboard state cleanly in the same message frame without spamming notification alerts.⚠️ Note: Gate these files by checking user.id against a list of authorized team IDs to ensure unauthorized members cannot toggle production settings.#FlexGram
🎉1
⚡ Dead-Letter Webhook Triage & In-Place Remediation
Silent webhook delivery failures and dead-letter queues usually end with engineers digging through cloud consoles while customers complain about missing syncs. Instead of routing noisy JSON dumps into an unmonitored channel where alerts get ignored, this flow pushes compact incident cards with instant remediation controls right into your team chat. On-call engineers can trigger an immediate replay or inspect and purge the stalled payload via native alert modals, while the message card edits itself in place so nobody duplicates work.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Passing
#FlexGram
Silent webhook delivery failures and dead-letter queues usually end with engineers digging through cloud consoles while customers complain about missing syncs. Instead of routing noisy JSON dumps into an unmonitored channel where alerts get ignored, this flow pushes compact incident cards with instant remediation controls right into your team chat. On-call engineers can trigger an immediate replay or inspect and purge the stalled payload via native alert modals, while the message card edits itself in place so nobody duplicates work.
📁 Filename:
command/dlq.js👨💻 Code:
sendChatAction("typing");
const eventId = params || "ev_9402";
sendMessage(`⚠️ <b>Dead-Letter Exception</b> [<code>${eventId}</code>]\nRoute: <code>POST /api/webhooks/billing</code>\nFailure: <code>Upstream 504 Gateway Timeout</code>\nAttempts: 3 exhausted`, {
buttons: [[
{ text: "🔄 Replay Event", command: `/dlq_retry ${eventId}` },
{ text: "🗑️ Purge & Drop", command: `/dlq_drop ${eventId}` }
]]
});📁 Filename:
command/dlq_retry.js👨💻 Code:
if (!isCallback) return;
answerCallback("Dispatched payload back to active worker queue");
sendChatAction("typing");
const operator = user.username ? `@${user.username}` : user.first_name;
editCallbackMessage(`🔄 <b>Replay In Progress</b> [<code>${params}</code>]\nRoute: <code>POST /api/webhooks/billing</code>\nTriggered by: ${operator}\nStatus: Processing in worker tier`, [
[{ text: "🗑️ Purge Record", command: `/dlq_drop ${params}` }]
], message_id);
📁 Filename:
command/dlq_drop.js👨💻 Code:
if (!isCallback) return;
answerCallback(`Payload ${params} was permanently purged from storage.`, true);
deleteMessage(message_id);
💡 Passing
true as the second argument in answerCallback() triggers an interactive Telegram popup modal that requires user dismissal instead of a passive bottom toast.⚠️ Note: Wrap these actions with a check against your engineering team chat.id to ensure only authorized infrastructure operators can replay or purge failed event queues.#FlexGram
👍1🤩1
🔍 Zero-Switch Inline Runbook Injector for Incident Chats
Switching between active incident war rooms and our internal documentation just to grab standard diagnostic cURL commands was killing our response velocity during live outages. We dropped our team's critical recovery commands into Firebase so on-call engineers can invoke them directly inside any channel or customer DM without opening another tab. By routing query lookups through
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Telegram aggressively caches inline query payloads on mobile clients, so pass
#FlexGram
Switching between active incident war rooms and our internal documentation just to grab standard diagnostic cURL commands was killing our response velocity during live outages. We dropped our team's critical recovery commands into Firebase so on-call engineers can invoke them directly inside any channel or customer DM without opening another tab. By routing query lookups through
__inline__.js, the bot filters matching commands in real time and inserts cleanly formatted shell snippets straight into the current chat with a single tap.📁 Filename:
command/snippet.js👨💻 Code:
const [key, ...content] = (params || '').split(' ');
if (!key || content.length === 0) {
sendMessage('Usage: <code>/snippet <name> <command/url/text></code>');
return;
}
await setDB('snippets/' + key.toLowerCase(), { name: key, text: content.join(' ') });
sendMessage(`Snippet <b>${key}</b> stored in global inline registry.`);📁 Filename:
command/__inline__.js👨💻 Code:
const q = (inlineQuery || '').toLowerCase().trim();
const data = (await getDB('snippets')) || {};
const matches = Object.values(data).filter(s => s.name.toLowerCase().includes(q)).slice(0, 8);
const results = matches.map((s, i) => ({
type: 'article',
id: String(i),
title: s.name,
description: s.text.slice(0, 50),
input_message_content: { message_text: `<b>Runbook: ${s.name}</b>\n<code>${s.text}</code>`, parse_mode: 'HTML' }
}));
answerInlineQuery(results);
📁 Filename:
command/delsnippet.js👨💻 Code:
if (!params) {
sendMessage('Usage: <code>/delsnippet <name></code>');
return;
}
await deleteDB('snippets/' + params.trim().toLowerCase());
sendMessage(`Snippet <b>${params.trim()}</b> removed from inline registry.`);💡 Telegram aggressively caches inline query payloads on mobile clients, so pass
{ cache_time: 1 } as the second argument to answerInlineQuery if your team updates snippets frequently.⚠️ Note: You must enable Inline Mode for your bot in BotFather via/setinlinebefore Telegram starts dispatchinginline_queryevents to your webhook.
#FlexGram
❤1😁1
New Video Uploaded 👇
https://youtu.be/vAMUm4hNSN4
📹 Video Description:
In this video, you would able to learn how to build a complete Telegram Subscription Bot using Node.js. In this tutorial, you'll create a system that automatically add users to channel, tracks subscription expiry dates, sends reminders, and removes expired members without manual work.
https://youtu.be/vAMUm4hNSN4
📹 Video Description:
In this video, you would able to learn how to build a complete Telegram Subscription Bot using Node.js. In this tutorial, you'll create a system that automatically add users to channel, tracks subscription expiry dates, sends reminders, and removes expired members without manual work.
⚠️ Note: Subscribe Backup Channel: https://youtube.com/@flecdev
❤1👍1😍1
Flex Coder
New Video Uploaded 👇 https://youtu.be/vAMUm4hNSN4 📹 Video Description: In this video, you would able to learn how to build a complete Telegram Subscription Bot using Node.js. In this tutorial, you'll create a system that automatically add users to channel…
Watch this video and make sure to like and comment on this video as I have taken much time to make it 🤗
👍1🙏1
🎙️ Live Broadcast Listener Audio Voicemail Box
Chasing down listener audio questions across emails, WhatsApp voice notes, and messy cloud folders right before recording a weekly show is complete chaos. This setup turns Telegram into a direct studio dropbox where audience members send native voice recordings that get cataloged straight into Firebase. The show host can toggle the line on or off with a shared bot property, capture voice file IDs seamlessly with conversational routing, and preview queued listener clips right in Telegram without downloading third-party media files.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Native Telegram voice notes preserve original Opus compression, so playing them back via
#FlexGram
Chasing down listener audio questions across emails, WhatsApp voice notes, and messy cloud folders right before recording a weekly show is complete chaos. This setup turns Telegram into a direct studio dropbox where audience members send native voice recordings that get cataloged straight into Firebase. The show host can toggle the line on or off with a shared bot property, capture voice file IDs seamlessly with conversational routing, and preview queued listener clips right in Telegram without downloading third-party media files.
📁 Filename:
record.js👨💻 Code:
const isOpen = await BOT.getProp("voicemail_open").value();
if (!isOpen) {
sendMessage("🎙️ Voicemail line is currently closed for this segment.");
return;
}
sendMessage("🎙️ Record and send your voice note now. Speak clearly into the mic!");
waitForAnswer("/save_audio", { timeout_ms: 120000 });📁 Filename:
save_audio.js👨💻 Code:
const voiceId = flex.request?.message?.voice?.file_id;
if (!voiceId) {
sendMessage("⚠️ Please send a voice memo recording, or tap /record to try again.");
return;
}
clearWait();
sendChatAction("record_voice");
await pushDB("voicemails", { sender: user.username || user.id, file_id: voiceId, timestamp: Date.now() });
sendMessage("✅ Voice memo captured! It has been forwarded to the production queue.");
📁 Filename:
producer_gate.js👨💻 Code:
const active = await BOT.getProp("voicemail_open").value();
await BOT.setProp("voicemail_open", !active);
const label = !active ? "🟢 OPEN" : "🔴 CLOSED";
sendMessage(`Studio voicemail line is now ${label}.`);📁 Filename:
queue_pull.js👨💻 Code:
sendChatAction("upload_voice");
const inbox = await getDB("voicemails");
const keys = inbox ? Object.keys(inbox) : [];
if (!keys.length) {
sendMessage("No unreviewed listener audio clips in the queue.");
return;
}
const clip = inbox[keys[keys.length - 1]];
sendVoice(clip.file_id, { caption: `🎙️ Caller: @${clip.sender}` });💡 Native Telegram voice notes preserve original Opus compression, so playing them back via
sendVoice using the stored file_id avoids any re-upload delay or extra bandwidth on your server.⚠️ Note: Guardproducer_gate.jsandqueue_pull.jsby matchinguser.idagainst your team's admin ID list so listeners cannot toggle the booth or leak peer submissions.
#FlexGram
👍2🎉1
🖨️ Makerspace 3D Print Queue & Laser Run Logger
Members at our community workshop kept starting eight-hour PETG prints without tagging the plate, leaving everyone guessing when a bed would actually free up. Instead of mounting a dusty tablet kiosk by the machines, we dropped this three-file flow in so anyone can log their job specs directly from the chat bench. It grabs their parameters through an interactive conversational wait, commits the slot into Firebase, and lets anyone query what's currently cooking.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Always call
#FlexGram
Members at our community workshop kept starting eight-hour PETG prints without tagging the plate, leaving everyone guessing when a bed would actually free up. Instead of mounting a dusty tablet kiosk by the machines, we dropped this three-file flow in so anyone can log their job specs directly from the chat bench. It grabs their parameters through an interactive conversational wait, commits the slot into Firebase, and lets anyone query what's currently cooking.
📁 Filename:
slice.js👨💻 Code:
sendChatAction("typing");
sendMessage(
`Hey *${user.first_name}*, enter your print run details.\nFormat: \`PrinterName | Minutes | Filament\``
);
waitForAnswer("commit_slice");📁 Filename:
commit_slice.js👨💻 Code:
clearWait();
const [printer, mins, filament] = message.split("|").map(s => s.trim());
if (!printer || !mins) {
return sendMessage("Format was off. Tap /slice to try again using: `Printer | Minutes | Material`");
}
await pushDB("workshop_jobs", {
maker: user.first_name,
printer,
minutes: parseInt(mins, 10) || 60,
filament: filament || "PLA",
loggedAt: Date.now()
});
sendMessage(`🛏 Reserved *${printer}* for ~${mins}m (${filament}). See all runs with /machinelog.`);
📁 Filename:
machinelog.js👨💻 Code:
sendChatAction("typing");
const runs = await getDB("workshop_jobs");
if (!runs || Object.keys(runs).length === 0) {
return sendMessage("No print jobs currently registered on the floor.");
}
const list = Object.values(runs)
.slice(-6)
.map(j => `• *${j.printer}*: ${j.minutes}m (${j.filament}) logged by ${j.maker}`)
.join("\n");
sendMessage(`⏱ *Recent Active Shop Runs*:\n\n${list}`);💡 Always call
clearWait() right away inside your target step handler so a failed validation check doesn't leave the user accidentally stuck in your waiting loop.⚠️ Note: Make sureFIREBASE_URLandFIREBASE_SECRETare present in your environment sopushDBandgetDBcan access your database instance.
#FlexGram
⚡1👍1
🛰️ On-Call Edge Probe & Instant Service Purge
Getting paged about sluggish checkout latency while standing in line for coffee used to mean tethering my laptop just to run three basic curl requests. With this setup, our on-call rotation fires synthetic health checks against production microservices and purges stale edge caches directly from our phones. The bot calculates network roundtrip latency in milliseconds, inspects HTTP response payloads, and issues authenticated REST mutations without opening an SSH tunnel.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Calling
#FlexGram
Getting paged about sluggish checkout latency while standing in line for coffee used to mean tethering my laptop just to run three basic curl requests. With this setup, our on-call rotation fires synthetic health checks against production microservices and purges stale edge caches directly from our phones. The bot calculates network roundtrip latency in milliseconds, inspects HTTP response payloads, and issues authenticated REST mutations without opening an SSH tunnel.
📁 Filename:
command/probe.js👨💻 Code:
sendChatAction("typing");
const target = params ? params.trim() : "gateway";
const endpoints = { gateway: "https://api.internal.run/health", auth: "https://auth.internal.run/ping" };
const url = endpoints[target] || endpoints.gateway;
const t0 = Date.now();
const res = await HTTP.get({ url, headers: { "X-Monitor-Origin": "FlexGram-Edge" } });
const latency = Date.now() - t0;
const healthy = res && (!res.status || res.status < 400);
const badge = healthy && latency < 750 ? "🟢 *HEALTHY*" : "🔴 *DEGRADED*";
sendMessage(`${badge}\nEndpoint: \`${target}\`\nLatency: \`${latency}ms\`\nStatus: \`${res.status || 200}\``);📁 Filename:
command/purge.js👨💻 Code:
sendChatAction("typing");
const zone = params ? params.trim() : "global";
const res = await HTTP.post({
url: "https://api.internal.run/v1/cache/purge",
headers: { "Authorization": "Bearer ops-secret-token", "Content-Type": "application/json" },
body: { zone, triggered_by: user.username || user.telegramid }
});
const status = res && res.success ? "✅ *Purge Complete*" : "⚠️ *Purge Queued*";
sendMessage(`${status}\nZone: \`${zone}\`\nCluster: \`${res.cluster || "core-us-east"}\``);📁 Filename:
command/evict.js👨💻 Code:
sendChatAction("typing");
const lockId = params ? params.trim() : "global-lock";
const res = await HTTP.custom({
url: `https://api.internal.run/v1/locks/${lockId}`,
method: "DELETE",
header: { "Authorization": "Bearer ops-secret-token" }
});
sendMessage(`🗑️ Lock Eviction: \`${lockId}\`\nHTTP Result: \`${res.status || 204} OK\``);💡 Calling
sendChatAction("typing") right before async external HTTP requests keeps the client updated and prevents Telegram from timing out during cold API starts.⚠️ Note: Replace internal endpoints and ops-secret-token with your authenticated gateway URLs or ingest them from environment variables.#FlexGram
👍2🤩1
⚽ Pickup Match Pitch Pin & Attendance Poll Hub
Organizing our weekly local pickup league meant answering forty repetitive group chat pings about the pitch coordinates and who was actually turning up. Instead of juggling external signup spreadsheets or pinning stale messages, we wired native Telegram poll dispatches and geo coordinates into quick organizer commands. Team captains trigger a persistent custom reply board right above their chat tray to drop pins and roster polls in seconds.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Native reply keyboards stay pinned to the user's input tray across app restarts until explicitly wiped with
#FlexGram
Organizing our weekly local pickup league meant answering forty repetitive group chat pings about the pitch coordinates and who was actually turning up. Instead of juggling external signup spreadsheets or pinning stale messages, we wired native Telegram poll dispatches and geo coordinates into quick organizer commands. Team captains trigger a persistent custom reply board right above their chat tray to drop pins and roster polls in seconds.
📁 Filename:
match.js👨💻 Code:
sendReplyKeyboard(
"⚽ *Match Day Hub*\nSelect an action below to dispatch to the squad:",
[["/pitch", "/poll"], ["/dismiss"]],
"Markdown"
);
📁 Filename:
pitch.js👨💻 Code:
sendChatAction("find_location");
sendLocation(51.5560, -0.1075, {
reply_to_message_id: message_id
});
sendMessage("📍 *Highbury Turf Pitch 2*\nKick-off at 19:30. Bring both dark and light shirts.", {
parse_mode: "Markdown"
});📁 Filename:
poll.js👨💻 Code:
sendPoll(
"⚽ Who is in for tonight's 8-a-side run?",
["In (Outfield)", "In (Goalie)", "Bench Sub Only", "Out"],
{
is_anonymous: false
}
);
📁 Filename:
dismiss.js👨💻 Code:
removeKeyboard("Match controls dismissed. Send /match to bring them back.");💡 Native reply keyboards stay pinned to the user's input tray across app restarts until explicitly wiped with
removeKeyboard.⚠️ Note: Ensure your bot has the permission to post polls enabled in group chat settings if you run these commands in a community room.
#FlexGram
❤1👍1
Day 1/30: License Key Claim & Identity Binding 🔑
I was manually pasting software activation keys into Postgres every time someone bought a seat for my desktop app, which got old remarkably fast. We are kicking off a 30-day build turning FlexGram into an automated licensing backend for digital tools and micro-SaaS products. Today's foundation allows buyers to run a single command with their invoice token to lock the seat to their Telegram ID and store their active subscription tier across persistent state.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Reading stored objects via
#FlexGram
I was manually pasting software activation keys into Postgres every time someone bought a seat for my desktop app, which got old remarkably fast. We are kicking off a 30-day build turning FlexGram into an automated licensing backend for digital tools and micro-SaaS products. Today's foundation allows buyers to run a single command with their invoice token to lock the seat to their Telegram ID and store their active subscription tier across persistent state.
📁 Filename:
claim.js👨💻 Code:
const key = (params || '').trim().toUpperCase();
if (!key) return sendMessage('Usage: `/claim ABCD-1234`', { parse_mode: 'Markdown' });
const record = await BOT.getProp(`key_${key}`).value();
if (!record) return sendMessage('❌ License key not recognized. Check your purchase receipt.');
if (record.owner && record.owner !== user.id) return sendMessage('⛔ Key already claimed by another user.');
await BOT.setProp(`key_${key}`, { ...record, owner: user.id, claimed_at: Date.now() });
await USER.setProp('license_key', key);
await FLEX.setProperty('tier', record.tier || 'pro');
sendMessage(`✅ *${(record.tier || 'pro').toUpperCase()}* seat bound to account \`${user.id}\`! Check status via /license.`, { parse_mode: 'Markdown' });
📁 Filename:
license.js👨💻 Code:
const key = await USER.getProp('license_key').value();
if (!key) return sendMessage('No license linked yet. Run `/claim <KEY>` to register your copy.', { parse_mode: 'Markdown' });
const tier = await FLEX.getProperty('tier').value() || 'Standard';
const record = await BOT.getProp(`key_${key}`).value();
const claimedDate = record?.claimed_at ? new Date(record.claimed_at).toLocaleDateString('en-US') : 'Unknown';
sendMessage(`🪪 *Active License Record*\n\nKey: \`${key}\`\nTier: *${tier.toUpperCase()}*\nActivated: ${claimedDate}\nTelegram ID: \`${user.id}\``, { parse_mode: 'Markdown' });📁 Filename:
genkey.js👨💻 Code:
const adminId = 123456789;
if (user.id !== adminId) return sendMessage('⛔ Unauthorized access.');
const [tier, customKey] = (params || '').trim().split(' ');
if (!tier) return sendMessage('Usage: `/genkey pro` or `/genkey studio MY-CUSTOM-KEY`', { parse_mode: 'Markdown' });
const key = (customKey || `LIC-${Math.random().toString(36).substring(2, 8).toUpperCase()}`).toUpperCase();
await BOT.setProp(`key_${key}`, { tier: tier.toLowerCase(), created_at: Date.now() });
sendMessage(`🔑 New license created!\nKey: \`${key}\`\nTier: *${tier.toUpperCase()}*`, { parse_mode: 'Markdown' });
💡 Reading stored objects via
BOT.getProp().value() handles JSON parsing automatically, keeping state validation down to a single clean lookup.⚠️ Note: ChangeadminIdinsidegenkey.jsto your personal numeric Telegram user ID before issuing license tokens.
#FlexGram
❤2
Day 2/30: Multi-Seat Node Manager & In-Place Revocation 💻
Buyers kept hitting our support inbox after wiping their machines or buying new laptops because their license seat allocation was still locked to dead hardware. Instead of building an entire web portal with auth sessions just to let users detach an old MacBook, we let them inspect their seat slots and detach machines straight through inline callback actions in Telegram. When an engineer pairs a new host, it claims an available slot, and when they decommission a box, tapping an inline button frees the slot immediately without refreshing the chat history.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Calling
#FlexGram
Buyers kept hitting our support inbox after wiping their machines or buying new laptops because their license seat allocation was still locked to dead hardware. Instead of building an entire web portal with auth sessions just to let users detach an old MacBook, we let them inspect their seat slots and detach machines straight through inline callback actions in Telegram. When an engineer pairs a new host, it claims an available slot, and when they decommission a box, tapping an inline button frees the slot immediately without refreshing the chat history.
📁 Filename:
pair.js👨💻 Code:
const node = params ? params.trim() : 'workstation';
const s1 = await USER.getProp('seat_1').value();
const s2 = await USER.getProp('seat_2').value();
if (!s1) {
await USER.setProp('seat_1', node);
sendMessage(`Attached <b>${node}</b> to Slot 1.`, { buttons: [{ text: 'Manage Seats', command: '/seats' }] });
} else if (!s2) {
await USER.setProp('seat_2', node);
sendMessage(`Attached <b>${node}</b> to Slot 2.`, { buttons: [{ text: 'Manage Seats', command: '/seats' }] });
} else {
sendMessage('All device slots full. Revoke an existing machine to continue.', { buttons: [{ text: 'Manage Seats', command: '/seats' }] });
}
📁 Filename:
seats.js👨💻 Code:
const s1 = await USER.getProp('seat_1').value();
const s2 = await USER.getProp('seat_2').value();
const buttons = [];
if (s1) buttons.push([{ text: `Revoke ${s1}`, command: '/revoke seat_1' }]);
if (s2) buttons.push([{ text: `Revoke ${s2}`, command: '/revoke seat_2' }]);
buttons.push([{ text: 'Refresh', command: '/seats' }]);
const text = `<b>Hardware Seat Matrix</b>\nSlot 1: ${s1 || '<i>Empty</i>'}\nSlot 2: ${s2 || '<i>Empty</i>'}`;
if (isCallback) {
editCallbackMessage(text, buttons);
} else {
sendMessage(text, { buttons });
}📁 Filename:
revoke.js👨💻 Code:
const slot = params ? params.trim() : 'seat_1';
await USER.deleteProp(slot);
if (isCallback) answerCallback('Machine seat revoked.');
const s1 = await USER.getProp('seat_1').value();
const s2 = await USER.getProp('seat_2').value();
const buttons = [];
if (s1) buttons.push([{ text: `Revoke ${s1}`, command: '/revoke seat_1' }]);
if (s2) buttons.push([{ text: `Revoke ${s2}`, command: '/revoke seat_2' }]);
buttons.push([{ text: 'Refresh', command: '/seats' }]);
const text = `<b>Hardware Seat Matrix</b>\nSlot 1: ${s1 || '<i>Empty</i>'}\nSlot 2: ${s2 || '<i>Empty</i>'}`;
editCallbackMessage(text, buttons);
💡 Calling
editCallbackMessage alongside answerCallback gives users instant tactile feedback while keeping the seat matrix updated in a single tidy message bubble.⚠️ Note: SetFIREBASE_URLandFIREBASE_SECRETin your environment soUSER.setPropandUSER.deletePropsync device slots permanently across cold starts.
#FlexGram
👍1🕊1
Which type of youtube video you like 🤔?
Anonymous Poll
42%
🧑💻 Direct coding or process
58%
💭 Full explanation in detail
❤2😍2👍1
Day 3/30: Air-Gapped License File Dispatch 📄
Enterprise clients running air-gapped VPCs can't ping an online licensing server to validate nodes. Instead of manually signing activation tokens and emailing
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Always trigger
#FlexGram
Enterprise clients running air-gapped VPCs can't ping an online licensing server to validate nodes. Instead of manually signing activation tokens and emailing
.lic archives back and forth, you can collect their hardware identifier in chat and dispatch an official signed bundle straight to their Telegram client in seconds.📁 Filename:
command/offline.js👨💻 Code:
const key = await USER.getProp("license_key").value();
if (!key) {
sendMessage("You need an active license bound to your account before requesting offline seats.");
return;
}
sendMessage("Paste your server node hardware fingerprint (HWID) to issue an air-gapped certificate:");
waitForAnswer("issue_license");📁 Filename:
command/issue_license.js👨💻 Code:
const hwid = message ? message.trim() : "";
if (hwid.length < 8) {
sendMessage("Invalid HWID format. Please provide a valid 8+ character node fingerprint.");
return;
}
clearWait();
const key = await USER.getProp("license_key").value();
sendChatAction("upload_document");
pushDB("airgap_licenses", { user: user.id, hwid, key, issued_at: Date.now() });
const certUrl = `https://licensing.internal/cert?key=${key}&hwid=${encodeURIComponent(hwid)}`;
sendDocument(certUrl, { caption: `*Node Certificate Attached*\nTarget HWID: \`${hwid}\`\nLicense: \`${key}\``, parse_mode: "Markdown" });
💡 Always trigger
sendChatAction("upload_document") right before generating or pulling heavy remote payloads so Telegram's client renders the native uploading badge while your signature endpoint finishes.⚠️ Note: Ensure your remote file host or dynamic document generator serves files over HTTPS with correct Content-Disposition headers so Telegram recognizes the target filename.#FlexGram
😍2👍1
Day 4/30: Authorized Origin Intake & Live Reachability Probe 🌐
Self-hosted customers kept opening support threads whenever they redeployed to a new domain and got blocked by origin mismatch checks. Instead of forcing them through a heavy web dashboard, we let them update and verify their allowed deployment domain in Telegram using conversational state routing. The bot asks for the target address, grabs their raw response without needing slash commands, writes it to Firebase, and fires an immediate HTTP health probe.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Always call
#FlexGram
Self-hosted customers kept opening support threads whenever they redeployed to a new domain and got blocked by origin mismatch checks. Instead of forcing them through a heavy web dashboard, we let them update and verify their allowed deployment domain in Telegram using conversational state routing. The bot asks for the target address, grabs their raw response without needing slash commands, writes it to Firebase, and fires an immediate HTTP health probe.
📁 Filename:
command/binddomain.js👨💻 Code:
const key = await USER.getProp("license_key").value();
if (!key) {
sendMessage("⚠️ No active license found. Link your key first via /claim.");
return;
}
sendMessage("🌐 Send your production FQDN or origin hostname (e.g., `app.internal.io`):");
waitForAnswer("savedomain");📁 Filename:
command/savedomain.js👨💻 Code:
clearWait();
const host = message.trim().toLowerCase();
await USER.setProp("origin_domain", host);
sendChatAction("typing");
const res = await HTTP.get({ url: `https://${host}/health` });
const status = res ? "Online & Verified" : "Saved (Probe Timeout)";
sendMessage(`✅ Authorized host locked to *${host}*.\n\nEndpoint Probe: *${status}*`, {
buttons: [{ text: "Re-check Health", command: "/checkdomain" }]
});
📁 Filename:
command/checkdomain.js👨💻 Code:
const host = await USER.getProp("origin_domain").value();
if (!host) {
sendMessage("No domain bound yet. Run /binddomain to attach one.");
return;
}
sendChatAction("typing");
const res = await HTTP.get({ url: `https://${host}/health` });
sendMessage(`🔍 Origin: *${host}*\nStatus: *${res ? "Healthy" : "Offline / Unreachable"}*`);💡 Always call
clearWait() at the very top of your answer handler so unexpected runtime exceptions won't lock the user in a perpetual input trap.⚠️ Note: EnsureFIREBASE_URLandFIREBASE_SECRETare set in your environment soUSERproperties persist across serverless runs.
#FlexGram
👍1👏1
Day 7/30: Emergency Key Cycling & Edge Revocation 🔄
A client just pinged me in a panic because their lead engineer hardcoded their commercial license token into a public demo repo. Instead of forcing them through a desktop billing portal, we wire up a Telegram command that invalidates the compromised key, pings our edge gateway over HTTP to flush in-flight caches, and drops a freshly minted credential directly into chat. Firebase handles the audit entry immediately so compliance teams have a tamper-proof timestamp of the exact cutoff.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Keeping token strings alphanumeric avoids unexpected underscore sanitization inside your Firebase Realtime DB path keys.
#FlexGram
A client just pinged me in a panic because their lead engineer hardcoded their commercial license token into a public demo repo. Instead of forcing them through a desktop billing portal, we wire up a Telegram command that invalidates the compromised key, pings our edge gateway over HTTP to flush in-flight caches, and drops a freshly minted credential directly into chat. Firebase handles the audit entry immediately so compliance teams have a tamper-proof timestamp of the exact cutoff.
📁 Filename:
cycle.js👨💻 Code:
const activeKey = await USER.getProp('license_key').value();
if (!activeKey) return sendMessage('❌ *No active license attached* to this Telegram ID.');
sendMessage(`⚠️ *Cycle Production License*\n\nActive Key: \`${activeKey.slice(0, 8)}...${activeKey.slice(-4)}\`\n\nCycling will immediately drop edge verification for this credential.`, {
buttons: [
{ text: '🔄 Confirm & Cycle Key', command: '/confirm_cycle' },
{ text: '📜 View Audit Trail', command: '/cycle_history' }
]
});📁 Filename:
confirm_cycle.js👨💻 Code:
const oldKey = await USER.getProp('license_key').value();
if (!oldKey) return sendMessage('❌ *Session invalid.* Send /cycle to start over.');
const newKey = `FG-${Date.now().toString(36).toUpperCase()}-${Math.random().toString(36).substring(2, 7).toUpperCase()}`;
await HTTP.post({ url: 'https://api.mylicensing.dev/v1/revoke', body: { old_key: oldKey, new_key: newKey } });
updateDB(`licenses/${oldKey}`, { status: 'revoked', revoked_at: Date.now() });
setDB(`licenses/${newKey}`, { owner: user.id, status: 'active', issued_at: Date.now() });
USER.setProp('license_key', newKey);
pushDB('license_audits', { userId: user.id, oldKey, newKey, rotatedAt: Date.now() });
sendMessage(`✅ *License Cycled Successfully*\n\nNew Key: \`${newKey}\`\n\nOld token has been invalidated at edge proxies.`);📁 Filename:
cycle_history.js👨💻 Code:
const audits = await getDB('license_audits') || {};
const logs = Object.values(audits).filter(entry => entry.userId === user.id).slice(-3);
if (!logs.length) return sendMessage('ℹ️ *No cycling events found* for your account.');
const history = logs.map(l => `• \`${l.oldKey.slice(0, 8)}...\` ➔ \`${l.newKey.slice(0, 8)}...\``).join('\n');
sendMessage(`📜 *Recent License Rotations*\n\n${history}`, {
buttons: [{ text: '« Back to Cycle', command: '/cycle' }]
});💡 Keeping token strings alphanumeric avoids unexpected underscore sanitization inside your Firebase Realtime DB path keys.
⚠️ Note: Replace the external URL in the HTTP post call with your production API revoke endpoint and ensure incoming bot requests are authenticated.
#FlexGram
🔥2👍1