This documents NearSync's internal action-dispatch surface, used by the apps themselves and by tenant automations. It is not the public API and carries no stability guarantee — actions may change or be removed without notice. For the supported, versioned public API see API Reference.
Hyper-Worker Gateway
The hyper-worker is NearSync's server-side API gateway, deployed as a Supabase Edge Function. All API requests route through a single endpoint, dispatched to handler modules based on a type field in the request body.
Base URL
https://<your-supabase-project>.supabase.co/functions/v1/hyper-worker
Replace <your-supabase-project> with your Supabase project reference. For BYOK deployments, this is your own Supabase project URL.
Request Format
All endpoints use POST with a JSON body unless otherwise noted. The type field determines which handler processes the request.
curl -X POST https://<project>.supabase.co/functions/v1/hyper-worker \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-jwt-token>" \
-d '{
"type": "ai-chat",
"prompt": "Summarize this deal"
}'
Exceptions to POST
Three patterns use GET instead of POST:
| Pattern | Method | Use Case |
|---|---|---|
| Health check | GET (no params) | Uptime monitoring |
| WhatsApp webhook verification | GET with hub.* params | Meta webhook setup |
| Email tracking pixel | GET with type=track-email | Open tracking |
Service Modules
The hyper-worker routes requests across 15 service domains:
| Module | Endpoints | Description |
|---|---|---|
| Auth & Users | create-user, send-welcome, invite-staff, validate-invite, accept-invite | Account creation, invitations, onboarding |
| Chat | fetch-admin-chats, link-whatsapp-contact, update-chat-session, fetch-chat-history, log-web-chat | Conversation management |
| Google Workspace | fetch-inbox, fetch-email-detail, mark-email-read, fetch-calendar, create-meet-event, send-email | Gmail, Calendar, Meet integration |
| Booking | get-availability, booking, manage-booking | Scheduling and appointment management |
| Finance | create-payment, verify-payment | Payment processing (Stripe, Razorpay) |
| Legal | verify-document, sign-document, generate-contract | Document signing and generation |
| Projects | prd, enrich-project, enrich-organization | Deal creation, AI enrichment |
| Messaging | send-whatsapp, get-voice-token | WhatsApp and Twilio voice |
| Workflows | execute-workflow, resume-workflow, process_queue | Automation engine |
| AI | ai-chat | Multi-provider chat completion |
| CRM Sync | crm-init-oauth, crm-connections, crm-disconnect, crm-save-api-key, crm-start-sync, crm-sync-status, crm-sync-history | External CRM integration |
| Integrations | integration-init-oauth, integration-connections, integration-disconnect, integration-test, integration-refresh | Unified OAuth for 14+ providers |
| Utilities | system-cleanup, sync-google-reviews, track-view | Maintenance and tracking |
| Webhooks | WhatsApp incoming, Twilio voice | Inbound event handlers |
| Tracking | Email open pixel | Email read tracking |
Response Format
All responses return JSON (unless noted otherwise). Successful responses typically include a success: true field or the requested data directly.
{
"success": true
}
Error Responses
Errors return a JSON object with an error field and an appropriate HTTP status code.
{
"error": "Missing required field: email"
}
| Status | Meaning |
|---|---|
| 400 | Invalid action type or bad request body |
| 401 | Missing or invalid JWT |
| 403 | Webhook verification failed |
| 429 | Rate limit exceeded |
| 500 | Server error |
See Rate Limits for 429 response headers and Authentication for auth details.
Health Check
A plain GET request with no query parameters returns the isolate health status.
curl https://<project>.supabase.co/functions/v1/hyper-worker
Response (200, text/plain):
NearSync Worker Passive Health Check: OK
CORS
The gateway enforces origin-based CORS. Only requests from *.nearsync.tech are allowed in production. Preflight responses are cached for 86,400 seconds (24 hours). Supported methods: GET, POST, OPTIONS.
Standalone Edge Functions
In addition to the hyper-worker, NearSync deploys several standalone edge functions at their own URLs:
| Function | Path | Purpose |
|---|---|---|
canva-oauth | /functions/v1/canva-oauth | Canva OAuth flow and design operations |
crm-oauth | /functions/v1/crm-oauth | HubSpot and Salesforce OAuth callbacks |
integration-oauth | /functions/v1/integration-oauth | Unified OAuth callback for 14+ providers |
process-reminders | /functions/v1/process-reminders | Cron-triggered reminder processing |
fetch-reviews | /functions/v1/fetch-reviews | Google Places review sync |
lusha-sync | /functions/v1/lusha-sync | Lusha lead search and enrichment |
External Dependencies
The hyper-worker connects to several third-party APIs. If a dependency is unavailable, only the affected feature degrades - the gateway itself remains operational.
| Service | Features Affected |
|---|---|
| Google Gemini / OpenAI | AI chat, PRD generation, enrichment |
| Gmail API | Email read/send |
| Google Calendar | Booking, availability, calendar sync |
| Google Docs | Contract and invoice generation |
| Meta Graph API | WhatsApp messaging |
| Stripe / Razorpay | Payment processing |
| Twilio | Voice calls |
| Resend | Transactional email notifications |
Next Steps
- Authentication - How to obtain and use JWT tokens
- Rate Limits - Per-endpoint request limits
- CRM Endpoints - Deal and contact management
- Communications Endpoints - Email, WhatsApp, voice
- Webhooks - Incoming webhook handlers