Overview
FUYL webhooks provide the capability to send real-time locker event data directly to Google Sheets for custom reporting and analysis. When a workflow manager like Power Automate, n8n, or Zapier isn’t available, Google Apps Script can be used to accept incoming webhooks.
- Real-time visibility of locker events is required outside the FUYL portal
- Reporting formats beyond standard FUYL reports are needed
- Integration with existing Google Workspace workflows is desired
- Long-term historical data retention in a familiar spreadsheet format is important
This approach is intended to complement the standard FUYL dashboard by enabling custom filtering, visualization, and management of raw event data.
Prerequisites
To configure this integration, the following prerequisites must be met:
- FUYL Advanced or Classic subscription (webhooks are not supported on Basic plans)
- Owner or Administrator access to the FUYL Cloud
- Google Workspace account (Education or Business)
- Access to Google Sheets
- Permission to create and deploy Google Apps Scripts
Procedure
Set up the Google Sheet
To begin, a Google Sheet must be created to receive webhook data:
- Open Google Sheets and create a blank spreadsheet
- Rename the spreadsheet with a descriptive label such as FUYL Webhook Events
Set up the App Script and deploy it
Completion of the following steps will enable the Google Sheet to receive webhook payloads:
- Within Google Sheets, select Extensions and then Apps Script
- Delete any initial sample or default code from the editor
- Paste the following script into the code editor:
function doPost(e) {
try {
// Parse payload safely
const payload = JSON.parse(e.postData.contents || "{}");
const data = payload.data || {};
const user = data.user || {};
// Get or create the main sheet
const ss = SpreadsheetApp.getActiveSpreadsheet();
let sheet = ss.getSheetByName("Webhook Events");
if (!sheet) {
sheet = ss.insertSheet("Webhook Events");
sheet.appendRow([
"ReceivedTime", "EventTimestamp", "EventType", "UserType",
"BayName", "BayId", "Bay", "BayTags",
"StationName", "StationId",
"UserId", "UserName", "UserEmail", "ExternalRefId", "UserTags",
"Origin"
]);
}
// Build and append row safely — undefined values replaced with blanks
sheet.appendRow([
new Date(), // Time received
payload.timestamp || "", // Event timestamp
payload.type || "", // Event type (BAY_BREACH, BAY_CLOSED, etc.)
payload.userType || "", // User type (SYSTEM, ADMIN, etc.)
data.bayName || "",
data.bayId || "",
data.bay || "",
Array.isArray(data.bayTags) ? data.bayTags.join(", ") : "",
data.stationName || "",
data.stationId || "",
user.id || "",
user.name || "",
user.email || "",
user.externalRefId || "",
Array.isArray(user.tags) ? user.tags.join(", ") : "",
payload.origin || ""
]);
// Acknowledge immediately to avoid webhook timeout
return ContentService.createTextOutput(
JSON.stringify({ status: "ok", message: "Received" })
).setMimeType(ContentService.MimeType.JSON);
} catch (err) {
// Log errors to a separate sheet for review
const ss = SpreadsheetApp.getActiveSpreadsheet();
let errorSheet = ss.getSheetByName("Errors");
if (!errorSheet) errorSheet = ss.insertSheet("Errors");
errorSheet.appendRow([new Date(), err.message]);
return ContentService.createTextOutput(
JSON.stringify({ status: "error", message: err.message })
).setMimeType(ContentService.MimeType.JSON);
}
}
- Select Deploy and choose New deployment
- In the deployment type options, select Web app
- Enter an appropriate deployment description (for example, FUYL Webhook Receiver)
- Choose Me for Execute as
- Choose Anyone for Who has access
- Select Deploy again, review, and authorise when prompted
- Copy the Web app URL that is generated after deployment; this will be required for webhook configuration
Note: The generated Web app URL provides write access to the Google Sheet. This URL must be kept secure.
Configure the webhook in FUYL Cloud
To finalise configuration, a webhook must be set up in the FUYL Cloud:
- Access the FUYL Cloud portal
- Navigate to Integrations and then Webhooks
- Select New Webhook
- Complete the following configuration fields:
- Name: Assign a descriptive label, such as Google Sheets Event Logger
- URL: Paste the previously copied Web app URL
- Description: Optionally describe the webhook’s function
- Auth Bearer Token: Leave blank unless custom token validation is enabled in the script
- Event Types: Select event types to be logged (Bay Reserved, Bay Accessed, Bay Closed, Bay Stuck, Bay Breach, Bay Temporarily Locked)
All event types may be selected, or selection may be limited to specific events, depending on reporting needs.
Test
Functionality of the webhook can be verified as follows:
- On the webhook setup page, select Test to send a sample payload
- Inspect the Webhook Events tab for a new row containing test data
- Ensure that fields such as ReceivedTime, EventType, and BayName are correctly populated
- In case of error, review the Errors sheet for diagnostic details
Upon successful testing, select Save to activate the webhook. The system will automatically log new events and retry failed deliveries up to 7 times at increasing intervals in the event of transmission issues. Long outages may result in missed events.
Next Steps
Visualization options in Google Sheets
Once event data populates the sheet, the following visualization and reporting options may be used:
- Pivot tables can be created to summarize events by type, station, or time period
- Charts may be used to visualise trends such as breach events over time
- Conditional formatting can highlight critical events (e.g., Bay Breach, Bay Stuck)
- Filtered views can be created for segmented users or reporting channels
- Formulas may be employed to analyse metrics such as average usage time or most active stations
External reporting options
Automated email notifications and reporting may be configured. Possible approaches include:
- Integration of MailApp.sendEmail() functions into Apps Script for selected event types
- Time-driven triggers for daily or weekly summary reports
- Conditional alerts triggered on specific criteria (e.g., multiple breach events)
- Activation of Google Sheets notification rules for basic alerts
- Provision of view-only access to the sheet for responsive and transparent reporting
Advanced integrations
For complex scenarios, further integration can be undertaken:
- Connection to Google Data Studio for advanced dashboards
- Development of custom Apps Script procedures for advanced processing and automation
For additional assistance or specific configuration needs, please contact support.