Honest question for anyone wiring SafetyCulture / iAuditor via HTTP Request or community nodes…
We get work schedules as email attachments (XLS/CSV). The painful bit isn’t starting an inspection blank — it’s getting header fields (site, job time, store number, etc.) prefilled so nobody retypes them the day before.
Is anyone doing: Gmail trigger (attachment) → parse sheet → create/update inspection with header values via the SafetyCulture API?
What worked / what bounced? Especially Premium vs Free and template field IDs.
Not looking for a vendor pitch — war stories welcome.
Hi @ReedOps Welcome!
Gmail Trigger to catch the mail, a Gmail node getting the message with Simplify off and Download Attachments on, Extract From File for the XLS or CSV, then one HTTP Request posting to https://api.safetyculture.io/audits with template_id and a header_items array, token as Bearer <token>. Title page questions go in header_items, anything on a later page goes in items, and that split is what breaks first.
Do not hand-build the item IDs. Fill one inspection manually with the fields you want, GET it back, then copy those item objects and clear the responses, which gives you the exact item_id values the template expects. Only text, textsingle, address, datetime, question, list, checkbox, slider and switch types can be prefilled.
Free has no API token at all, tokens are Premium and Enterprise only, so there is nothing to test against on the free tier.
If the template has an inspection title format built from prefilled questions, the title stays empty until someone opens the inspection in the web or mobile app.
The retyping isn’t the real cost — the misfile is. Someone on the ops side opens the app the night before and hand-keys site / job time / store number off the schedule email. One transposed digit and the audit files against the wrong store, caught weeks later.
Anshul’s header_items/items + item_id-from-a-GET recipe is the right spine. Three spots the happy path doesn’t reach:
Idempotency: one email fans out to N rows and Gmail re-fires on retries, so dedupe or you spawn duplicates. There’s no server-side lookup by store number — search only filters by template and a date window — so you GET each candidate, compare, then POST or PUT. Headers aren’t write-once (PUT /audits/{id} is a partial update), so create-or-update is real.
XLS dates: Excel stores a datetime as a serial number, not “08:00”, and prefill wants UTC ISO-8601 with you converting — where an unattended parse goes offset.
Malformed prefill can drop silently, so read the inspection back to confirm each field landed.
Built a few Gmail-parse → authenticated-REST pipelines like this — notes at priyanshukumar.co.
One question that changes the design: do corrected schedules re-arrive same-day? If so it keys on (store + date) and updates in place, not just create.