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

