althosalud / altha
Typed PHP SDK for the Altha WhatsApp Platform API
v0.1.0
2026-08-01 13:13 UTC
Requires
- php: >=8.2
- ext-curl: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0 || ^12.0
README
Cliente PHP tipado para la Altha WhatsApp Platform API.
Sin dependencias de framework: solo PHP 8.2+ y ext-curl.
- Packagist: althosalud/altha
- Repo: gonzaloalonsod/altha-php
- Changelog: CHANGELOG.md
Instalación
composer require althosalud/altha
Uso
use AlthoSalud\Altha\AlthaClient; $client = new AlthaClient( baseUrl: 'https://altha.althosalud.com', apiKey: 'al_...', ); $me = $client->me(); // $me->slug, $me->products (secretary|directory) $client->sendSecretaryMessage( to: '5491112345678', text: 'Tu turno es mañana a las 10:00', ); $client->sendSecretaryMessage( to: '5491112345678', templateId: 'reminder_v1', templateParams: ['Juan', '10:00'], ); $channel = $client->getSecretaryChannel(); $bot = $client->getSecretaryBot(); $usage = $client->getSecretaryUsage();
Multi-tenant (una key por organización)
$shared = new AlthaClient(baseUrl: getenv('ALTHA_API_BASE_URL')); $orgClient = $shared->withApiKey($decryptedOrgKey); $orgClient->me();
withApiKey() es inmutable: no muta el cliente compartido.
Symfony
ALTHA_API_BASE_URL=https://altha.althosalud.com # Preferí key por organización cifrada en DB; no uses una sola key global en prod.
services: AlthoSalud\Altha\AlthaClient: arguments: $baseUrl: '%env(ALTHA_API_BASE_URL)%' $apiKey: null
API cubierta (v0.1)
| Método SDK | HTTP |
|---|---|
me() |
GET /api/v1/me |
getSecretaryChannel() / updateSecretaryChannel() |
GET/PUT /api/v1/secretary/channel |
getSecretaryBot() / updateSecretaryBot() |
GET/PATCH /api/v1/secretary/bot |
getSecretaryUsage() |
GET /api/v1/secretary/usage |
sendSecretaryMessage() |
POST /api/v1/secretary/messages |
Directory stubs y Host Protocol (AHP) no van en este paquete: AHP lo implementa el host (Gosalud); directory llega en una versión posterior.
Desarrollo
symfony composer install
symfony composer test
symfony composer check
Local API: https://altha.althosalud.wip.