🚨 Instant API health checks and incident broadcasts from Telegram
When an API endpoint starts misbehaving during off-hours, logging into a heavy monitoring dashboard just to confirm service status is a pain. We set up an on-demand health checker that pings microservices directly via HTTP, updates shared state, and lets admins push instant incident notifications to every subscriber using built-in broadcast throttling.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 The built-in
#FlexGram
When an API endpoint starts misbehaving during off-hours, logging into a heavy monitoring dashboard just to confirm service status is a pain. We set up an on-demand health checker that pings microservices directly via HTTP, updates shared state, and lets admins push instant incident notifications to every subscriber using built-in broadcast throttling.
📁 Filename:
command/check.js👨💻 Code:
sendChatAction('typing')
const response = await HTTP.get({ url: 'https://api.github.com/zen' })
if (response) {
BOT.setProp('last_check', Date.now())
sendMessage('*System Status:* All systems operational 🟢')
} else {
BOT.setProp('last_status', 'DOWN')
sendMessage('*System Status:* Service disruption detected 🔴')
}📁 Filename:
command/alert.js👨💻 Code:
if (String(user.telegramid) !== process.env.ADMIN_ID) {
return sendMessage('Unauthorized command.')
}
const allUsers = await getDB('users')
const userIds = allUsers ? Object.keys(allUsers) : []
const report = await broadcast(userIds, `🚨 *Incident Update:* ${params || 'Maintenance in progress.'}`, [], 50)
sendMessage(`Alert dispatched: ${report.sent} delivered, ${report.failed} failed.`)📁 Filename:
command/__message__.js👨💻 Code:
sendMessage('Unrecognized command. Use /check to test system health.')💡 The built-in
broadcast() helper automatically handles rate-limiting delays between sends, preventing Telegram API 429 throttling errors when messaging large user lists.⚠️ Note: Requires the ADMIN_ID environment variable set in your deployment environment to restrict alert privileges.#FlexGram
👍1🏆1
🎫 Instant digital pass activation for private Telegram communities
Selling digital licenses or paid community access usually involves clunky email flows and manual link distribution. I automated real-time license key redemption directly inside Telegram using external API verification and persistent user properties. When an buyer pastes their license key, the bot validates it against the payment provider API and grants instant channel access.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Always call
#FlexGram
Selling digital licenses or paid community access usually involves clunky email flows and manual link distribution. I automated real-time license key redemption directly inside Telegram using external API verification and persistent user properties. When an buyer pastes their license key, the bot validates it against the payment provider API and grants instant channel access.
📁 Filename:
activate.js👨💻 Code:
const active = await USER.getProp('vip_status').value();
if (active) {
sendMessage('✨ You already have an active VIP membership!');
return;
}
waitForAnswer('verify_key');
sendMessage('🔑 Please enter your VIP license key to activate access:');📁 Filename:
verify_key.js👨💻 Code:
const res = await HTTP.post({ url: 'https://api.example.com/verify', body: { key: message, uid: user.telegramid } });
if (res && res.valid) {
USER.setProperty('vip_status', true);
clearWait();
sendMessage('🎉 *Key activated!* Access your VIP portal below:', { buttons: [{ text: 'Join VIP Lounge', url: 'https://t.me/+example' }] });
} else {
sendMessage('❌ Invalid or expired license key. Please check your key and try again.');
}📁 Filename:
pass.js👨💻 Code:
const active = await USER.getProp('vip_status').value();
if (!active) {
sendMessage('🔒 No active VIP pass found. Type /activate to redeem a key.');
return;
}
sendMessage('🎫 *VIP Member Card*\nUser: *' + user.first_name + '*\nStatus: *Active*');💡 Always call
clearWait() inside your handler command right after successful input processing to release the user from the state machine.⚠️ Note: Replace the API endpoint in verify_key.js with your actual authentication server URL.#FlexGram
🤩1
📦 Live inventory counter for floor staff
Updating inventory counts during active warehouse packing sessions usually requires constantly moving back and forth between physical shelves and a desktop dashboard. We built an instant Telegram stock adjuster where floor staff query any product SKU and tap inline buttons to increase or decrease counts in real time. The global bot state updates immediately in Firebase and re-renders the counter interface in place without cluttering the chat.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Using
#FlexGram
Updating inventory counts during active warehouse packing sessions usually requires constantly moving back and forth between physical shelves and a desktop dashboard. We built an instant Telegram stock adjuster where floor staff query any product SKU and tap inline buttons to increase or decrease counts in real time. The global bot state updates immediately in Firebase and re-renders the counter interface in place without cluttering the chat.
📁 Filename:
stock.js👨💻 Code:
const item = (Array.isArray(params) ? params[0] : params) || "sku_101";
const prop = await BOT.getProp(`stock_${item}`);
const qty = prop ? prop.value() || 0 : 0;
sendMessage(`📦 *Stock Level:* \`${item}\`\nQuantity: *${qty}*`, {
buttons: [[
{ text: "-5", command: `/adj ${item} -5` },
{ text: "-1", command: `/adj ${item} -1` },
{ text: "+1", command: `/adj ${item} 1` },
{ text: "+5", command: `/adj ${item} 5` }
]]
});
📁 Filename:
adj.js👨💻 Code:
if (!isCallback) return;
const args = Array.isArray(params) ? params : (params ? params.split(" ") : []);
const item = args[0] || "sku_101";
const delta = parseInt(args[1] || "0", 10);
const prop = await BOT.getProp(`stock_${item}`);
const current = prop ? prop.value() || 0 : 0;
const next = Math.max(0, current + delta);
await BOT.setProp(`stock_${item}`, next);
await answerCallback(`Stock updated to ${next}`);
editCallbackMessage(`📦 *Stock Level:* \`${item}\`\nQuantity: *${next}*`, [[
{ text: "-5", command: `/adj ${item} -5` },
{ text: "-1", command: `/adj ${item} -1` },
{ text: "+1", command: `/adj ${item} 1` },
{ text: "+5", command: `/adj ${item} 5` }
]], message_id);
💡 Using
editCallbackMessage mutates the existing message UI instantly so floor staff get clean visual feedback without flooding group history.⚠️ Note: Ensure your bot has database access configured viaFIREBASE_URLandFIREBASE_SECRETso inventory levels persist across server restarts.
#FlexGram
👍2
🧾 Multi-step receipt intake on the go
Snapping paper receipts while traveling for work usually leaves me with a messy camera roll and zero context when expense reporting comes around. By chaining wait states with session memory in FlexGram, we can collect text notes and photo attachments in a seamless back-and-forth prompt flow. Temporary state holds the expense description in memory while waiting for the image, then increments the persistent receipt count once finished.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Always call
#FlexGram
Snapping paper receipts while traveling for work usually leaves me with a messy camera roll and zero context when expense reporting comes around. By chaining wait states with session memory in FlexGram, we can collect text notes and photo attachments in a seamless back-and-forth prompt flow. Temporary state holds the expense description in memory while waiting for the image, then increments the persistent receipt count once finished.
📁 Filename:
command/expense.js👨💻 Code:
sendChatAction("typing");
sendMessage("Send the expense summary and total cost (e.g., Client Lunch $45):");
waitForAnswer("expense_photo");📁 Filename:
command/expense_photo.js👨💻 Code:
TEMP.setProp("expense_details", message);
sendChatAction("typing");
sendMessage("Got it! Now upload a photo of the receipt image:");
waitForAnswer("expense_save");📁 Filename:
command/expense_save.js👨💻 Code:
const details = await TEMP.getProp("expense_details").value();
clearWait();
USER.add("total_expenses", 1);
TEMP.deleteProp("expense_details");
sendMessage("Logged expense receipt for: " + details);💡 Always call
clearWait() inside the final step handler so subsequent user messages resume normal command routing.⚠️ Note: Persistent counter methods likeUSER.add()require settingFIREBASE_URLandFIREBASE_SECRETin your environment variables.
#FlexGram
👌1
🎉 We have just completed 2 yrs on YouTube
Thanks to each member who has supported me to reach here 🙏
https://www.youtube.com/@Flex_Coder
🕊1
🚀 Keep remote team blockers visible without endless standup meetings
Async development across multiple timezones often means junior devs stay stuck on issue dependencies for hours before anyone notices. By leveraging FlexGram per-user Firebase properties, engineers log active impediments directly in Telegram the moment they get stuck. Teammates can inspect or resolve their logged blocker status anytime without waiting for a scheduled sync call.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Persistent user properties survive server restarts and redeployments seamlessly because they map straight to Realtime Database paths.
#FlexGram
Async development across multiple timezones often means junior devs stay stuck on issue dependencies for hours before anyone notices. By leveraging FlexGram per-user Firebase properties, engineers log active impediments directly in Telegram the moment they get stuck. Teammates can inspect or resolve their logged blocker status anytime without waiting for a scheduled sync call.
📁 Filename:
command/blocker.js👨💻 Code:
if (!params) return sendMessage("Please provide details: `/blocker <issue description>`");
USER.setProp("has_blocker", true);
USER.setProp("blocker_text", params);
USER.setProp("blocker_user", user.first_name);
sendMessage(`Logged active blocker: *${params}*\nClear it anytime with /unblock when resolved.`);📁 Filename:
command/myblocker.js👨💻 Code:
const active = await USER.getProp("has_blocker").value();
if (!active) return sendMessage("You currently have no active blockers logged. Nice work!");
const details = await USER.getProp("blocker_text").value();
sendMessage(`Your current blocker: *${details}*`);📁 Filename:
command/unblock.js👨💻 Code:
USER.setProp("has_blocker", false);
USER.deleteProp("blocker_text");
USER.deleteProp("blocker_user");
sendMessage("Impediment cleared! Updated your status across the workspace.");💡 Persistent user properties survive server restarts and redeployments seamlessly because they map straight to Realtime Database paths.
#FlexGram
👍1
🔍 Inspect public API endpoint status directly inside any Telegram chat
Juggling browser dev tools and pasting raw response URLs into support threads makes real-time endpoint checks sluggish. By using FlexGram's built-in inline query handler and HTTP client, team members can check endpoint reachability directly inside any group or private chat window. The bot performs a quick GET request, evaluates the response, and generates an inline result ready to insert into the conversation.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Keep inline query payloads lightweight so result previews render instantly while typing.
#FlexGram
Juggling browser dev tools and pasting raw response URLs into support threads makes real-time endpoint checks sluggish. By using FlexGram's built-in inline query handler and HTTP client, team members can check endpoint reachability directly inside any group or private chat window. The bot performs a quick GET request, evaluates the response, and generates an inline result ready to insert into the conversation.
📁 Filename:
command/__inline__.js👨💻 Code:
if (!inlineQuery) return;
const url = inlineQuery.startsWith('http') ? inlineQuery : `https://${inlineQuery}`;
const res = await HTTP.get({ url });
const status = res ? 'HTTP 200 OK' : 'Unreachable / Error';
answerInlineQuery([{
type: 'article',
id: '1',
title: `Check ${inlineQuery}`,
description: status,
input_message_content: { message_text: `*Target:* \`${url}\`\n*Status:* ${status}` }
}]);
📁 Filename:
command/ping.js👨💻 Code:
if (!params) return sendMessage('Provide a domain: `/ping example.com`');
sendChatAction('typing');
const url = params.startsWith('http') ? params : `https://${params}`;
const res = await HTTP.get({ url });
const status = res ? 'online' : 'offline';
sendMessage(`Host \`${url}\` is currently *${status}*.`);💡 Keep inline query payloads lightweight so result previews render instantly while typing.
⚠️ Note: Inline Mode must be explicitly turned on in @BotFather under Bot Settings > Inline Mode for the inline handler to work across chats.
#FlexGram
⚡1
New Video Uploaded 👇
https://youtu.be/Od4A_IiK8CU
📹 Video Description:
In this video, I have shown how to build a WhatsApp Bot that can automate tasks and help save time for your business. I have covered the complete setup, coding, and hosting process step by step, making it beginner-friendly.
https://youtu.be/Od4A_IiK8CU
📹 Video Description:
In this video, I have shown how to build a WhatsApp Bot that can automate tasks and help save time for your business. I have covered the complete setup, coding, and hosting process step by step, making it beginner-friendly.
⚠️ Note: Subscribe Backup Channel: https://youtube.com/@flecdev
⏤͟͞ROCODER
New Video Uploaded 👇 https://youtu.be/Od4A_IiK8CU 📹 Video Description: In this video, I have shown how to build a WhatsApp Bot that can automate tasks and help save time for your business. I have covered the complete setup, coding, and hosting process step…
👍 Like & Subscribe to our channel for more useful content!
📍 Comment "WhatsApp Hosting" on YouTube channel to get Part 2 as soon as possible.
🥰1
📢 Safe mass notifications without getting your bot token rate-limited
Pushing product announcements or community updates to thousands of users in a raw JavaScript loop is a fast track to Telegram API 429 rate-limit errors. FlexGram includes a built-in throttled broadcast helper that safely queues messages with custom delays while returning total delivery counts. Here is how to build a clean two-step admin dispatcher that pulls subscriber IDs straight from Firebase.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Passing a 100ms delay to
#FlexGram
Pushing product announcements or community updates to thousands of users in a raw JavaScript loop is a fast track to Telegram API 429 rate-limit errors. FlexGram includes a built-in throttled broadcast helper that safely queues messages with custom delays while returning total delivery counts. Here is how to build a clean two-step admin dispatcher that pulls subscriber IDs straight from Firebase.
📁 Filename:
command/start.js👨💻 Code:
await FLEX.setProperty('active', true)
const statusText = 'Welcome! You are now subscribed to automated community alerts.'
sendMessage(statusText, { buttons: [{ text: 'Check Status', command: '/status' }] })📁 Filename:
command/status.js👨💻 Code:
const isActive = await FLEX.getProperty('active').value()
const text = isActive ? 'Subscription: *Active*' : 'Subscription: *Inactive*'
sendMessage(text)📁 Filename:
command/announce.js👨💻 Code:
if (String(user.telegramid) !== process.env.ADMIN_ID) return sendMessage('Access denied.')
sendMessage('Send the text you want to broadcast across all active subscribers:')
waitForAnswer('dispatch_announce')📁 Filename:
command/dispatch_announce.js👨💻 Code:
clearWait()
const usersData = await getDB('users') || {}
const subscriberIds = Object.keys(usersData)
sendMessage(`Dispatching updates to ${subscriberIds.length} users with 100ms throttle...`)
const stats = await broadcast(subscriberIds, message, null, 100)
sendMessage(`Dispatch finished! Delivered: *${stats.sent}* | Failed: *${stats.failed}*`)
💡 Passing a 100ms delay to
broadcast keeps your API requests well under Telegram's global 30 messages per second limit during big announcements.⚠️ Note: Ensure your ADMIN_ID environment variable is set to your numeric Telegram user ID to restrict access to the broadcast trigger.#FlexGram
🎛️ Instant in-bot preference toggles without web dashboards
Forcing users out of Telegram into a web dashboard just to switch off digest emails usually leads to them blocking your bot. I built an interactive settings panel that toggles user alerts directly in Firebase and updates the button labels on the fly. Users can customize their exact notification preferences with one tap without reloading messages or leaving the chat.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Always invoke
#FlexGram
Forcing users out of Telegram into a web dashboard just to switch off digest emails usually leads to them blocking your bot. I built an interactive settings panel that toggles user alerts directly in Firebase and updates the button labels on the fly. Users can customize their exact notification preferences with one tap without reloading messages or leaving the chat.
📁 Filename:
command/settings.js👨💻 Code:
let email = await USER.getProp('opt_email').value() ?? true;
let digest = await USER.getProp('opt_digest').value() ?? false;
let buttons = [
[{ text: `Email Alerts: ${email ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_email' }],
[{ text: `Weekly Digest: ${digest ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_digest' }]
];
sendMessage('*Notification Preferences*\nTap options below to toggle instantly:', { buttons });📁 Filename:
command/toggle_email.js👨💻 Code:
let current = await USER.getProp('opt_email').value() ?? true;
let next = !current;
USER.setProp('opt_email', next);
let digest = await USER.getProp('opt_digest').value() ?? false;
let buttons = [
[{ text: `Email Alerts: ${next ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_email' }],
[{ text: `Weekly Digest: ${digest ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_digest' }]
];
if (isCallback) answerCallback(`Email alerts turned ${next ? 'ON' : 'OFF'}`);
editButton(message_id, buttons);📁 Filename:
command/toggle_digest.js👨💻 Code:
let current = await USER.getProp('opt_digest').value() ?? false;
let next = !current;
USER.setProp('opt_digest', next);
let email = await USER.getProp('opt_email').value() ?? true;
let buttons = [
[{ text: `Email Alerts: ${email ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_email' }],
[{ text: `Weekly Digest: ${next ? 'ON 🔔' : 'OFF 🔕'}`, command: '/toggle_digest' }]
];
if (isCallback) answerCallback(`Weekly digest turned ${next ? 'ON' : 'OFF'}`);
editButton(message_id, buttons);💡 Always invoke
answerCallback() during button updates to immediately stop Telegram's loading spinner on the user's screen.#FlexGram
📋 Standardizing client onboarding questionnaires without third-party web form builders
When scoping new dev projects, asking prospective clients to open external form links usually drops completion rates. By chaining short prompt handlers with temporary memory and command re-routing, you can run conversational intake forms straight inside Telegram. Inputs are captured step-by-step in temporary session state before persisting the completed brief directly to Firebase.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Always invoke
#FlexGram
When scoping new dev projects, asking prospective clients to open external form links usually drops completion rates. By chaining short prompt handlers with temporary memory and command re-routing, you can run conversational intake forms straight inside Telegram. Inputs are captured step-by-step in temporary session state before persisting the completed brief directly to Firebase.
📁 Filename:
command/brief.js👨💻 Code:
export default async function () {
sendMessage("What is your estimated project budget?");
waitForAnswer("__brief_budget__");
}📁 Filename:
command/__brief_budget__.js👨💻 Code:
export default async function () {
await TEMP.setProp("budget", message);
sendMessage("Got it! Now briefly describe the core deliverables:");
waitForAnswer("__brief_desc__");
}📁 Filename:
command/__brief_desc__.js👨💻 Code:
export default async function () {
const budget = await TEMP.getProp("budget").value();
await USER.setProp("latest_brief", { budget, scope: message });
clearWait();
sendMessage(`Brief saved successfully!\n\n*Budget:* ${budget}\n*Scope:* ${message}`);
}💡 Always invoke
clearWait() at the final step of a conversation flow so subsequent user messages resume standard command routing.#FlexGram
🔑 Zero-dashboard software license activation right in Telegram
Managing customer license keys often forces you to build bloated web portals just so buyers can verify their plan tier or unbind a key. By combining FlexGram's Firebase-backed
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Because
#FlexGram
Managing customer license keys often forces you to build bloated web portals just so buyers can verify their plan tier or unbind a key. By combining FlexGram's Firebase-backed
USER state with global HTTP requests, you can handle license verification, local state binding, and self-serve key management entirely inside Telegram. Customers activate digital products instantly while your infrastructure stays minimal.📁 Filename:
command/activate.js👨💻 Code:
if (!params) return sendMessage("Please provide a key: `/activate YOUR-KEY`");
let res = HTTP.post({ url: "https://api.mysoftware.com/verify", body: JSON.stringify({ key: params, tg_id: user.telegramid }) });
let data = JSON.parse(res.body || "{}");
if (!data.valid) return sendMessage("Invalid or expired license key.");
USER.setProperty("license_key", params);
USER.setProperty("license_tier", data.tier);
sendMessage("*License Activated!*\nPlan: *" + data.tier + "*");📁 Filename:
command/status.js👨💻 Code:
let key = USER.getProp("license_key").value();
let tier = USER.getProp("license_tier").value();
if (!key) return sendMessage("No active license found. Use `/activate KEY` first.");
sendMessage("*Active License Details*\nKey: `" + key + "`\nPlan: *" + tier + "*");📁 Filename:
command/deactivate.js👨💻 Code:
let key = USER.getProp("license_key").value();
if (!key) return sendMessage("You do not have an active license to revoke.");
USER.deleteProp("license_key");
USER.deleteProp("license_tier");
sendMessage("License `" + key + "` has been unbound from this account.");💡 Because
USER properties persist automatically in Firebase Realtime DB, your backend desktop or web app can query user key states directly without hammering your central auth endpoint.⚠️ Note: Store external API tokens and secret keys in your production environment variables to keep backend calls secure.
#FlexGram
👍1😍1
🌐 Instant DNS record lookup for domain troubleshooting in Telegram
Nothing interrupts a product launch quite like hunting down misconfigured DNS records from a mobile device. By hooking FlexGram's built-in HTTP client directly into Google's Public DNS API, you can query live domain records inside any chat without leaving Telegram. Pass the domain directly as a command parameter or let the bot prompt you interactively.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 You can expand the query string to request MX, TXT, or CNAME records dynamically based on user needs.
#FlexGram
Nothing interrupts a product launch quite like hunting down misconfigured DNS records from a mobile device. By hooking FlexGram's built-in HTTP client directly into Google's Public DNS API, you can query live domain records inside any chat without leaving Telegram. Pass the domain directly as a command parameter or let the bot prompt you interactively.
📁 Filename:
dns.js👨💻 Code:
if (params) {
sendChatAction('typing')
let res = HTTP.get({ url: 'https://dns.google/resolve?name=' + params + '&type=A' })
let data = JSON.parse(res.body || '{}')
let ip = data.Answer ? data.Answer[0].data : 'No A record found'
sendMessage('🌐 *DNS Result for ' + params + '*\n\nIP Address: `' + ip + '`')
} else {
sendMessage('Type the domain name you want to query:')
waitForAnswer('get_dns')
}📁 Filename:
get_dns.js👨💻 Code:
sendChatAction('typing')
let domain = message.trim().toLowerCase()
let res = HTTP.get({ url: 'https://dns.google/resolve?name=' + domain + '&type=A' })
let data = JSON.parse(res.body || '{}')
let ip = data.Answer ? data.Answer[0].data : 'No A record found'
sendMessage('🌐 *DNS Result for ' + domain + '*\n\nIP Address: `' + ip + '`')
clearWait()💡 You can expand the query string to request MX, TXT, or CNAME records dynamically based on user needs.
⚠️ Note: Google DNS API requires no authorization keys or external environment configuration.
#FlexGram
👍1🕊1
📍 Instant Field Equipment Inspections via Telegram
Field technicians logging site visits shouldn't have to fight bloated web apps over spotty 3G signals. Our field team needed a quick, reliable way to submit equipment audits with verified GPS coordinates and photo proof directly from the chat. Using FlexGram's temporary state, chat status actions, and zero-import HTTP client, field reps complete a full site inspection log in seconds.
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
📁 Filename:
👨💻 Code:
💡 Storing temporary wizard steps in
#FlexGram
Field technicians logging site visits shouldn't have to fight bloated web apps over spotty 3G signals. Our field team needed a quick, reliable way to submit equipment audits with verified GPS coordinates and photo proof directly from the chat. Using FlexGram's temporary state, chat status actions, and zero-import HTTP client, field reps complete a full site inspection log in seconds.
📁 Filename:
checkin.js👨💻 Code:
sendChatAction("typing")
sendMessage("📍 Please share your current location to start the site audit.")
waitForAnswer("save_location")📁 Filename:
save_location.js👨💻 Code:
if (!flex.message.location) return sendMessage("⚠️ Location missing. Please send your GPS location.")
TEMP.setProperty("lat", flex.message.location.latitude)
TEMP.setProperty("lng", flex.message.location.longitude)
sendMessage("📷 Location saved! Now send a photo of the equipment setup.")
waitForAnswer("save_photo")📁 Filename:
save_photo.js👨💻 Code:
if (!flex.message.photo) return sendMessage("⚠️ Photo missing. Please send a photo of the equipment.")
sendChatAction("upload_photo")
let photoId = flex.message.photo.pop().file_id
let lat = await TEMP.getProp("lat").value()
let lng = await TEMP.getProp("lng").value()
HTTP.post({ url: "https://api.fieldops.dev/v1/inspections", body: { user: user.telegramid, lat, lng, photoId } })
clearWait()
sendMessage("✅ *Audit Submitted!* Location coordinates and hardware snapshot are logged.")💡 Storing temporary wizard steps in
TEMP keeps multi-step conversational input in memory without cluttering persistent database tables.⚠️ Note: Ensure your external inspection backend endpoint validates request payloads and accepts JSON body parameters.
#FlexGram
🕊1