Come aumentare il coinvolgimento dei clienti inviando messaggi personalizzati su WhatsApp

18 febbraio 2025

Hai mai desiderato inviare automaticamente messaggi WhatsApp personalizzati? Immagina di rivolgerti a ogni cliente per nome, condividere lo stato del loro ordine o aggiungere dettagli personalizzati, il tutto senza digitare manualmente! 🤯 Wassenger API rende questo sogno realtà con le template variables. Vediamo come puoi integrarle nei tuoi messaggi senza sforzo! 🚀

1. Cosa sono le Template Variables? 🤔

Template variables ti consentono di inserire contenuti dinamici nei tuoi messaggi WhatsApp. Pensa a dei segnaposto che vengono sostituiti con dati reali quando il messaggio viene inviato. Per esempio:

Dear {{ contact.name | customer }}, your order {{ metadata.order_id }} is out for delivery!

Questo saluterà automaticamente il cliente per nome e includerà i dettagli del suo ordine. Ottieni più informazioni qui su come usare i template WhatsApp

Puoi usare la sintassi delle template variables per mostrare informazioni dinamiche nei tuoi messaggi basate su un insieme di variabili predefinite collegate all'utente corrente che invia il messaggio, o alla chat di destinazione, al contatto, ai metadata e alla data.

Le template variables possono essere utilizzate nelle risposte rapide, nelle risposte automatiche e nei messaggi inviati tramite l'API o la web chat.

Puoi mostrare informazioni dinamiche nei messaggi basate sulle seguenti entità:

  • whatsapp: numero WhatsApp connesso che invia il messaggio
  • user: utente corrente che invia il messaggio
  • chat: chat di destinazione che riceverà il messaggio
  • contact: contatto di destinazione che riceverà il messaggio
  • date: la data corrente al momento della consegna del messaggio
  • metadata: metadata del contatto di destinazione accessibile per key, es: {{ metadata.crm_id }}

👉 👉 Scopri di più su tutte le template variables supportate qui

Esempio di messaggio che utilizza le template variables:

Dear {{ contact.name }}, 
We will be in touch shortly with more information.
Your query has been registered on {{ date.humanize.full }}.
Your support agent is {{ chat.agent.name }}.
Thank you!

🔗 Inizia ad automatizzare ora! 🚀 Iscriviti a Wassenger su Wassenger e personalizza i tuoi messaggi WhatsApp con template dinamici in più lingue! 🌱

2. Come iniziare con le Template Variables 🔧

  • Step 1: Ottieni la tua API key qui.
  • Step 2: Installa lo strumento che preferisci come Node.js, Python, PHP, Java, C# (RestClient & HttpClient), Go o Powershell.
  • Step 3: Usa l'URL dell'API: https://api.wassenger.com/v1/messages

3. Payload JSON 📦

{
  "phone": "+1234567890",
  "message": "Dear {{ contact.name }}, your order {{ order }} is out for delivery!"
}

4. Esempi di codice in più linguaggi 💻

C# (RestClient)

var client = new RestClient("https://api.wassenger.com/v1/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Token", "YOUR_API_KEY");
request.AddJsonBody(new { phone = "+1234567890", message = "Hello {{ contact.name }}!" });
var response = client.Execute(request);
Console.WriteLine(response.Content);

C# (HttpClient)

HttpClient client = new HttpClient();
var content = new StringContent("{ \"phone\": \"+1234567890\", \"message\": \"Hello {{ contact.name }}!\" }", Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Token", "YOUR_API_KEY");
var response = await client.PostAsync("https://api.wassenger.com/v1/messages", content);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Non aspettare! Aumenta subito l'interazione con i tuoi clienti grazie ai messaggi WhatsApp automatici! Iscriviti su Wassenger e sperimenta un'integrazione senza soluzione di continuità!

Ottieni più informazioni qui su come usare i template WhatsApp 🚀

Java

HttpURLConnection conn =(HttpURLConnection) new URL("https://api.wassenger.com/v1/messages").openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Token", "YOUR_API_KEY");
conn.setDoOutput(true);
String jsonInput = "{\"phone\":\"+1234567890\", \"message\":\"Hello {{ contact.name }}!\"}";
try(OutputStream os = conn.getOutputStream()) { os.write(jsonInput.getBytes()); os.flush(); }

PHP (HTTP2)

$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 {{ contact.name }}!"]));
curl_exec($ch);
curl_close($ch);

Node.js (Axios)

const axios = require('axios');
axios.post('https://api.wassenger.com/v1/messages', {
phone: '+1234567890', 
message: 'Hello {{ contact.name }}!'
}, { headers: { 'Token': 'YOUR_API_KEY' } });

Python

import requests
requests.post('https://api.wassenger.com/v1/messages', json={"phone": "+1234567890", "message": "Hello {{ contact.name }}!"}, headers={'Token': 'YOUR_API_KEY'})

Go

package main
import("bytes", "net/http", "fmt")
jsonStr:= []byte(`{"phone": "+1234567890", "message": "Hello {{ contact.name }}!"}`)
req, _:= http.NewRequest("POST", "https://api.wassenger.com/v1/messages", bytes.NewBuffer(jsonStr))
req.Header.Set("Token", "YOUR_API_KEY")
client:= &http.Client{}
resp, _:= client.Do(req)
fmt.Println(resp.Status)

Powershell

$headers = @{ 'Token' = 'YOUR_API_KEY'; 'Content-Type' = 'application/json' }
$body = @{ phone = '+1234567890'; message = 'Hello {{ contact.name }}!' } | ConvertTo-Json
Invoke-RestMethod -Uri 'https://api.wassenger.com/v1/messages' -Method Post -Headers $headers -Body $body

Test API live

Puoi testare e sperimentare l'API direttamente dal tuo browser.

Una volta terminati i test, ottieni l'esempio di codice auto-generato nel linguaggio di programmazione che preferisci e sarai pronto per partire.

PROVA ORA IL NOSTRO TESTER API LIVE!

🔗 Inizia oggi! Esplora Wassenger qui per altri strumenti di automazione e guide. 🚀

Ready to transform your WhatsApp communication?

Start automating your customer interactions today with Wassenger

Get Started Free