API Documentation
How to use the QR code webhook endpoint
Webhook Endpoint
The webhook endpoint receives data from QR code scans
Endpoint URL
https://your-app.vercel.app/api/webhook
Method
GET
Query Parameters
name- The person's full nameemail- The person's email addressphone- The person's phone number
Example Request
GET /api/webhook?name=John+Doe&email=john@example.com&phone=123456789
Response
{
"success": true,
"message": "Data successfully written to Google Sheet",
"data": {
"name": "John Doe",
"email": "john@example.com",
"phone": "123456789"
}
}Google Sheets Integration
How to set up the Google Sheets integration
Required Environment Variables
GOOGLE_SHEET_ID- The ID of your Google SheetGOOGLE_CLIENT_EMAIL- The client email from your Google service accountGOOGLE_PRIVATE_KEY- The private key from your Google service account
Setting Up Google Service Account
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Sheets API
- Create a service account
- Create a key for the service account (JSON format)
- Share your Google Sheet with the service account email
Alternative: Google Apps Script
If you prefer to use Google Apps Script instead
You can also use Google Apps Script as described in your original plan. Here's the code:
const SHEET_NAME = "Sheet1"; // Change to your sheet name
function doGet(e) {
const name = e.parameter.name;
const email = e.parameter.email;
const phone = e.parameter.phone;
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME);
sheet.appendRow([new Date(), name, email, phone]);
return ContentService.createTextOutput("Received! Thank you.");
}Steps to Deploy
- In Google Sheets: Extensions > Apps Script
- Paste the code above
- Save the project
- Deploy > New deployment
- Select type: Web app
- Set "Who has access" to "Anyone"
- Deploy and copy the web app URL