Skip to Content
IntegrationsOverview

Integrations Overview

Hoikka includes lightweight utilities for integrating external systems (ERP, PIM, etc.) alongside Vercel Workflow for durable, scheduled tasks.

Available Utilities

Vercel Workflow

Durable workflows with scheduling, retry, and observability:

workflows/inventory-sync.ts
import { sleep } from "workflow"; export async function inventorySync() { "use workflow"; while (true) { await syncInventory(); await sleep("1h"); } } async function syncInventory() { "use step"; const { runSync } = await import("$lib/server/integrations"); await runSync(inventoryJob); }

Sync Runner

Reusable pattern for syncing external data:

import { runSync, type SyncJob } from "$lib/server/integrations"; const inventorySync: SyncJob<ErpItem, LocalVariant> = { name: "erp-inventory", fetchExternal: () => erpClient.getInventory() // ... }; const results = await runSync(inventorySync);

Webhooks

Verify incoming webhook signatures:

src/routes/api/webhooks/erp/+server.ts
import { json } from "@sveltejs/kit"; import { verifyHmacSha256 } from "$lib/server/integrations"; import { env } from "$env/dynamic/private"; export async function POST({ request }) { const body = await request.text(); const signature = request.headers.get("x-signature")!; if (!verifyHmacSha256(body, signature, env.ERP_WEBHOOK_SECRET!)) { return json({ error: "Invalid signature" }, { status: 401 }); } const payload = JSON.parse(body); // handle webhook... return json({ received: true }); }

Retry

Retry failed operations with exponential backoff:

import { withRetry } from "$lib/server/integrations"; await withRetry(() => externalApi.call(), { maxAttempts: 3 });
Last updated on