Auditing physical contractor access into colocation server halls usually turns into a headache of paper logbooks and forgotten checkout times. With this workflow, visiting engineers select their assigned server hall from a clean reply keyboard, receive their entry credentials and compliance brief as a document, and get logged directly into Firebase. Once maintenance wraps up, checking out clears their session and records their exit timestamp instantly.
📁 Filename:
command/visit.js👨💻 Code:
sendReplyKeyboard("Select your assigned server hall for today's maintenance:", [
["Hall Alpha (Racks 1-20)"],
["Hall Beta (Racks 21-40)"],
["Cage C (High-Density SAN)"]
])
waitForAnswer("/grant_access")📁 Filename:
command/grant_access.js👨💻 Code:
clearWait()
removeKeyboard("Target zone recorded.")
FLEX.setProperty("active_zone", message)
pushDB("audit_logs/colocation", {
engineer_id: user.id,
engineer_name: user.first_name,
zone: message,
action: "checkin",
timestamp: Date.now()
})
sendDocument("https://assets.internal.net/dc-compliance-pass.pdf", {
caption: `Access granted for *${message}*. Keep your digital pass accessible at all times.`,
parse_mode: "Markdown"
})
📁 Filename:
command/leave.js👨💻 Code:
const zone = await FLEX.getProperty("active_zone").value()
if (!zone) {
sendMessage("No active data hall check-in found for your account.")
return
}
FLEX.deleteProperty("active_zone")
pushDB("audit_logs/colocation", {
engineer_id: user.id,
engineer_name: user.first_name,
zone: zone,
action: "checkout",
timestamp: Date.now()
})
sendMessage(`Checked out of *${zone}*. Security gate has been notified.`, { parse_mode: "Markdown" })💡 Always call
removeKeyboard() right when consuming reply keyboard input so custom buttons don't linger on the technician's screen.⚠️ Note: EnsureFIREBASE_URLandFIREBASE_SECRETare configured so audit logs and user property states persist across server restarts.
#FlexGram
