28 Ago, 25

Guida Completa API WhatSender

Invia messaggi WhatsApp, controlla numeri, gestisci gruppi e molto altro

Introduzione

Le API REST di WhatSender ti permettono di integrare l’invio di messaggi WhatsApp direttamente nelle tue applicazioni. Questa guida completa ti mostrerà come utilizzare tutte le funzionalità disponibili.

Informazioni Generali

Tutte le API WhatSender richiedono un token di autenticazione. Puoi trovare il tuo token nella dashboard.

Dashboard

URL: https://api2.whatsender.it

Accedi alla dashboard per gestire il tuo account, visualizzare le statistiche e ottenere il tuo token API.

Supporto

URL: https://support.appteam.it

Contatta il nostro team di supporto per assistenza con le API o per risolvere eventuali problemi.

Invia Messaggi di Testo o Media

Utilizza questa API per inviare messaggi di testo o messaggi multimediali a numeri WhatsApp.

Metodo GET
Metodo POST

<?php
// Invia messaggio di testo (GET)
$response1 = file_get_contents('https://node.whatsender.it/send?receiver=34644975414&msgtext=Testing+send+message+through+API&token=NHbTiAheeqKO5OtOWOwa');

// Invia messaggio con media (GET)
$response2 = file_get_contents('https://node.whatsender.it/send?receiver=34644975414&msgtext=Testing+send+message+through+API&token=NHbTiAheeqKO5OtOWOwa&mediaurl=https://www.whatsender.it/wp-content/uploads/2021/12/cropped-Risorsa-2-1-192x192.png');

echo $response1; // output {success:true} or {success:false}
echo $response2; // output {success:true} or {success:false}
?>

<?php
// Invia messaggio con media (POST)
$nodeurl = 'https://node.whatsender.it/send';
$mediaurl = 'https://www.whatsender.it/wp-content/uploads/2021/12/cropped-Risorsa-2-1-192x192.png';

$data = [
    'receiver'  => '34644975414',
    'msgtext'   => 'Testing send message through API',
    'token'     => 'NHbTiAheeqKO5OtOWOwa',
    'mediaurl'  => $mediaurl, // elimina questa riga se non vuoi inviare media
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_URL, $nodeurl);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // output {success:true} or {success:false}
?>

Parametri

Parametro Tipo Obbligatorietà Descrizione
receiver String Obbligatorio Numero di telefono del destinatario (formato internazionale, es. 34644975414)
msgtext String Obbligatorio Testo del messaggio da inviare
token String Obbligatorio Token di autorizzazione per l’API
mediaurl String Opzionale URL di un’immagine o file multimediale da inviare

Verifica se un numero è su WhatsApp

Utilizza questa API per verificare se un numero de telefono è registrato su WhatsApp.

Metodo GET
Metodo POST

<?php
$response = file_get_contents('https://node.whatsender.it/isonwa?receiver=34644975414&token=NHbTiAheeqKO5OtOWOwa');

echo $response; // output {success:true/false, isonwa:true/false}
?>

<?php
$nodeurl = 'https://node.whatsender.it/isonwa';

