> ## 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.

# Vobiz Messaging in the SDKs: SMS, MMS and RCS

> Use the Vobiz SDKs for Node.js, Python, Go, Java, Ruby, C# and PHP to send SMS, MMS and RCS, buy numbers, register for 10DLC, run broadcasts and manage webhooks. Every Messaging API operation is on client.sms.

Every official Vobiz SDK includes the full Messaging API under `client.sms`. The same client you use for voice sends SMS, MMS and RCS, so there is nothing extra to install or configure.

> [card] [Node.js](https://www.vobiz.ai/docs/integrations/node-sdk.md)
>
> Install and set up

> [card] [Python](https://www.vobiz.ai/docs/integrations/python-sdk.md)
>
> Install and set up

> [card] [Go](https://www.vobiz.ai/docs/integrations/go-sdk.md)
>
> Install and set up

> [card] [Java](https://www.vobiz.ai/docs/integrations/java-sdk.md)
>
> Install and set up

> [card] [Ruby](https://www.vobiz.ai/docs/integrations/ruby-sdk.md)
>
> Install and set up

> [card] [C#](https://www.vobiz.ai/docs/integrations/csharp-sdk.md)
>
> Install and set up

> [card] [PHP](https://www.vobiz.ai/docs/integrations/php-sdk.md)
>
> Install and set up

## How the SDKs map to the API

* **One namespace.** Messaging lives under `client.sms`, grouped by resource: `messages`, `numbers`, `coverage`, `conversations`, `optOuts`, `webhooks`, `broadcasts`, `rcsSenders`, `brands` and `campaigns` (snake\_case or PascalCase in languages that use it).
* **One method per endpoint.** Each method is named after the operation, for example `sendMessage` / `send_message` for [Send a message](https://www.vobiz.ai/docs/sms/api/messages/send-message.md). The full list is in the [method reference](#method-reference) below.
* **Same credentials.** The client sends your Auth ID and Auth Token as `X-Auth-ID` and `X-Auth-Token` on every request.
* **Phone numbers in paths.** Pass E.164 numbers such as `+14155550123` as-is. The SDKs URL-encode them for you.
* **Typed responses.** Responses are returned as typed objects, so field names follow each language's conventions (`idempotencyKey` in JSON is `idempotency_key` in Python and Ruby).

## Send a message

```javascript Node.js theme={null}
import { VobizClient } from "@vobiz/sdk";

const client = new VobizClient({ apiKey: "MA_XXXXXXXX", authToken: "YOUR_AUTH_TOKEN" });

await client.sms.messages.sendMessage({
    from: "+14155550100",
    to: ["+14155550123"],
    channel: "sms",
    text: "Your verification code is 482913",
    idempotencyKey: "otp-482913-user-77"
})
```

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

client = Vobiz(api_key="MA_XXXXXXXX", auth_token="YOUR_AUTH_TOKEN")

client.sms.messages.send_message(
    from_="+14155550100",
    to=[
        "+14155550123"
    ],
    channel="sms",
    text="Your verification code is 482913",
    idempotency_key="otp-482913-user-77",
)
```

```go Go theme={null}
import (
    "context"

    vobiz "github.com/vobiz-ai/Vobiz-Go-SDK"
    "github.com/vobiz-ai/Vobiz-Go-SDK/client"
    "github.com/vobiz-ai/Vobiz-Go-SDK/option"
    "github.com/vobiz-ai/Vobiz-Go-SDK/sms"
)

c := client.NewClient(
    option.WithAPIKey("MA_XXXXXXXX"),
    option.WithAuthToken("YOUR_AUTH_TOKEN"),
)

request := &sms.SendMessageRequest{
        From: "+14155550100",
        To: []string{
            "+14155550123",
        },
        Channel: sms.SendMessageRequestChannelSms.Ptr(),
        Text: vobiz.String(
            "Your verification code is 482913",
        ),
        IdempotencyKey: vobiz.String(
            "otp-482913-user-77",
        ),
    }
c.Sms.Messages.SendMessage(
        context.TODO(),
        request,
    )
```

```java Java theme={null}
import com.vobiz.api.VobizApiClient;

VobizApiClient client = VobizApiClient
    .builder()
    .apiKey("MA_XXXXXXXX")
    .authToken("YOUR_AUTH_TOKEN")
    .build();

client.sms().messages().sendMessage(
    SendMessageRequest
        .builder()
        .from("+14155550100")
        .channel(SendMessageRequestChannel.SMS)
        .to(
            Arrays.asList("+14155550123")
        )
        .text("Your verification code is 482913")
        .idempotencyKey("otp-482913-user-77")
        .build()
);
```

```ruby Ruby theme={null}
require 'vobiz'

client = Vobiz::Client.new(api_key: 'MA_XXXXXXXX', auth_token: 'YOUR_AUTH_TOKEN')

client.sms.messages.send_message(
  from: "+14155550100",
  to: ["+14155550123"],
  channel: "sms",
  text: "Your verification code is 482913",
  idempotency_key: "otp-482913-user-77"
)
```

```csharp C# theme={null}
using Vobiz;
using Vobiz.Sms;

var client = new VobizApiClient("YOUR_AUTH_TOKEN", "MA_XXXXXXXX");

await client.Sms.Messages.SendMessageAsync(
    new SendMessageRequest
    {
        From = "+14155550100",
        To = new List<string>() { "+14155550123" },
        Channel = SendMessageRequestChannel.Sms,
        Text = "Your verification code is 482913",
        IdempotencyKey = "otp-482913-user-77",
    }
);
```

```php PHP theme={null}
<?php

require 'vendor/autoload.php';

use Vobiz\VobizClient;

$client = new VobizClient(apiKey: 'MA_XXXXXXXX', authToken: 'YOUR_AUTH_TOKEN');

$client->sms->messages->sendMessage(
    new SendMessageRequest([
        'from' => '+14155550100',
        'to' => [
            '+14155550123',
        ],
        'channel' => SendMessageRequestChannel::Sms->value,
        'text' => 'Your verification code is 482913',
        'idempotencyKey' => 'otp-482913-user-77',
    ]),
);
```

> [!WARNING]
>
> Sending, buying numbers and launching broadcasts move money and reach real people. Run these calls with your own credentials and numbers.

## Handle errors

Every non-2xx response raises a typed error named after its status, carrying the status code and the API's `{"error": "..."}` body. The Messaging errors are `BadRequestError` (400), `UnauthorizedError` (401), `PaymentRequiredError` (402), `NotFoundError` (404), `ConflictError` (409), `ContentTooLargeError` (413), `UnprocessableEntityError` (422), `InternalServerError` (500), `BadGatewayError` (502) and `ServiceUnavailableError` (503). See [Errors](https://www.vobiz.ai/docs/sms/errors.md) for when each one is returned.

```javascript Node.js theme={null}
import { Vobiz, VobizError } from "@vobiz/sdk";

try {
  await client.sms.messages.sendMessage({
    from: "+14155550100",
    to: ["+14155550123"],
    channel: "sms",
    text: "Your verification code is 482913",
    idempotencyKey: "otp-482913-user-77",
  });
} catch (err) {
  if (err instanceof Vobiz.sms.UnprocessableEntityError) {
    // The recipient has opted out. Remove them from your list.
  } else if (err instanceof VobizError) {
    console.error(err.statusCode, err.body); // { error: "..." }
  } else {
    throw err;
  }
}
```

```python Python theme={null}
from vobiz.core.api_error import ApiError
from vobiz.sms.errors import UnprocessableEntityError

try:
    client.sms.messages.send_message(
        from_="+14155550100",
        to=["+14155550123"],
        channel="sms",
        text="Your verification code is 482913",
        idempotency_key="otp-482913-user-77",
    )
except UnprocessableEntityError:
    pass  # The recipient has opted out. Remove them from your list.
except ApiError as err:
    print(err.status_code, err.body)  # {'error': '...'}
```

> [!TIP]
>
> A `502` on send means nothing was recorded. Retry with the same `idempotencyKey`; a key that already sent returns the original message instead of sending twice.

## Method reference

Every Messaging API operation has one method in each SDK. Each language has its own method reference page that lists every operation and the method that calls it, and each operation links to its API reference page, which shows a complete example in every language.

> [card] [Node.js](https://www.vobiz.ai/docs/sms/sdks/node.md)
>
> Node.js method reference

> [card] [Python](https://www.vobiz.ai/docs/sms/sdks/python.md)
>
> Python method reference

> [card] [Go](https://www.vobiz.ai/docs/sms/sdks/go.md)
>
> Go method reference

> [card] [Java](https://www.vobiz.ai/docs/sms/sdks/java.md)
>
> Java method reference

> [card] [Ruby](https://www.vobiz.ai/docs/sms/sdks/ruby.md)
>
> Ruby method reference

> [card] [C#](https://www.vobiz.ai/docs/sms/sdks/csharp.md)
>
> C# method reference

> [card] [PHP](https://www.vobiz.ai/docs/sms/sdks/php.md)
>
> PHP method reference

## Related

* [Messaging overview](https://www.vobiz.ai/docs/sms/overview.md)
* [Send your first SMS](https://www.vobiz.ai/docs/sms/quickstart.md)
* [Messaging webhooks](https://www.vobiz.ai/docs/sms/webhooks.md)


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