PHPackages                             convochatsms/laravel-sms-whatsapp-gateway - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. convochatsms/laravel-sms-whatsapp-gateway

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

convochatsms/laravel-sms-whatsapp-gateway
=========================================

Laravel package for ConvoChat SMS and WhatsApp gateway integration

v4.0.1(2mo ago)0536[2 PRs](https://github.com/RenatoAscencio/convochatsms/pulls)MITPHPPHP ^8.1|^8.2|^8.3|^8.4CI passing

Since Sep 14Pushed 2mo agoCompare

[ Source](https://github.com/RenatoAscencio/convochatsms)[ Packagist](https://packagist.org/packages/convochatsms/laravel-sms-whatsapp-gateway)[ Docs](https://github.com/RenatoAscencio/convochatsms)[ RSS](/packages/convochatsms-laravel-sms-whatsapp-gateway/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (9)Versions (15)Used By (0)

ConvoChat Laravel SMS Gateway
=============================

[](#convochat-laravel-sms-gateway)

[![Latest Version](https://camo.githubusercontent.com/d4a3cf34e47658ab05c461bc996109cea33f764b6d2ae8c11319b61dee9916b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6e766f63686174736d732f6c61726176656c2d736d732d77686174736170702d676174657761792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/convochatsms/laravel-sms-whatsapp-gateway)[![Total Downloads](https://camo.githubusercontent.com/33b6e7c3225b9fe96d54f03a6d646693b461334aca6ed61548a728ac5dd14042/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6e766f63686174736d732f6c61726176656c2d736d732d77686174736170702d676174657761792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/convochatsms/laravel-sms-whatsapp-gateway)[![License](https://camo.githubusercontent.com/a398711a0cafb1a2ebadb872793c6409eaf3cee6cba03f7627d3c15670a5cd05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f6e766f63686174736d732f6c61726176656c2d736d732d77686174736170702d676174657761792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/convochatsms/laravel-sms-whatsapp-gateway)[![Tests](https://github.com/RenatoAscencio/convochatsms/actions/workflows/tests.yml/badge.svg)](https://github.com/RenatoAscencio/convochatsms/actions/workflows/tests.yml)[![Coverage](https://camo.githubusercontent.com/7c03870c0b47e2a4c8ae29782131e97d62a7107fad34506f207b13fd4d40d77b/68747470733a2f2f636f6465636f762e696f2f67682f52656e61746f417363656e63696f2f636f6e766f63686174736d732f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/RenatoAscencio/convochatsms)[![PHPStan Level 8](https://camo.githubusercontent.com/fff00cebb924e124a7335e6bd8ca8f8cf38869463c1654eff45d0939f1f21c57/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://phpstan.org/)[![PHP Versions](https://camo.githubusercontent.com/237c9e134ab359c3337537374d29204260b2421170789e4f42e847203c5052ca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e31253230253743253230382e32253230253743253230382e33253230253743253230382e342d626c75652e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Laravel Versions](https://camo.githubusercontent.com/09c016367594917410695f99ae7005534e36f8f0e9a165cd87a118d6237dce0a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com/)

Un paquete Laravel moderno y robusto para integración completa con ConvoChat API para envío de SMS y WhatsApp con soporte para múltiples modos, configuración avanzada y monitoreo.

[![Status de Tests](https://github.com/RenatoAscencio/convochatsms/actions/workflows/tests.yml/badge.svg)](https://github.com/RenatoAscencio/convochatsms/actions/workflows/tests.yml)

📋 Tabla de Contenidos
---------------------

[](#-tabla-de-contenidos)

- [Instalación](#instalaci%C3%B3n)
- [Configuración](#configuraci%C3%B3n)
- [Servicios Disponibles](#servicios-disponibles)
- [SMS Service](#sms-service)
- [WhatsApp Service](#whatsapp-service)
- [Contacts Service](#contacts-service)
- [OTP Service](#otp-service)
- [USSD Service](#ussd-service)
- [Ejemplos de Uso](#ejemplos-de-uso)
- [Manejo de Errores](#manejo-de-errores)
- [Logging](#logging)

🚀 Instalación
-------------

[](#-instalación)

```
composer require convochatsms/laravel-sms-whatsapp-gateway
```

⚙️ Configuración
----------------

[](#️-configuración)

### 1. Publicar archivo de configuración

[](#1-publicar-archivo-de-configuración)

```
php artisan vendor:publish --tag=convochat-config
```

### 2. Configurar variables de entorno

[](#2-configurar-variables-de-entorno)

```
CONVOCHAT_API_KEY=tu_api_key_aqui
CONVOCHAT_BASE_URL=https://sms.convo.chat/api
CONVOCHAT_TIMEOUT=30
CONVOCHAT_LOG_REQUESTS=true
```

### 3. Registrar el Service Provider

[](#3-registrar-el-service-provider)

El Service Provider se registra automáticamente en Laravel 5.5+.

🔧 Servicios Disponibles
-----------------------

[](#-servicios-disponibles)

El SDK incluye 5 servicios principales:

- **ConvoChatSmsService** - Gestión completa de SMS
- **ConvoChatWhatsAppService** - Gestión completa de WhatsApp
- **ConvoChatContactsService** - Gestión de contactos y grupos
- **ConvoChatOtpService** - Envío y verificación de códigos OTP
- **ConvoChatUssdService** - Gestión de códigos USSD

📱 SMS Service
-------------

[](#-sms-service)

### Métodos Principales

[](#métodos-principales)

#### `sendSms(array $params)`

[](#sendsmsarray-params)

Envía un SMS individual.

**Parámetros requeridos:**

- `phone` (string) - Número de teléfono destino (formato E.164 o local)
- `message` (string) - Texto del mensaje
- `mode` (string) - Modo de envío: "devices" o "credits"

**Parámetros opcionales:**

- `device` (string) - ID del dispositivo (modo devices)
- `gateway` (string|number) - ID del gateway (modo credits)
- `sim` (number) - Slot SIM (solo devices)
- `priority` (number) - Prioridad: 0=alta, 1=normal, 2=baja
- `shortener` (number) - ID del acortador de URL

**Ejemplo:**

```
use ConvoChat\LaravelSmsGateway\Facades\ConvoChat;

// Envío con dispositivos
$result = ConvoChat::sms()->sendSms([
    'phone' => '+522221234567',
    'message' => 'Hola desde ConvoChat!',
    'mode' => 'devices',
    'device' => 'device123',
    'sim' => 1,
    'priority' => 1
]);

// Envío con créditos
$result = ConvoChat::sms()->sendSms([
    'phone' => '+522221234567',
    'message' => 'Hola desde ConvoChat!',
    'mode' => 'credits',
    'gateway' => 'gateway456',
    'priority' => 0
]);
```

#### `sendSmsWithDevice(string $phone, string $message, string $deviceId, array $options = [])`

[](#sendsmswithdevicestring-phone-string-message-string-deviceid-array-options--)

Método helper para envío con dispositivos.

**Ejemplo:**

```
$result = ConvoChat::sms()->sendSmsWithDevice(
    '+522221234567',
    'Mensaje de prueba',
    'device123',
    ['sim' => 1, 'priority' => 1]
);
```

#### `sendSmsWithCredits(string $phone, string $message, ?string $gatewayId = null, array $options = [])`

[](#sendsmswithcreditsstring-phone-string-message-string-gatewayid--null-array-options--)

Método helper para envío con créditos.

**Ejemplo:**

```
$result = ConvoChat::sms()->sendSmsWithCredits(
    '+522221234567',
    'Mensaje de prueba',
    'gateway456',
    ['priority' => 0]
);
```

#### `sendBulkSms(array $recipients, string $message, array $options = [])`

[](#sendbulksmsarray-recipients-string-message-array-options--)

Envía SMS masivo a múltiples destinatarios.

**Ejemplo:**

```
$result = ConvoChat::sms()->sendBulkSms(
    ['+522221234567', '+522229876543', '+522225556667'],
    'Mensaje masivo',
    ['mode' => 'credits', 'gateway' => 'gateway456']
);
```

### Métodos de Consulta

[](#métodos-de-consulta)

#### `getSmsPending(array $filters = [])`

[](#getsmspendingarray-filters--)

Obtiene mensajes SMS pendientes.

**Parámetros opcionales:**

- `limit` (number) - Límite de resultados (default: 10)
- `page` (number) - Número de página (default: 1)

**Ejemplo:**

```
$pending = ConvoChat::sms()->getSmsPending(['limit' => 20, 'page' => 1]);
```

#### `getSmsReceived(array $filters = [])`

[](#getsmsreceivedarray-filters--)

Obtiene mensajes SMS recibidos.

**Ejemplo:**

```
$received = ConvoChat::sms()->getSmsReceived(['limit' => 50]);
```

#### `getSmsSent(array $filters = [])`

[](#getsmssentarray-filters--)

Obtiene mensajes SMS enviados.

**Ejemplo:**

```
$sent = ConvoChat::sms()->getSmsSent(['limit' => 100]);
```

#### `getSmsMessage(int $messageId, string $type)`

[](#getsmsmessageint-messageid-string-type)

Obtiene un mensaje SMS específico.

**Parámetros:**

- `messageId` (int) - ID del mensaje
- `type` (string) - Tipo: "sent" o "received"

**Ejemplo:**

```
$message = ConvoChat::sms()->getSmsMessage(123, 'sent');
```

#### `getSmsCampaigns(array $filters = [])`

[](#getsmscampaignsarray-filters--)

Obtiene todas las campañas SMS.

**Ejemplo:**

```
$campaigns = ConvoChat::sms()->getSmsCampaigns(['limit' => 25]);
```

### Métodos de Gestión de Campañas

[](#métodos-de-gestión-de-campañas)

#### `startSmsCampaign(int $campaignId)`

[](#startsmscampaignint-campaignid)

Inicia una campaña SMS existente.

**Ejemplo:**

```
$result = ConvoChat::sms()->startSmsCampaign(123);
```

#### `stopSmsCampaign(int $campaignId)`

[](#stopsmscampaignint-campaignid)

Detiene una campaña SMS activa.

**Ejemplo:**

```
$result = ConvoChat::sms()->stopSmsCampaign(123);
```

### Métodos de Eliminación

[](#métodos-de-eliminación)

#### `deleteSmsReceived(int $messageId)`

[](#deletesmsreceivedint-messageid)

Elimina un SMS recibido.

**Ejemplo:**

```
$result = ConvoChat::sms()->deleteSmsReceived(123);
```

#### `deleteSmsSent(int $messageId)`

[](#deletesmssentint-messageid)

Elimina un SMS enviado.

**Ejemplo:**

```
$result = ConvoChat::sms()->deleteSmsSent(123);
```

#### `deleteSmsCampaign(int $campaignId)`

[](#deletesmscampaignint-campaignid)

Elimina una campaña SMS.

**Ejemplo:**

```
$result = ConvoChat::sms()->deleteSmsCampaign(123);
```

### Métodos de Información

[](#métodos-de-información)

#### `getDevices()`

[](#getdevices)

Obtiene la lista de dispositivos disponibles.

**Ejemplo:**

```
$devices = ConvoChat::sms()->getDevices();
```

#### `getCredits()`

[](#getcredits)

Obtiene los créditos restantes.

**Ejemplo:**

```
$credits = ConvoChat::sms()->getCredits();
```

#### `getRates()`

[](#getrates)

Obtiene las tarifas de los gateways.

**Ejemplo:**

```
$rates = ConvoChat::sms()->getRates();
```

#### `getSubscription()`

[](#getsubscription)

Obtiene el paquete de suscripción actual.

**Ejemplo:**

```
$subscription = ConvoChat::sms()->getSubscription();
```

💬 WhatsApp Service
------------------

[](#-whatsapp-service)

### Métodos Principales

[](#métodos-principales-1)

#### `sendMessage(array $params)`

[](#sendmessagearray-params)

Envía un mensaje de WhatsApp.

**Parámetros requeridos:**

- `account` (string) - ID único de la cuenta de WhatsApp
- `recipient` (string) - Número o grupo destino
- `type` (string) - Tipo de mensaje: "text", "media", "document"
- `message` (string) - Contenido del mensaje

**Parámetros opcionales:**

- `priority` (number) - Prioridad: 1=alta, 2=normal
- `media_file` (string) - Archivo multimedia (binary)
- `media_url` (string) - URL del archivo multimedia
- `media_type` (string) - Tipo de media: "image", "audio", "video"
- `document_file` (string) - Archivo de documento (binary)
- `document_url` (string) - URL del documento
- `document_name` (string) - Nombre del documento
- `document_type` (string) - Tipo: "pdf", "txt", "xls", "xlsx", "doc", "docx"
- `shortener` (number) - ID del shortener

**Ejemplo:**

```
// Mensaje de texto
$result = ConvoChat::whatsapp()->sendMessage([
    'account' => 'account123',
    'recipient' => '+522221234567',
    'type' => 'text',
    'message' => 'Hola desde WhatsApp!',
    'priority' => 2
]);

// Mensaje con media
$result = ConvoChat::whatsapp()->sendMessage([
    'account' => 'account123',
    'recipient' => '+522221234567',
    'type' => 'media',
    'message' => 'Mira esta imagen',
    'media_url' => 'https://example.com/image.jpg',
    'media_type' => 'image',
    'priority' => 1
]);

// Mensaje con documento
$result = ConvoChat::whatsapp()->sendMessage([
    'account' => 'account123',
    'recipient' => '+522221234567',
    'type' => 'document',
    'message' => 'Aquí está el documento',
    'document_url' => 'https://example.com/document.pdf',
    'document_name' => 'documento.pdf',
    'document_type' => 'pdf'
]);
```

#### `sendText(string $account, string $recipient, string $message, int $priority = 2)`

[](#sendtextstring-account-string-recipient-string-message-int-priority--2)

Método helper para enviar mensajes de texto.

**Ejemplo:**

```
$result = ConvoChat::whatsapp()->sendText(
    'account123',
    '+522221234567',
    'Mensaje de texto simple',
    1
);
```

#### `sendMedia(string $account, string $recipient, string $message, string $mediaUrl, string $mediaType = 'image', int $priority = 2)`

[](#sendmediastring-account-string-recipient-string-message-string-mediaurl-string-mediatype--image-int-priority--2)

Método helper para enviar mensajes con multimedia.

**Ejemplo:**

```
$result = ConvoChat::whatsapp()->sendMedia(
    'account123',
    '+522221234567',
    'Mira esta imagen',
    'https://example.com/image.jpg',
    'image',
    1
);
```

#### `sendDocument(string $account, string $recipient, string $message, string $documentUrl, string $documentName, string $documentType = 'pdf', int $priority = 2)`

[](#senddocumentstring-account-string-recipient-string-message-string-documenturl-string-documentname-string-documenttype--pdf-int-priority--2)

Método helper para enviar documentos.

**Ejemplo:**

```
$result = ConvoChat::whatsapp()->sendDocument(
    'account123',
    '+522221234567',
    'Aquí está el documento',
    'https://example.com/document.pdf',
    'documento.pdf',
    'pdf',
    1
);
```

#### `sendBulkWhatsApp(array $recipients, string $message, array $options = [])`

[](#sendbulkwhatsapparray-recipients-string-message-array-options--)

Envía WhatsApp masivo a múltiples destinatarios.

**Ejemplo:**

```
$result = ConvoChat::whatsapp()->sendBulkWhatsApp(
    ['+522221234567', '+522229876543', '+522225556667'],
    'Mensaje masivo de WhatsApp',
    ['account' => 'account123', 'type' => 'text']
);
```

### Métodos de Consulta

[](#métodos-de-consulta-1)

#### `getWhatsAppPending(array $filters = [])`

[](#getwhatsapppendingarray-filters--)

Obtiene mensajes WhatsApp pendientes.

**Ejemplo:**

```
$pending = ConvoChat::whatsapp()->getWhatsAppPending(['limit' => 20]);
```

#### `getWhatsAppReceived(array $filters = [])`

[](#getwhatsappreceivedarray-filters--)

Obtiene mensajes WhatsApp recibidos.

**Ejemplo:**

```
$received = ConvoChat::whatsapp()->getWhatsAppReceived(['limit' => 50]);
```

#### `getWhatsAppSent(array $filters = [])`

[](#getwhatsappsentarray-filters--)

Obtiene mensajes WhatsApp enviados.

**Ejemplo:**

```
$sent = ConvoChat::whatsapp()->getWhatsAppSent(['limit' => 100]);
```

#### `getWhatsAppMessage(int $messageId, string $type)`

[](#getwhatsappmessageint-messageid-string-type)

Obtiene un mensaje WhatsApp específico.

**Ejemplo:**

```
$message = ConvoChat::whatsapp()->getWhatsAppMessage(123, 'sent');
```

#### `getWhatsAppCampaigns(array $filters = [])`

[](#getwhatsappcampaignsarray-filters--)

Obtiene todas las campañas WhatsApp.

**Ejemplo:**

```
$campaigns = ConvoChat::whatsapp()->getWhatsAppCampaigns(['limit' => 25]);
```

#### `getWhatsAppGroups(array $filters = [])`

[](#getwhatsappgroupsarray-filters--)

Obtiene los grupos de WhatsApp.

**Ejemplo:**

```
$groups = ConvoChat::whatsapp()->getWhatsAppGroups(['limit' => 10]);
```

#### `getWhatsAppGroupContacts(string $groupId, array $filters = [])`

[](#getwhatsappgroupcontactsstring-groupid-array-filters--)

Obtiene los contactos de un grupo específico.

**Ejemplo:**

```
$contacts = ConvoChat::whatsapp()->getWhatsAppGroupContacts('group123', ['limit' => 50]);
```

### Métodos de Gestión de Cuentas

[](#métodos-de-gestión-de-cuentas)

#### `getWhatsAppServers()`

[](#getwhatsappservers)

Obtiene los servidores WhatsApp disponibles.

**Ejemplo:**

```
$servers = ConvoChat::whatsapp()->getWhatsAppServers();
```

#### `getWhatsAppAccounts()`

[](#getwhatsappaccounts)

Obtiene las cuentas WhatsApp vinculadas.

**Ejemplo:**

```
$accounts = ConvoChat::whatsapp()->getWhatsAppAccounts();
```

#### `getWhatsAppInfo(string $accountId)`

[](#getwhatsappinfostring-accountid)

Obtiene información de una cuenta específica.

**Ejemplo:**

```
$info = ConvoChat::whatsapp()->getWhatsAppInfo('account123');
```

#### `getWhatsAppQr(string $accountId)`

[](#getwhatsappqrstring-accountid)

Obtiene el código QR para vincular una cuenta.

**Ejemplo:**

```
$qr = ConvoChat::whatsapp()->getWhatsAppQr('account123');
```

#### `validateWhatsAppNumber(string $accountId, string $phone)`

[](#validatewhatsappnumberstring-accountid-string-phone)

Valida si un número existe en WhatsApp.

**Ejemplo:**

```
$validation = ConvoChat::whatsapp()->validateWhatsAppNumber('account123', '+522221234567');
```

### Métodos de Gestión de Campañas

[](#métodos-de-gestión-de-campañas-1)

#### `startWhatsAppCampaign(int $campaignId)`

[](#startwhatsappcampaignint-campaignid)

Inicia una campaña WhatsApp existente.

**Ejemplo:**

```
$result = ConvoChat::whatsapp()->startWhatsAppCampaign(123);
```

#### `stopWhatsAppCampaign(int $campaignId)`

[](#stopwhatsappcampaignint-campaignid)

Detiene una campaña WhatsApp activa.

**Ejemplo:**

```
$result = ConvoChat::whatsapp()->stopWhatsAppCampaign(123);
```

👥 Contacts Service
------------------

[](#-contacts-service)

### Métodos de Contactos

[](#métodos-de-contactos)

#### `getContacts(array $filters = [])`

[](#getcontactsarray-filters--)

Obtiene la lista de contactos guardados.

**Parámetros opcionales:**

- `limit` (number) - Límite de resultados (default: 10)
- `page` (number) - Número de página (default: 1)

**Ejemplo:**

```
$contacts = ConvoChat::contacts()->getContacts(['limit' => 20, 'page' => 1]);
```

#### `createContact(array $params)`

[](#createcontactarray-params)

Crea un nuevo contacto.

**Parámetros requeridos:**

- `phone` (string) - Número móvil del destinatario
- `name` (string) - Nombre del contacto
- `groups` (string) - Lista de IDs de grupos separados por comas

**Ejemplo:**

```
$result = ConvoChat::contacts()->createContact([
    'phone' => '+522221234567',
    'name' => 'Juan Pérez',
    'groups' => '1,2,3'
]);
```

#### `deleteContact(int $contactId)`

[](#deletecontactint-contactid)

Elimina un contacto existente.

**Ejemplo:**

```
$result = ConvoChat::contacts()->deleteContact(123);
```

### Métodos de Grupos

[](#métodos-de-grupos)

#### `getGroups(array $filters = [])`

[](#getgroupsarray-filters--)

Obtiene los grupos de contactos existentes.

**Parámetros opcionales:**

- `limit` (number) - Límite de resultados (default: 10)
- `page` (number) - Número de página (default: 1)

**Ejemplo:**

```
$groups = ConvoChat::contacts()->getGroups(['limit' => 15]);
```

#### `createGroup(array $params)`

[](#creategrouparray-params)

Crea un nuevo grupo de contactos.

**Parámetros requeridos:**

- `name` (string) - Nombre del grupo

**Ejemplo:**

```
$result = ConvoChat::contacts()->createGroup([
    'name' => 'Clientes VIP'
]);
```

#### `deleteGroup(int $groupId)`

[](#deletegroupint-groupid)

Elimina un grupo de contactos.

**Ejemplo:**

```
$result = ConvoChat::contacts()->deleteGroup(123);
```

### Métodos de Gestión de Bajas

[](#métodos-de-gestión-de-bajas)

#### `getUnsubscribed(array $filters = [])`

[](#getunsubscribedarray-filters--)

Obtiene los contactos que se dieron de baja.

**Parámetros opcionales:**

- `limit` (number) - Límite de resultados (default: 10)
- `page` (number) - Número de página (default: 1)

**Ejemplo:**

```
$unsubscribed = ConvoChat::contacts()->getUnsubscribed(['limit' => 25]);
```

#### `deleteUnsubscribed(int $contactId)`

[](#deleteunsubscribedint-contactid)

Elimina un contacto dado de baja.

**Ejemplo:**

```
$result = ConvoChat::contacts()->deleteUnsubscribed(123);
```

🔐 OTP Service
-------------

[](#-otp-service)

### Métodos Principales

[](#métodos-principales-2)

#### `sendOtp(array $params)`

[](#sendotparray-params)

Envía una contraseña de un solo uso (OTP).

**Parámetros requeridos:**

- `type` (string) - Tipo: "sms" o "whatsapp"
- `message` (string) - Mensaje con {{otp}} para incluir el código
- `phone` (string) - Número del destinatario

**Parámetros opcionales:**

- `expire` (number) - Expiración en segundos (default: 300)
- `priority` (number) - Prioridad: 1=alta, 2=normal (default: 2)
- `account` (string) - Solo para WhatsApp
- `mode` (string) - "devices" o "credits"
- `device` (string) - ID de dispositivo (modo devices)
- `gateway` (string|number) - ID del gateway (modo credits)
- `sim` (number) - SIM slot (solo devices)

**Ejemplo:**

```
// OTP por SMS
$result = ConvoChat::otp()->sendOtp([
    'type' => 'sms',
    'message' => 'Tu código de verificación es {{otp}}',
    'phone' => '+522221234567',
    'expire' => 300,
    'priority' => 1,
    'mode' => 'credits',
    'gateway' => 'gateway456'
]);

// OTP por WhatsApp
$result = ConvoChat::otp()->sendOtp([
    'type' => 'whatsapp',
    'message' => 'Tu código de verificación es {{otp}}',
    'phone' => '+522221234567',
    'account' => 'account123',
    'expire' => 600,
    'priority' => 1
]);
```

#### `verifyOtp(string $otp)`

[](#verifyotpstring-otp)

Verifica un OTP enviado.

**Ejemplo:**

```
$result = ConvoChat::otp()->verifyOtp('123456');
```

📡 USSD Service
--------------

[](#-ussd-service)

### Métodos Principales

[](#métodos-principales-3)

#### `sendUssd(string $code, int $sim, string $device)`

[](#sendussdstring-code-int-sim-string-device)

Envía un código USSD.

**Parámetros requeridos:**

- `code` (string) - Código USSD a enviar (ej: "\*123#")
- `sim` (int) - Slot SIM (1 o 2)
- `device` (string) - ID del dispositivo

**Ejemplo:**

```
$result = ConvoChat::ussd()->sendUssd('*123#', 1, 'device123');
```

#### `getUssdRequests(array $filters = [])`

[](#getussdrequestsarray-filters--)

Obtiene las solicitudes USSD.

**Parámetros opcionales:**

- `limit` (int) - Límite de resultados
- `page` (int) - Página actual
- `status` (string) - Estado de la solicitud

**Ejemplo:**

```
$requests = ConvoChat::ussd()->getUssdRequests(['limit' => 10]);
```

#### `deleteUssdRequest(int $requestId)`

[](#deleteussdrequestint-requestid)

Elimina una solicitud USSD.

**Ejemplo:**

```
$result = ConvoChat::ussd()->deleteUssdRequest(123);
```

📚 Ejemplos de Uso
-----------------

[](#-ejemplos-de-uso)

### Ejemplo Completo de SMS

[](#ejemplo-completo-de-sms)

```
