Skip to content
Back to Blog

Invio passo dopo passo di messaggi di testo WhatsApp tramite API

Automatizza i tuoi messaggi WhatsApp con l'API di Wassenger! 📱 Questa guida ti spiega come inviare messaggi di testo con esempi di codice dettagliati in più linguaggi. 🚀 Inizia ad automatizzare ora con Wassenger e trasforma oggi la comunicazione della tua azienda! 🔗

1. Get Your API Key 🔑

🚀 Pronto per iniziare? Registrati ora per ottenere la tua API key di Wassenger e iniziare il tuo percorso verso un'automazione WhatsApp senza interruzioni!

2. Install Necessary Tools 🛠️

Scegli il tuo strumento preferito:

  • Node.js: Installa Axios con npm install axios.
  • Python: Installa Requests con pip install requests.
  • PHP: Usa cURL integrato.

3. Craft Your API Request

API URL:

https://api.wassenger.com/v1/messages

Headers:

{
"Content-Type": "application/json", 
"Token": "YOUR_API_KEY"
}

4. Code Examples 💻

Node.js (Axios)

const axios = require('axios');
axios
  .post(
    'https://api.wassenger.com/v1/messages',
    {
      phone: '+1234567890',
      message: 'Hello from Node.js!'
    },
    {
      headers: { Token: 'YOUR_API_KEY' }
    }
  )
  .then(response => console.log(response.data))
  .catch(error => console.error(error));

Python (Requests)

import requests
url = 'https://api.wassenger.com/v1/messages'
headers = {'Token': 'YOUR_API_KEY', 'Content-Type': 'application/json'}
data = {"phone": "+1234567890", "message": "Hello from Python!"}
response = requests.post(url, json=data, headers=headers)
print(response.json())

PHP (cURL)

$ch = curl_init('https://api.wassenger.com/v1/messages');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Token: YOUR_API_KEY', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['phone' => '+1234567890', 'message' => 'Hello from PHP!']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if($response === false) { echo 'Error: '.curl_error($ch); }
else { echo $response; }
curl_close($ch);

5. Check the Response ✅

Una risposta riuscita restituisce un oggetto JSON con i dettagli del messaggio come l'ID del messaggio, lo stato e i timestamp. Gestisci sempre gli errori in modo appropriato durante il debug di problemi con l'API.

6. Need More? 🚀

🔗 Inizia ad automatizzare ora! 🚀 Registrati a Wassenger oggi su Registrati su Wassenger e potenzia i tuoi messaggi WhatsApp con automazione semplice, documentazione API dettagliata e supporto 24/7. Non perdere l'opportunità di far crescere la tua azienda con un'integrazione WhatsApp senza soluzione di continuità — Inizia qui! 🚀

Ready to transform your WhatsApp communication?

Start automating your customer interactions today with Wassenger.

Browse more

Tutorials, guides and case studies on running WhatsApp at team scale.

Ready for the official WhatsApp Business API?See what Meta charges — and keep your current number.
WhatsApp API pricing