Flex Coder: post #1567 โ€” TG.ME

๐Ÿ“ 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: 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๐Ÿฅฐ1
August 13, 2026 157