> ## Documentation Index
> Fetch the complete documentation index at: https://www.vobiz.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio to Vobiz: Code Snippets for Common Tasks

> Side-by-side Twilio and Vobiz code for common voice tasks - make an outbound call, answer with XML, control a live call, search a number, validate webhooks.

Refactoring a Twilio app to Vobiz is mostly a tab-swap: same call flow, a few renamed methods, and an explicit `auth_id`. Each task below shows the **Twilio** code and the equivalent **Vobiz** code in Python and Node - copy the Vobiz tab.

> [!NOTE]
>
> Set your credentials once: `AUTH_ID` is your Vobiz Auth ID (`MA_…`), `AUTH_TOKEN` is your Auth Token. In the Vobiz SDK, `api_key` **is** the Auth ID, and every account-scoped method takes that `auth_id` explicitly.

## At a glance

The short version of every task on this page. Each row links to its section - on this page or one of the task pages below - which has the full Twilio and Vobiz code in Python and Node.

| Task | Twilio | Vobiz |
| - | - | - |
| [Set up the client](#set-up-the-client) | `Client(ACCOUNT_SID, AUTH_TOKEN)` | `Vobiz(api_key=AUTH_ID, auth_token=AUTH_TOKEN)` |
| [Make an outbound call](#make-an-outbound-call) | `calls.create(url=…)` | `calls.make_call(auth_id=…, answer_url=…)` |
| [Answer with XML](https://www.vobiz.ai/docs/compare/twilio/code-snippets/answer-calls.md#answer-a-call-with-xml-tts-+-menu) | `VoiceResponse()` | `ResponseElement()` |
| [Control a live call](https://www.vobiz.ai/docs/compare/twilio/code-snippets/live-calls.md#control-a-live-call) | `calls(sid).update(...)` | One resource per action, keyed by `(auth_id, call_uuid)` |
| [Look up a live call](https://www.vobiz.ai/docs/compare/twilio/code-snippets/live-calls.md#look-up-a-live-call) | `calls(sid).fetch()` | `live_calls.get_live_call(..., status='live')` |
| [Search and buy a number](https://www.vobiz.ai/docs/compare/twilio/code-snippets/numbers-and-conferences.md#search-and-buy-a-phone-number) | `available_phone_numbers(...)` + `incoming_phone_numbers.create(...)` | `list_inventory_numbers(...)` + `purchase_from_inventory(...)` |
| [Manage a conference](https://www.vobiz.ai/docs/compare/twilio/code-snippets/numbers-and-conferences.md#manage-a-conference) | `CF…` room SID and per-leg `CallSid` | Room name and per-participant `member_id` |
| [List call records](https://www.vobiz.ai/docs/compare/twilio/code-snippets/call-records-webhooks-errors.md#list-call-records) | `calls.list(status="completed")` | `cdr.list_cdrs(...)` |
| [Validate a webhook](https://www.vobiz.ai/docs/compare/twilio/code-snippets/call-records-webhooks-errors.md#validate-a-webhook-signature) | `X-Twilio-Signature` (HMAC-SHA1) | `X-Vobiz-Signature-V3` (HMAC-SHA256) |
| [Handle errors](https://www.vobiz.ai/docs/compare/twilio/code-snippets/call-records-webhooks-errors.md#handle-errors) | `TwilioRestException` | `ApiError` and its subclasses |

## Set up the client

Create one client with your credentials, then reuse it for every task below. Vobiz uses your Auth ID where Twilio uses the Account SID.

| | Twilio | Vobiz |
| - | - | - |
| Python import | `from twilio.rest import Client` | `from vobiz import Vobiz` |
| Python client | `Client(ACCOUNT_SID, AUTH_TOKEN)` | `Vobiz(api_key=AUTH_ID, auth_token=AUTH_TOKEN)` |
| Node import | `require('twilio')` | `import { VobizClient } from '@vobiz/sdk'` |
| Node client | `twilio(ACCOUNT_SID, AUTH_TOKEN)` | `new VobizClient({ apiKey: AUTH_ID, authToken: AUTH_TOKEN })` |

```python Twilio · Python theme={null}
from twilio.rest import Client

client = Client(ACCOUNT_SID, AUTH_TOKEN)
```

```python Vobiz · Python theme={null}
from vobiz import Vobiz

client = Vobiz(api_key=AUTH_ID, auth_token=AUTH_TOKEN)
```

```javascript Twilio · Node theme={null}
const twilio = require('twilio');

const client = twilio(ACCOUNT_SID, AUTH_TOKEN);
```

```javascript Vobiz · Node theme={null}
import { VobizClient } from '@vobiz/sdk';

const client = new VobizClient({ apiKey: AUTH_ID, authToken: AUTH_TOKEN });
```

## Make an outbound call

The classic "change a few lines" migration: `calls.create` → `calls.make_call`, add `auth_id`, and `url`/`method` → `answer_url`/`answer_method`.

| Change | Twilio | Vobiz |
| - | - | - |
| Python method | `calls.create` | `calls.make_call` |
| Node method | `calls.create` | `calls.makeCall` |
| Account | Set on the client | `auth_id` on the call |
| Answer URL | `url` | `answer_url` |
| Answer method | `method` | `answer_method` |
| Numbers | `to`, `from_` (Python) / `from` (Node) | `to`, `from_` (Python) / `from` (Node) |

```python Twilio · Python theme={null}
call = client.calls.create(
    to='+919876543210',
    from_='+14155551234',
    url='https://example.com/answer.xml',
    method='POST',
)
print(call.sid)
```

```python Vobiz · Python theme={null}
res = client.calls.make_call(
    auth_id=AUTH_ID,
    from_='+14155551234',
    to='+919876543210',
    answer_url='https://example.com/answer.xml',
    answer_method='POST',
)
```

```javascript Twilio · Node theme={null}
const call = await client.calls.create({
  to: '+919876543210',
  from: '+14155551234',
  url: 'https://example.com/answer.xml',
  method: 'POST',
});
console.log(call.sid);
```

```javascript Vobiz · Node theme={null}
await client.calls.makeCall({
  auth_id: AUTH_ID,
  from: '+14155551234',
  to: '+919876543210',
  answer_url: 'https://example.com/answer.xml',
  answer_method: 'POST',
});
```

## More tasks

The remaining tasks each have their own page, with the full Twilio and Vobiz code in Python and Node:

> [card] [Answer calls with XML](https://www.vobiz.ai/docs/compare/twilio/code-snippets/answer-calls.md)
>
> Answer a call with XML (TTS + menu), Serve the answer URL (Flask / FastAPI / Express).

> [card] [Live calls](https://www.vobiz.ai/docs/compare/twilio/code-snippets/live-calls.md)
>
> Control a live call, Look up a live call.

> [card] [Numbers and conferences](https://www.vobiz.ai/docs/compare/twilio/code-snippets/numbers-and-conferences.md)
>
> Search and buy a phone number, Manage a conference.

> [card] [Call records, webhooks and errors](https://www.vobiz.ai/docs/compare/twilio/code-snippets/call-records-webhooks-errors.md)
>
> List call records, Validate a webhook signature, Handle errors.

> [!TIP]
>
> Need a method that isn't here? The full per-resource map is in [Voice Call API](https://www.vobiz.ai/docs/compare/twilio/voice-call-api.md), [TwiML → VobizXML](https://www.vobiz.ai/docs/compare/twilio/twiml-to-vobizxml.md), and the rest of the [Twilio migration](https://www.vobiz.ai/docs/compare/twilio/overview.md) section.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.