UNPKG

n8n-nodes-tess-ai-by-pareto

Version:

n8n community node for interacting with the Tess API by Pareto

19 lines (15 loc) 527 B
import fetch from 'node-fetch'; export async function tessApiRequest(method: string, endpoint: string, body: any = {}, token: string): Promise<any> { const response = await fetch(`https://api.tess.pareto.io${endpoint}`, { method, headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: method === 'GET' ? undefined : JSON.stringify(body) }); if (!response.ok) { throw new Error(`Tess API error: ${response.statusText}`); } return response.json(); }