Call Vexly from JavaScript or Node.js
Use Node when you want to call Vexly from a script, service, or build step.
Example
const baseUrl = process.env.VEXLY_BASE_URL || 'https://api.vexly.io/api/v1/public';
const token = process.env.VEXLY_ACCESS_TOKEN;
const runResp = await fetch(`${baseUrl}/agent/runs`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ prompt: "Review last week's performance across all connected services and return the top 5 changes or risks." })
});
const run = await runResp.json();
const statusResp = await fetch(`${baseUrl}/agent/runs/${run.run_id}`, {
headers: { 'Authorization': `Bearer ${token}` }
});
const status = await statusResp.json();
console.log(status);