Pular para o conteúdo principal

Official SDK — stevo-sdk

stevo-sdk is the official TypeScript/JavaScript SDK for Stevo. One package with everything the platform offers, cleanly split by area:

AreaAccess viaWhat it does
Account managementstevo.instances, stevo.links, stevo.ghl, stevo.billing, stevo.ghlAgencyinstances, access links, GHL, purchases, GHL Agency
Stevo AI (v2)stevo.aiagents, funnel, provider keys, FAQ, tools, follow-up, RAG, memory
Messagingstevo.smv2(id) · stevo.oficial(id)talk DIRECTLY to the instance server (74 SM v2 operations) or the Meta Cloud API gateway
Bulk campaignsstevo.dispatchWhatsApp campaigns with instance rotation, scheduling and variations
StevoVoicestevo.voiceAI voice calls (scheduled, batch, on-demand)

📦 npm: npm.im/stevo-sdk · Node.js 18+ · ESM + CommonJS + types

Renamed

This package used to be stevo-gestao. Now that it covers everything, it's called stevo-sdk. Switch with npm install stevo-sdk.

No code? Use AI + MCP

The same API ships an MCP server at https://openapi.stevo.chat/mcp. Plug it into n8n, Claude or Cursor with your API key and the AI manages the account, sends messages, creates campaigns and schedules calls without a line of code.

1. Create your API Key

In the Stevo panel: profile menu → API KeysNew API Key. Pick the scopes. The key is shown only once — store it safely and never expose it in a browser/front-end.

2. Install and connect

npm install stevo-sdk
import { Stevo } from 'stevo-sdk';
const stevo = new Stevo('stevo_sk_...');
const instances = await stevo.instances.list();

3. Account management

const inst = await stevo.instances.create({ name: 'my-instance' });
await stevo.instances.restart(id);
await stevo.instances.recreateTotalBatch([id1, id2]); // up to 50
const link = await stevo.links.whiteLabel(id, { permanent: true });
const catalog = await stevo.billing.plans();
if (catalog.has_saved_card) await stevo.billing.purchase({ plan: 'stevo3' });

4. Messaging

Each instance runs on its own server with its own token — the SDK resolves that from the instanceId:

// SM v2 — 74 server operations
const wa = await stevo.smv2(instanceId);
await wa.sendText({ body: { number: '5511999999999', text: 'Hi!' } });

// Official Meta API — Cloud API format + HSM templates
const meta = await stevo.oficial(instanceIdOfficial);
await meta.sendMessage({ to: '5511999999999', type: 'text', text: { body: 'Hi!' } });

5. Bulk campaigns

Pass the instance_ids that will dispatch — server credentials are resolved internally (you never send a token):

const camp = await stevo.dispatch.createCampaign({
instance_ids: [instanceId],
name: 'July Promo',
messages: ['Hi! We have news for you 🎉'],
recipients: [{ phone: '5511999999999', name: 'Mary' }],
config: { minDelay: 5, maxDelay: 15 },
start: true,
});
await stevo.dispatch.pause(camp.campaign_id);

6. StevoVoice — AI voice calls

Requires StevoVoice subscribed on the instance:

await stevo.voice.scheduleCall(instanceId, { to_number: '5511999999999', agent_id: 'agent_xyz' });
await stevo.voice.batchCalls(instanceId, { numbers: ['5511...', '5511...'], agent_id: 'agent_xyz', interval_seconds: 60 });

7. Stevo AI (v2)

await stevo.ai.setProviderKeys(instanceId, { openai: 'sk-...' }); // write-only
const agent = await stevo.ai.agents.create(instanceId, { name: 'Agent', provider: 'openai', model: 'gpt-4o-mini', is_primary: true });
await stevo.ai.stages.create(agent.id, { name: 'Welcome', objective: 'Collect the name' });

8. Error handling

Every failure is a StevoError with the HTTP status and a business code (no_saved_card, insufficient_scope, not_found...). The SDK retries automatically on 429 and server errors, and never exposes secrets.

9. Hand it to your AI

Use the npm package stevo-sdk (TypeScript, types included, Node 18+). Instantiate new Stevo(apiKey) with the stevo_sk_... key from the Stevo panel's API Keys tab. Resources: instances, links, ghl, billing, ghlAgency, ai (management); stevo.smv2(instanceId) and stevo.oficial(instanceId) to SEND messages (the SDK resolves the instance server credentials itself); stevo.dispatch (bulk campaigns via instance_ids) and stevo.voice (AI voice calls). Errors are StevoError with .status and .code. Full reference: https://tutorial.stevo.chat/public-api-reference

References