$data = [
    'receiver'  => '34644975414',
    'token'     => 'NHbTiAheeqKO5OtOWOwa',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl极opt($ch, CURLOPT_URL, $nodeurl);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // output {success:true/false, isonwa:true/false}
?>

Ottieni QR Code

Utilizza questa API per ottenere il QR Code per collegare il tuo account WhatsApp.

<?php
$response1 = file_get_contents('https://node.whatsender.it/info?getqr=code&token=NHbTiAheeqKO5OtOWOwa');
$response2 = file_get_contents('https://node.whatsender.it/info?getqr=image&token=NHbTiAheeqKO5OtOWOwa');

echo $response1; // output {success:true/false, isonwa:true/false}
echo $response2; // output {success:true/false, isonwa:true/false}
?>

Parametri

Parametro Tipo Valori Descrizione
getqr String code o image Specifica se vuoi ottenere il codice QR o l’immagine QR
token String Token di autorizzazione per l’API

Recupera Lista Gruppi

Utilizza questa API per recuperare la lista dei gruppi WhatsApp associati a un numero.

Metodo GET
Metodo POST

<?php
$response = file_get_contents('https://node.whatsender.it/fetchgroups?sender=393452220047&token=NHbTiAheeqKO5OtOWOwa');

echo $response; // output {success:true/false, message:response message}
?>

<?php
$nodeurl = 'https://node.whatsender.it/fetchgroups';

$data = [
    'sender'  => '393452220047',
    'token'   => 'NHbTiAheeqKO5OtOWOwa',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
curl_setopt($极, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_URL, $nodeurl);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // output {success:true/false, message:response message}
?>

Invia Posizione

Utilizza questa API per inviare una posizione geografica tramite WhatsApp.

Metodo GET
Metodo POST

<?php
$response = file_get_contents('https://node.whatsender.it/send?receiver=34644975414&msgtext=degreesLatitude:24.232483,degreesLongitude:55.692107,locationName:Omar+Palace,locationAddress:Abu+Dhabi&token=NHbTiAheeqKO5OtOWOwa');

echo $response; // output {success:true} or {success:false}
?>

<?php
$nodeurl = '极://node.whatsender.it/send';

$data = [
    'receiver'  => '34644975414',
    'msgtext'   => 'degreesLatitude:24.232483,degreesLongitude:55.692107,locationName:Omar+Palace,locationAddress:Abu+Dhabi',
    'token'     => 'NHbTiAheeqKO5OtOWOwa',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURL极T_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_URL, $nodeurl);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // output {success:true} or {success:false}
?>

Formato Posizione

Il parametro msgtext deve seguire questo formato:

degreesLatitude:{latitudine},degreesLongitude:{longitudine},locationName:{nome},locationAddress:{indirizzo}

Invia Sondaggio

Utilizza questa API per inviare un sondaggio tramite WhatsApp.

<?php
$nodeurl = 'https://node.whatsender.it/send';

$data = [
    'receiver' => '34644975414',
    'msgtext'  => 'poll',
    'token'    => 'NHbTiAheeqKO5OtOWOwa',
    'poll'     => [
        'name'            => 'hello there!',
        'values'          => ['test123', 'test231'],
        'selectableCount' => 1, // 0 per selezione multipla
    ]
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_URL, $nodeurl);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // output {success:true} or {success:false}
?>

Invia VCard (Contatto)

Utilizza questa API per inviare una scheda contatto (VCard) tramite WhatsApp.

Metodo GET
Metodo POST

<?php
$response = file_get_contents('https://node.whatsender.it/send?receiver=34644975414&msgtext=FN:My+Full+Name,ORG:My+Company+Name,TEL:14088999448&token极NHbTiAheeqKO5OtOWOwa');

echo $response; // output {success:true} or {success:false}
?>

<?php
$nodeurl = 'https://node.whatsender.it/send';

$data = [
    'receiver'  => '34644975414',
    'msgtext'   => 'FN:My+Full+Name,ORG:My+Company+Name,TEL:14088999448',
    'token'     => 'NHbTiAheeqKO5OtOWOwa',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_URL, $nodeurl);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // output {success:true} or {success:false}
?>

Formato VCard

Il parametro msgtext deve seguire questo formato:

FN:{Nome Completo},ORG:{Azienda},TEL:{Telefono}

Gestione delle Risposte

Tutte le API restituiscono una risposta in formato JSON con questi campi:

// Successo
{ 
    "success": true,
    "message": "Message sent successfully" 
}

// Errore
{ 
    "success": false,
    "message": "Invalid phone number" 
}

In caso di errore, controlla:

  • Il formato del numero di telefono (deve essere in formato internazionale senza spazi o simboli)
  • La validità del token API
  • La disponibilità dell’URL multimediale (se utilizzato)
  • La connessione a internet