- 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>
188 lines
4.8 KiB
Markdown
188 lines
4.8 KiB
Markdown
# n8n Workflows for Access Hub
|
|
|
|
## Workflows
|
|
|
|
### 1. Create Google Meet Event (Simple)
|
|
**File:** `create-google-meet-event.json`
|
|
|
|
A simple 3-node workflow that:
|
|
1. Receives webhook POST from Supabase Edge Function
|
|
2. Creates event in Google Calendar using Google Calendar node
|
|
3. Returns the meet link
|
|
|
|
**Best for:** Quick setup with minimal configuration
|
|
|
|
---
|
|
|
|
### 2. Create Google Meet Event (Advanced)
|
|
**File:** `create-google-meet-event-advanced.json`
|
|
|
|
An advanced workflow with more control:
|
|
1. Receives webhook POST from Supabase Edge Function
|
|
2. Prepares event data with Code node (custom formatting)
|
|
3. Creates event using Google Calendar API directly
|
|
4. Returns the meet link
|
|
|
|
**Best for:** More customization, error handling, and control
|
|
|
|
---
|
|
|
|
## Import Instructions
|
|
|
|
### Option 1: Import from File
|
|
1. In n8n, click **+ Import from File**
|
|
2. Select the JSON file
|
|
3. Click **Import**
|
|
|
|
### Option 2: Copy-Paste
|
|
1. In n8n, click **+ New Workflow**
|
|
2. Click **...** (menu) → **Import from URL**
|
|
3. Paste the JSON content
|
|
4. Click **Import**
|
|
|
|
---
|
|
|
|
## Setup Instructions
|
|
|
|
### 1. Configure Webhook
|
|
- **Path**: `create-meet` (already set)
|
|
- **Method**: POST
|
|
- **Production URL**: Will be auto-generated when you activate the workflow
|
|
|
|
### 2. Configure Google Calendar Credentials
|
|
|
|
#### For Simple Workflow:
|
|
1. Click on the **Google Calendar** node
|
|
2. Click **Create New Credential**
|
|
3. Select **Service Account** authentication
|
|
4. Paste the entire JSON content from your service account file
|
|
5. Give it a name: "Google Calendar (Service Account)"
|
|
6. Click **Create**
|
|
|
|
#### For Advanced Workflow:
|
|
1. Click on the **Google Calendar API** node
|
|
2. Click **Create New Credential**
|
|
3. Select **Service Account** authentication for Google API
|
|
4. Paste the service account JSON
|
|
5. Give it a name: "Google Calendar API (Service Account)"
|
|
6. Click **Create**
|
|
|
|
### 3. Activate Workflow
|
|
1. Click **Active** toggle in top right
|
|
2. n8n will generate your webhook URL
|
|
3. Your webhook URL will be: `https://api.backoffice.biz.id/webhook-test/create-meet`
|
|
|
|
---
|
|
|
|
## Test the Workflow
|
|
|
|
### Manual Test with Curl:
|
|
```bash
|
|
curl -X POST https://api.backoffice.biz.id/webhook-test/create-meet \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"slot_id": "test-123",
|
|
"date": "2025-12-25",
|
|
"start_time": "14:00:00",
|
|
"end_time": "15:00:00",
|
|
"client_name": "Test Client",
|
|
"client_email": "test@example.com",
|
|
"topic": "Test Topic",
|
|
"notes": "Test notes",
|
|
"calendar_id": "your-email@gmail.com",
|
|
"brand_name": "Your Brand",
|
|
"test_mode": true
|
|
}'
|
|
```
|
|
|
|
### Expected Response:
|
|
```json
|
|
{
|
|
"meet_link": "https://meet.google.com/abc-defg-hij",
|
|
"event_id": "event-id-from-google-calendar",
|
|
"html_link": "https://www.google.com/calendar/event?eid=..."
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Workflow Variables
|
|
|
|
The webhook receives these fields from your Supabase Edge Function:
|
|
|
|
| Field | Description | Example |
|
|
|-------|-------------|---------|
|
|
| `slot_id` | Unique slot identifier | `uuid-here` |
|
|
| `date` | Event date (YYYY-MM-DD) | `2025-12-25` |
|
|
| `start_time` | Start time (HH:MM:SS) | `14:00:00` |
|
|
| `end_time` | End time (HH:MM:SS) | `15:00:00` |
|
|
| `client_name` | Client's full name | `John Doe` |
|
|
| `client_email` | Client's email | `john@example.com` |
|
|
| `topic` | Consultation topic | `Business Consulting` |
|
|
| `notes` | Additional notes | `Discuss project roadmap` |
|
|
| `calendar_id` | Google Calendar ID | `your-email@gmail.com` |
|
|
| `brand_name` | Your brand name | `Access Hub` |
|
|
| `test_mode` | Test mode flag | `true` |
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### Error: 403 Forbidden
|
|
- Make sure calendar is shared with service account email
|
|
- Service account email format: `xxx@project-id.iam.gserviceaccount.com`
|
|
- Calendar permissions: "Make changes to events"
|
|
|
|
### Error: 401 Unauthorized
|
|
- Check service account JSON is correct
|
|
- Verify Calendar API is enabled in Google Cloud Console
|
|
|
|
### Error: 400 Invalid
|
|
- Check date format (YYYY-MM-DD)
|
|
- Check time format (HH:MM:SS)
|
|
- Verify calendar ID is correct
|
|
|
|
### Webhook not triggering
|
|
- Make sure workflow is **Active**
|
|
- Check webhook URL matches: `/webhook-test/create-meet`
|
|
- Verify webhook method is **POST** not GET
|
|
|
|
---
|
|
|
|
## Calendar ID
|
|
|
|
To find your Calendar ID:
|
|
1. Go to Google Calendar Settings
|
|
2. Scroll to **Integrate calendar**
|
|
3. Copy the **Calendar ID**
|
|
4. For primary calendar: your Gmail address
|
|
|
|
---
|
|
|
|
## Production vs Test
|
|
|
|
- **Test Mode**: Uses `/webhook-test/` path
|
|
- **Production**: Uses `/webhook/` path
|
|
- Toggle in Admin Settings → Integrasi → Mode Test n8n
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
1. Import workflow JSON
|
|
2. Set up Google Calendar credentials with service account
|
|
3. Activate workflow
|
|
4. Test with curl command above
|
|
5. Check your Google Calendar for the event
|
|
6. Verify meet link is returned
|
|
|
|
---
|
|
|
|
## Support
|
|
|
|
If you need help:
|
|
- Check n8n workflow execution logs
|
|
- Check Google Calendar API logs
|
|
- Verify service account permissions
|
|
- Check calendar sharing settings
|