Skip to main content

SDKs & Libraries

Movoice AI provides official SDKs for Node.js and Python. The SDKs wrap the REST API with typed methods, automatic retries, and webhook signature verification.

Node.js / TypeScript

Installation

npm install @movoice/sdk

Usage

import { MovoiceClient } from '@movoice/sdk';

const client = new MovoiceClient({
  apiKey: process.env.MOVOICE_API_KEY,
});

// Trigger an outbound call
const call = await client.calls.create({
  agentId: 'agent_12345',
  recipientPhone: '+919876543210',
  variables: {
    name: 'Rahul',
    appointmentTime: 'Tomorrow at 3 PM',
  },
});

console.log(`Call initiated: ${call.callId}`);

List recent calls

const calls = await client.calls.list({
  limit: 20,
  status: 'completed',
});

for (const call of calls.data) {
  console.log(`${call.callId}: ${call.summary}`);
}

Send a batch

const batch = await client.calls.createBatch({
  agentId: 'agent_12345',
  recipients: [
    { phone: '+919876543210', variables: { name: 'Rahul' } },
    { phone: '+919876543211', variables: { name: 'Priya' } },
  ],
  concurrency: 5,
});

console.log(`Batch ${batch.batchId}${batch.totalRecipients} calls queued`);

Verify a webhook

import { verifyWebhookSignature } from '@movoice/sdk';

app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  const isValid = verifyWebhookSignature(
    req.body,
    req.headers['x-movoice-signature'] as string,
    process.env.WEBHOOK_SECRET!
  );

  if (!isValid) return res.status(401).send('Invalid signature');

  const event = JSON.parse(req.body.toString());
  // handle event...
  res.sendStatus(200);
});

Python

Installation

pip install movoice-sdk

Usage

from movoice import MovoiceClient

client = MovoiceClient(api_key=os.environ["MOVOICE_API_KEY"])

# Trigger an outbound call
call = client.calls.create(
    agent_id="agent_12345",
    recipient_phone="+919876543210",
    variables={
        "name": "Rahul",
        "appointment_time": "Tomorrow at 3 PM",
    }
)

print(f"Call initiated: {call.call_id}")

List recent calls

calls = client.calls.list(limit=20, status="completed")

for call in calls.data:
    print(f"{call.call_id}: {call.summary}")

Verify a webhook (Flask)

from movoice import verify_webhook_signature
from flask import Flask, request

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def webhook():
    is_valid = verify_webhook_signature(
        payload=request.data,
        signature=request.headers.get('X-Movoice-Signature'),
        secret=os.environ['WEBHOOK_SECRET']
    )
    if not is_valid:
        return 'Invalid signature', 401

    event = request.json
    # handle event...
    return '', 200

Raw REST API

If you prefer not to use an SDK, you can call the API directly. See the API Reference for full endpoint documentation.
curl -X POST https://api.movoice.ai/v1/call \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agent_id": "agent_12345", "recipient_phone": "+919876543210" }'
The SDKs are currently in beta. If you encounter issues, please file a bug at github.com/Movoiceai/sdk or email support@movoice.ai.