PHP code example of althosalud / altha

1. Go to this page and download the library: Download althosalud/altha library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

althosalud / altha example snippets


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();

$shared = new AlthaClient(baseUrl: getenv('ALTHA_API_BASE_URL'));
$orgClient = $shared->withApiKey($decryptedOrgKey);
$orgClient->me();
dotenv
ALTHA_API_BASE_URL=https://altha.althosalud.com
# Preferí key por organización cifrada en DB; no uses una sola key global en prod.