Add Google Calendar integration via Supabase Edge Functions

- Create new create-google-meet-event edge function
- Use service account authentication (no OAuth needed)
- Add google_service_account_json field to platform_settings
- Add admin UI for service account JSON configuration
- Include test connection button in Integrasi tab
- Add comprehensive setup documentation
- Keep n8n workflows as alternative option

Features:
- Direct Google Calendar API integration
- JWT authentication with service account
- Auto-create Google Meet links
- No external dependencies needed
- Simple configuration via admin panel

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2025-12-23 01:32:23 +07:00
parent dfda71053c
commit 631dc9a083
12 changed files with 1258 additions and 2 deletions

View File

@@ -0,0 +1,127 @@
{
"name": "Create Google Meet Event - Access Hub (Advanced)",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "create-meet",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook-trigger",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1.1,
"position": [250, 300],
"webhookId": "create-meet-webhook"
},
{
"parameters": {
"jsCode": "const items = $input.all();\nconst data = items[0].json;\n\n// Parse date and time\nconst startDate = new Date(`${data.date}T${data.start_time}`);\nconst endDate = new Date(`${data.date}T${data.end_time}`);\n\n// Format for Google Calendar API (ISO 8601 with timezone)\nconst startTime = startDate.toISOString();\nconst endTime = endDate.toISOString();\n\n// Build event data\nconst eventData = {\n calendarId: data.calendar_id,\n summary: `Konsultasi: ${data.topic} - ${data.client_name}`,\n description: `Client: ${data.client_email}\\n\\nNotes: ${data.notes || '-'}\\n\\nSlot ID: ${data.slot_id}\\nBrand: ${data.brand_name || 'Access Hub'}`,\n start: {\n dateTime: startTime,\n timeZone: 'Asia/Jakarta'\n },\n end: {\n dateTime: endTime,\n timeZone: 'Asia/Jakarta'\n },\n attendees: [\n { email: data.client_email }\n ],\n conferenceData: {\n createRequest: {\n requestId: data.slot_id,\n conferenceSolutionKey: { type: 'hangoutsMeet' }\n }\n },\n sendUpdates: 'all',\n guestsCanInviteOthers: false,\n guestsCanModify: false,\n guestsCanSeeOtherGuests: false\n};\n\nreturn [{ json: eventData }];"
},
"id": "prepare-event-data",
"name": "Prepare Event Data",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [470, 300]
},
{
"parameters": {
"authentication": "serviceAccount",
"resource": "calendar",
"operation": "insert",
"calendarId": "={{ $json.calendarId }}",
"body": "={{ { summary: $json.summary, description: $json.description, start: $json.start, end: $json.end, attendees: $json.attendees, conferenceData: $json.conferenceData, sendUpdates: $json.sendUpdates, guestsCanInviteOthers: $json.guestsCanInviteOthers, guestsCanModify: $json.guestsCanModify, guestsCanSeeOtherGuests: $json.guestsCanSeeOtherGuests } }}",
"options": {
"conferenceDataVersion": 1
}
},
"id": "google-calendar-api",
"name": "Google Calendar API",
"type": "n8n-nodes-base.googleApi",
"typeVersion": 1,
"position": [690, 300],
"credentials": {
"googleApi": {
"id": "REPLACE_WITH_YOUR_CREDENTIAL_ID",
"name": "Google Calendar API (Service Account)"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"meet_link\": $json.hangoutLink, \"event_id\": $json.id, \"html_link\": $json.htmlLink } }}"
},
"id": "respond-to-webhook",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [910, 300]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "error-handler",
"name": "error",
"value": "={{ $json.error?.message || 'Unknown error' }}",
"type": "string"
}
]
},
"options": {}
},
"id": "error-handler",
"name": "Error Handler",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [910, 480]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Prepare Event Data",
"type": "main",
"index": 0
}
]
]
},
"Prepare Event Data": {
"main": [
[
{
"node": "Google Calendar API",
"type": "main",
"index": 0
}
]
]
},
"Google Calendar API": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": ["access-hub", "calendar", "meet"],
"triggerCount": 1,
"updatedAt": "2025-12-23T00:00:00.000Z",
"versionId": "1"
}