Template RCS
I template RCS ti consentono di creare messaggi pre-progettati che puoi riutilizzare per campagne, notifiche e comunicazioni regolari. Ogni template supporta fallback SMS automatico per compatibilità con dispositivi non RCS.
Creazione di un Template
Quando crei un template, lo memorizzi nel portale e lo riutilizzi più volte indicando il suo ID.
Endpoint: POST /api/message-server/rcs/templates
Esempio di Richiesta
{
"name": "Product Promotion",
"type": "CARD",
"card": {
"image": "https://example.com/promo.jpg",
"title": "Limited Time Offer",
"description": "Get 30% off on all products",
"buttons": [
{
"label": "Shop Now",
"action": "https://example.com/shop"
},
{
"label": "Learn More",
"action": "https://example.com/promo"
}
]
},
"fallback": "Get 30% off on all products! Visit example.com/shop"
}
Risposta
{
"templateId": "tmpl_prod_promo_001",
"status": "created"
}
Tipi di Template
TEXT
Un template di messaggio di testo semplice.
{
"name": "Order Confirmation",
"type": "TEXT",
"body": "Your order {orderId} has been confirmed. Tracking: {trackingUrl}",
"fallback": "Your order has been confirmed."
}
CARD
Un template con una singola card con immagine, titolo, descrizione e pulsanti.
{
"name": "Appointment Booking",
"type": "CARD",
"card": {
"image": "https://example.com/calendar.jpg",
"title": "Book an Appointment",
"description": "Schedule your next visit",
"buttons": [
{
"label": "Available Times",
"action": "https://example.com/booking"
},
{
"label": "Call Us",
"action": "tel:+391234567890"
}
]
},
"fallback": "Book an appointment at example.com/booking"
}
CAROUSEL
Un template con più card scorrevoli.
{
"name": "Product Showcase",
"type": "CAROUSEL",
"carousel": [
{
"image": "https://example.com/product1.jpg",
"title": "Product A",
"description": "Premium quality",
"buttons": [
{
"label": "View",
"action": "https://example.com/productA"
}
]
},
{
"image": "https://example.com/product2.jpg",
"title": "Product B",
"description": "Best seller",
"buttons": [
{
"label": "View",
"action": "https://example.com/productB"
}
]
}
],
"fallback": "Check out our products at example.com"
}
Invio di un Messaggio Usando un Template
Usa un template memorizzato per inviare messaggi di massa senza creare nuove richieste ogni volta.
Endpoint: POST /api/message-server/rcs/send-template
Richiesta
{
"templateId": "tmpl_prod_promo_001",
"destination": "+393471234567",
"sender": "YourCompany",
"variables": {
"orderId": "12345",
"trackingUrl": "https://track.example.com/12345"
}
}
Risposta
{
"messageId": "msg_abc123",
"status": "accepted",
"templateId": "tmpl_prod_promo_001"
}
Variabili Dinamiche
I template supportano variabili dinamiche indicate con \{variableName\}. Quando invii un messaggio, fornisci i valori nel campo variables.
Esempio di Template:
Order {orderId} is ready for pickup at {location}.
Invio con Variabili:
{
"variables": {
"orderId": "ORD-2025-001",
"location": "Milan Store"
}
}
Messaggio Finale:
Order ORD-2025-001 is ready for pickup at Milan Store.
Best Practice per Template
- Nomi significativi: Usa nomi descrittivi che indichino lo scopo (es. "Order Confirmation", "Appointment Reminder")
- Fallback chiaro: Scrivi fallback SMS che comunichino il messaggio anche senza RCS
- Variabili limitate: Limita il numero di variabili per mantenere i template leggibili
- Immagini ottimizzate: Usa immagini compresse e di alta qualità (consigliato: 1200x627 pixel)
- Test: Testa i template su diversi dispositivi prima del lancio di massa
Gestione dei Template
Elenco di Tutti i Template
Endpoint: GET /api/message-server/rcs/templates
Risposta:
{
"templates": [
{
"templateId": "tmpl_promo_001",
"name": "Product Promotion",
"type": "CARD",
"created": "2025-11-20T10:30:00Z"
}
]
}
Aggiorna un Template
Endpoint: PUT /api/message-server/rcs/templates/\{templateId\}
{
"name": "Updated Promotion",
"card": {
"image": "https://example.com/new-promo.jpg",
"title": "Updated Title",
"description": "Updated description"
}
}
Elimina un Template
Endpoint: DELETE /api/message-server/rcs/templates/\{templateId\}
Webhook di Consegna per Template
I messaggi inviati tramite template ricevono notifiche di consegna come i messaggi normali:
{
"channel": "RCS",
"eventType": "DELIVERY",
"messageId": "msg_abc123",
"templateId": "tmpl_promo_001",
"statusCode": 3,
"description": "delivered"
}
Supporto
Per assistenza tecnica, contatta help@agiletelecom.com.
Qual è il Prossimo?
- API RCS — invia messaggi RCS custom
- API REST SMS — fallback SMS standard
- Inbound SMS — ricevi risposte dai clienti