Template RCS
I template RCS sono messaggi pre-configurati che possono essere riutilizzati per invii ripetuti. Supportano tre formati: testo semplice, card ricca e carosello di card.
Endpoint
| Metodo | Path | Descrizione |
|---|---|---|
GET | /api/message-server/rcs/templates | Lista template |
GET | /api/message-server/rcs/templates/{id} | Dettaglio template |
POST | /api/message-server/rcs/templates | Crea template |
PUT | /api/message-server/rcs/templates/{id} | Aggiorna template |
DELETE | /api/message-server/rcs/templates/{id} | Elimina template |
Tipi di template
TEXT
Il tipo più semplice: un messaggio di testo con suggerimenti opzionali.
{
"name": "rcs_welcome",
"description": "Template di benvenuto",
"type": "TEXT",
"body": {
"text": "Ciao {name}! Benvenuto nel nostro servizio.",
"suggestions": [
{ "type": "reply", "text": "Grazie!" },
{ "type": "url", "text": "Visita il sito", "url": { "url": "https://example.com" } }
],
"fallbackSms": {
"sender": "AZIENDA",
"text": "Ciao {name}! Benvenuto. Visita https://example.com"
}
}
}
CARD
Una card ricca con immagine/video, titolo, descrizione e bottoni.
{
"name": "rcs_promo",
"description": "Promozione con immagine",
"type": "CARD",
"body": {
"cardOrientation": "VERTICAL",
"thumbnailAlignment": "LEFT",
"card": {
"title": "Offerta speciale",
"description": "Scopri le novità della stagione",
"media": {
"height": "TALL",
"fileUrl": "https://example.com/promo.jpg"
},
"suggestions": [
{ "type": "url", "text": "Scopri", "url": { "url": "https://example.com/promo" } }
]
},
"fallbackSms": {
"sender": "SHOP",
"text": "Offerta speciale! Scopri: https://example.com/promo"
}
}
}
CAROUSEL
Un carosello di card scorrevoli orizzontalmente.
{
"name": "rcs_catalogo",
"description": "Catalogo prodotti",
"type": "CAROUSEL",
"body": {
"cardWidth": "MEDIUM",
"cards": [
{
"title": "Prodotto A",
"description": "29.99 EUR",
"media": { "height": "MEDIUM", "fileUrl": "https://example.com/a.jpg" },
"suggestions": [
{ "type": "url", "text": "Dettagli", "url": { "url": "https://example.com/a" } }
]
},
{
"title": "Prodotto B",
"description": "49.99 EUR",
"media": { "height": "MEDIUM", "fileUrl": "https://example.com/b.jpg" },
"suggestions": [
{ "type": "url", "text": "Dettagli", "url": { "url": "https://example.com/b" } }
]
}
],
"fallbackSms": {
"sender": "SHOP",
"text": "Scopri il nostro catalogo: https://example.com"
}
}
}
Campi creazione template
| Campo | Tipo | Obb. | Descrizione |
|---|---|---|---|
name | string | Sì | Nome del template |
description | string | No | Descrizione |
type | string | Sì | Tipo: TEXT, CARD, CAROUSEL |
body | object | Sì | Contenuto (struttura varia in base al tipo) |
Suggerimenti disponibili
| Tipo | Descrizione | Campi |
|---|---|---|
reply | Risposta rapida | text |
url | Apre un link | text, url.url |
dial | Avvia chiamata | text, dial.phoneNumber |
locationCoordinates | Mostra posizione | text, locationCoordinates.latitude/longitude/label |
locationQuery | Cerca posizione | text, locationQuery.query |
calendar | Evento calendario | text, calendar.title/description/startTime/endTime |
Fallback
Ogni template può includere:
- fallbackWhatsApp: se RCS non è disponibile, invia su WhatsApp
- fallbackSms: se il canale precedente fallisce, invia SMS (obbligatorio se fallbackWhatsApp è presente)
Media
| Campo | Tipo | Descrizione |
|---|---|---|
height | enum | SHORT, MEDIUM, TALL, UNSPECIFIED |
fileUrl | string | URL pubblico del media (*esclusivo con mediaKey) |
mediaKey | string | Chiave media interna (*esclusivo con fileUrl) |
thumbnailUrl | string | URL anteprima (opzionale) |
Filtri lista template
| Parametro | Descrizione |
|---|---|
search | Ricerca su nome/descrizione |
type | Filtra per tipo: TEXT, CARD, CAROUSEL |
enabled | 0 = solo disabilitati, 1 = solo abilitati |
sortBy | Campo ordinamento (name, type, creationDate, ecc.) |
sortOrder | asc o desc |
limit | Elementi per pagina |
page | Numero pagina (0-based) |