Scopri come inviare messaggi sondaggio ai Gruppi WhatsApp usando l'API di Wassenger, che rende molto semplice automatizzare la comunicazione WhatsApp per la tua azienda e i tuoi clienti.
Analizziamo più nel dettaglio i sondaggi di WhatsApp, da come funzionano esattamente, fino ai modi migliori in cui le aziende possono utilizzare i sondaggi nelle loro strategie di marketing e nell'automazione tramite la Wassenger API.
🤩 🤖 Wassenger è una piattaforma di comunicazione completa e una soluzione API per WhatsApp. Esplora oltre 100+ casi d'uso API e automatizza qualsiasi cosa su WhatsApp iscrivendoti a una prova gratuita e iniziando in pochi minuti!
Requisiti
- Avere un numero WhatsApp già collegato alla piattaforma e online.
- ID WID del Gruppo WhatsApp che puoi trovare in due modi:
Come ottenere l'ID WID del Gruppo WhatsApp
Puoi ottenere l'ID WID del Gruppo WhatsApp usando uno di questi metodi:
- Web: vai a Impostazioni del numero > Gruppi > Copia il Group WID.
- API: interroga i gruppi disponibili nel tuo numero usando questo endpoint.
Endpoint API
Utilizzeremo il seguente endpoint API per inviare un nuovo sondaggio:
Prepara la richiesta
URL API di destinazione usando il metodo POST
https://api.wassenger.com/v1/messages
Header HTTPS richiesti > Ottieni la tua chiave API qui
Content-Type: application/json
Token: $API_TOKEN
Usa il body in formato JSON per inviare il nuovo sondaggio
{
"group": "$GROUP_ID@g.us",
"poll": {
"name": "Which product of ours do you use the most?",
"options": [
"Product A - Wireless Headphones",
"Product B - Smartwatch",
"Product C - Fitness Tracker",
"Product D - Bluetooth Speaker",
"Product E - Smartphone Charger",
"Product F - Laptop Stand",
"Product G - Home Security Camera",
"Product H - Smart Light Bulb",
"Product I - Portable Power Bank"
]
}
}
🖥️ Cerchi un esempio di codice? Vai al tester API e ottieni esempi di codice pronti all'uso in oltre 15 linguaggi di programmazione, inclusi Python, JavaScript, PHP, C#, Java, Ruby, Go, Powershell, cURL e altri.
Inviare sondaggi usando il codice
Scopri come usare il codice nel tuo browser senza installare alcun software.
Inoltre, puoi trovare diversi linguaggi che puoi testare su Replit.com:
# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
import requests
url = "https://api.wassenger.com/v1/messages"
payload = {
"group": "$GROUP_ID@g.us",
"poll": {
"name": "Which product of ours do you use the most?",
"options": ["Product A - Wireless Headphones", "Product B - Smartwatch", "Product C - Fitness Tracker", "Product D - Bluetooth Speaker", "Product E - Smartphone Charger", "Product F - Laptop Stand", "Product G - Home Security Camera", "Product H - Smart Light Bulb", "Product I - Portable Power Bank"]
}
}
headers = {
"Content-Type": "application/json",
"Token": "API TOKEN GOES HERE"
}
response = requests.post(url, json=payload, headers=headers, params=querystring)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.wassenger.com/v1/messages',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'group' => '$GROUP_ID@g.us',
'poll' => [
'name' => 'Which product of ours do you use the most?',
'options' => [
'Product A - Wireless Headphones',
'Product B - Smartwatch',
'Product C - Fitness Tracker',
'Product D - Bluetooth Speaker',
'Product E - Smartphone Charger',
'Product F - Laptop Stand',
'Product G - Home Security Camera',
'Product H - Smart Light Bulb',
'Product I - Portable Power Bank',
],
],
]),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Token: API TOKEN GOES HERE',
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo 'cURL Error #:' . $err;
} else {
echo $response;
}
🤩 🤖 Wassenger è una soluzione API completa per WhatsApp. Iscriviti per una prova gratuita di 7 giorni e inizia in pochi minuti!
// Examples requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.
// Install it by running: pecl install pecl_http
// More information: https://pecl.php.net/package/pecl_http/3.2.0
<?php
$client = new http\Client();
$request = new http\Client\Request();
$body = new http\Message\Body();
$body->append(
json_encode([
'group' => '$GROUP_ID@g.us',
'poll' => [
'name' => 'Which product of ours do you use the most?',
'options' => [
'Product A - Wireless Headphones',
'Product B - Smartwatch',
'Product C - Fitness Tracker',
'Product D - Bluetooth Speaker',
'Product E - Smartphone Charger',
'Product F - Laptop Stand',
'Product G - Home Security Camera',
'Product H - Smart Light Bulb',
'Product I - Portable Power Bank',
],
],
])
);
$request->setRequestUrl('https://api.wassenger.com/v1/messages');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'Content-Type' => 'application/json',
'Token' => 'API TOKEN GOES HERE',
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
// This code requires you to have installed Unirest package.
// Documentation: https://kong.github.io/unirest-java/#requests
// Installation: http://kong.github.io/unirest-java/
HttpResponse<String> response = Unirest.post("https://api.wassenger.com/v1/messages")
.header("Content-Type", "application/json")
.header("Token", "API TOKEN GOES HERE")
.body("{\"group\":\"$GROUP_ID@g.us\", \"poll\":{\"name\":\"Which product of ours do you use the most?\", \"options\":[\"Product A - Wireless Headphones\", \"Product B - Smartwatch\", \"Product C - Fitness Tracker\", \"Product D - Bluetooth Speaker\", \"Product E - Smartphone Charger\", \"Product F - Laptop Stand\", \"Product G - Home Security Camera\", \"Product H - Smart Light Bulb\", \"Product I - Portable Power Bank\"]}}")
.asString();
Vuoi di più? Esplora tutti i nostri esempi di sondaggi WhatsApp e vai oltre!
- 🚀 Invia un sondaggio a un utente
- 📈 Invia un sondaggio a un gruppo
- 📈 Programma l'invio di un sondaggio in futuro
- ⚡ Invia un sondaggio a un canale
- 🔥 Invia voti su un sondaggio utente esistente
- 🏆 Invia voti su un sondaggio di gruppo esistente
- 🌟 Rimuovi voti su un sondaggio utente esistente
🤩 🤖 Wassenger è una piattaforma di comunicazione completa e una soluzione API per WhatsApp. Esplora oltre 100+ casi d'uso API e automatizza qualsiasi cosa su WhatsApp iscrivendoti a una prova gratuita e iniziando in pochi minuti!
Test in tempo reale usando l'API
Esplora il nostro tester API in tempo reale
Domande frequenti
Ho più numeri collegati: come invio i messaggi tramite un numero specifico?
Se hai più numeri collegati al tuo account, devi specificare il campo device nel body JSON con l'ID del dispositivo del numero WhatsApp di destinazione (valore esadecimale di 24 caratteri) attraverso il quale vuoi inviare i messaggi.
Se il campo device non è specificato, i messaggi saranno inviati tramite il primo numero WhatsApp collegato al tuo account.
Ecco un esempio di come inviare un messaggio tramite un numero WhatsApp specifico
Come inviare messaggi a più numeri di telefono
Devi inviare più richieste API, una per ogni numero di telefono di destinazione.
Per esempio, se vuoi inviare un messaggio a 10 numeri di telefono, dovresti inviare 10 richieste HTTPS indipendenti all'API.
Non esiste un'opzione per inviare più messaggi in una singola richiesta API.
Come verificare se un numero di telefono può ricevere messaggi WhatsApp
Puoi verificare se un dato numero di telefono è collegato a un account WhatsApp e può ricevere messaggi.
L'API fornisce un endpoint che può validare se un determinato numero di telefono esiste su WhatsApp oppure no.
L'unico requisito è avere almeno un numero WhatsApp collegato alla piattaforma nel tuo account attuale.
Per maggiori dettagli, consulta la documentazione dell'endpoint API qui.
Prima di verificare se un numero di telefono esiste su WhatsApp, puoi anche convalidare e normalizzare il formato di una lista di numeri di telefono usando l'endpoint di validazione numeri. Questo endpoint convalida solo il corretto formato E.164, ma non verifica se il numero di telefono esiste effettivamente su WhatsApp.
Nota: il numero di verifiche WhatsApp è limitato al mese in base al tuo piano di abbonamento. Consulta la tabella prezzi per maggiori dettagli sui limiti.
Cerchi altre risposte? Consulta le FAQ estese.
Ulteriori risorse utili
Documentazione API
Per maggiori dettagli sull'endpoint API, consulta la documentazione dove troverai tutti i dettagli sui parametri di richiesta accettati, le possibili risposte di successo o errore e esempi di codice pronti all'uso in diversi linguaggi di programmazione:
https://app.wassenger.com/docs/#tag/Messages/operation/createMessage
🤩 🤖 Wassenger è una soluzione API completa per WhatsApp. Iscriviti per una prova gratuita di 7 giorni e inizia in pochi minuti!







