Skip to main content

UC-003 — RCS Template Lifecycle

Goal
Manage the full lifecycle of RCS templates: creation, use in a campaign, update, deletion
Channel
RCS
Estimated time
20 minutes

Real-world scenarios​

  • TechStore — Marketing team builds reusable templates: The marketing manager creates a rich card with an image and buttons for the monthly promotions, and reuses it every month with different placeholders.
  • FashionOutlet — Seasonal templates: Templates for summer sales, Black Friday and Christmas are created in advance, used during the season, then updated or deleted.
  • ElettroShop — Product catalog: A carousel of featured products is updated every week with new images, descriptions and prices.

Prerequisites​

Before you begin, make sure you have:

  • Active API Key → How to get one
  • Sufficient credit → Check in the Qlara Dashboard
  • RCS agent of your account: its agentGoogleId, listed by GET /api/partner-gateway/rcs/agents, is the rcsAgentId of a campaign
Nothing is sent until you confirm

Campaigns have no simulation mode, but nothing is sent and no credit is used until you confirm one: the campaign of Step 3 stays a draft.

Template lifecycle​

Step-by-step guide​

Step 1 — Create a TEXT template​

The simplest type: a text message with interactive suggestions.

curl -X POST "https://api.qlara.ai/api/message-server/rcs/templates" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "benvenuto_cliente",
"description": "Template di benvenuto per nuovi clienti",
"type": "TEXT",
"body": {
"text": "Ciao {name}! Benvenuto in TechStore. Siamo felici di averti con noi. Scopri le offerte riservate ai nuovi clienti!",
"suggestions": [
{
"type": "reply",
"text": "Mostra offerte",
"reply": {}
},
{
"type": "url",
"text": "Visita il sito",
"url": { "url": "https://techstore.it/benvenuto" }
},
{
"type": "dial",
"text": "Chiamaci",
"dial": { "phoneNumber": "+390212345678" }
}
],
"fallbackSms": {
"sender": "TechStore",
"text": "Ciao {name}! Benvenuto in TechStore. Scopri le offerte: https://techstore.it/benvenuto"
}
}
}'

Response: 201 Created with the saved template: id, companyId, name, description, type, body, placeholderFields (an object keyed by channel, RCS and SMS, which can be empty or null), enabled, creationDate and lastUpdateDate (strings in yyyy-MM-dd HH:mm:ss.SSSZ). Keep the id: it is the rcsTemplateId of a campaign.

Step 1b — Create a CARD template​

A rich card with an image, title, description and buttons:

curl -X POST "https://api.qlara.ai/api/message-server/rcs/templates" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "promo_estate_2026",
"description": "Promozione saldi estivi con immagine",
"type": "CARD",
"body": {
"cardOrientation": "VERTICAL",
"thumbnailAlignment": "LEFT",
"card": {
"title": "Saldi Estivi TechStore",
"description": "Fino al 40% di sconto su tutta la collezione estate. Offerta valida fino al 31 luglio 2026.",
"media": {
"height": "TALL",
"fileUrl": "https://cdn.techstore.it/img/saldi-estate-2026.jpg"
},
"suggestions": [
{
"type": "url",
"text": "Scopri i saldi",
"url": { "url": "https://techstore.it/saldi-estate" }
},
{
"type": "calendar",
"text": "Ricordami la scadenza",
"calendar": {
"title": "Fine saldi estivi TechStore",
"description": "Ultimo giorno per i saldi estivi!",
"startTime": "2026-07-31T09:00:00Z",
"endTime": "2026-07-31T23:59:00Z"
}
}
]
},
"fallbackSms": {
"sender": "TechStore",
"text": "Saldi estivi TechStore! Fino al 40% di sconto. Scopri: https://techstore.it/saldi-estate"
}
}
}'

A carousel of cards that scroll horizontally:

curl -X POST "https://api.qlara.ai/api/message-server/rcs/templates" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "catalogo_prodotti_top",
"description": "Carousel prodotti in evidenza",
"type": "CAROUSEL",
"body": {
"cardWidth": "MEDIUM",
"cards": [
{
"title": "Cuffie Wireless Pro",
"description": "79.99 EUR - Noise cancelling attivo",
"media": {
"height": "MEDIUM",
"fileUrl": "https://cdn.techstore.it/img/cuffie-pro.jpg"
},
"suggestions": [
{
"type": "url",
"text": "Dettagli",
"url": { "url": "https://techstore.it/p/cuffie-pro" }
}
]
},
{
"title": "Smartwatch FitPlus",
"description": "149.99 EUR - GPS integrato",
"media": {
"height": "MEDIUM",
"fileUrl": "https://cdn.techstore.it/img/smartwatch-fitplus.jpg"
},
"suggestions": [
{
"type": "url",
"text": "Dettagli",
"url": { "url": "https://techstore.it/p/smartwatch" }
}
]
},
{
"title": "Speaker Bluetooth Mini",
"description": "39.99 EUR - Waterproof IP67",
"media": {
"height": "MEDIUM",
"fileUrl": "https://cdn.techstore.it/img/speaker-mini.jpg"
},
"suggestions": [
{
"type": "url",
"text": "Dettagli",
"url": { "url": "https://techstore.it/p/speaker-mini" }
}
]
}
],
"fallbackSms": {
"sender": "TechStore",
"text": "Scopri i prodotti in evidenza su TechStore: https://techstore.it/top"
}
}
}'

Step 2 — List the templates​

Retrieve the templates, with optional filters:

curl -X GET "https://api.qlara.ai/api/message-server/rcs/templates?type=CARD&sortBy=creationDate&sortOrder=desc&limit=10&page=0" \
-H "X-Api-Key: YOUR_API_KEY"

The response wraps the templates in a data array, with the paging in page, limit, totalCount and totalPages.

ParameterDescription
searchCase-insensitive search on name and description. When set, it overrides every other filter (id, name, description, type) and can list disabled templates too: do not combine it with other filters
idFilter by template ID
nameFilter by template name (partial, case-insensitive match)
descriptionFilter by description (partial, case-insensitive match)
typeTEXT, CARD, CAROUSEL
enabledNo effect: without search only enabled templates are listed
sortBySort field (name, type, creationDate, ...), default id
sortOrderasc (default) or desc
limitItems per page (default 10)
pagePage number (0-based)

Step 3 — Use the template in a campaign​

A campaign sends the template to your contact lists. Pass the template's id as rcsTemplateId, its type as rcsTemplateType and the agentGoogleId of your RCS agent as rcsAgentId. This campaign uses the CARD template of Step 1b:

curl -X POST "https://api.qlara.ai/api/partner-gateway/campaigns" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Saldi estivi 2026",
"sendingMode": "RCS",
"destinationType": 0,
"rcsAgentId": "techstore_k3v9x2pq_agent",
"rcsTemplateId": 56,
"rcsTemplateType": "CARD",
"contactListIds": [412]
}'

Response: 201 Created with the campaign in DRAFT status. Nothing is sent yet: mark the campaign as ready, check its price and confirm it as shown in UC-004: Bulk RCS Rich Card Campaign.

rcsTemplateId must be an enabled RCS template of your account, otherwise the campaign is refused with 404, and rcsTemplateType must be the type of that template (TEXT, CARD or CAROUSEL).

SMS fallback

To reach the recipients without RCS too, set the campaign's sendingMode to RCS_SMS and add smsSender and smsBody: see RCS campaign with SMS fallback.

Step 4 — Update a template​

Change an existing template with PUT. name, description and type keep their value when you leave them out, but body does not: an update without body erases the content of the template. So always send type and body, the current ones from GET if you only change the name:

curl -X PUT "https://api.qlara.ai/api/message-server/rcs/templates/55" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "benvenuto_cliente_v2",
"description": "Template benvenuto aggiornato con nuove offerte",
"type": "TEXT",
"body": {
"text": "Ciao {name}! Benvenuto in TechStore. Usa il codice WELCOME10 per il 10% di sconto sul primo acquisto!",
"suggestions": [
{
"type": "url",
"text": "Usa lo sconto",
"url": { "url": "https://techstore.it/promo/WELCOME10" }
}
],
"fallbackSms": {
"sender": "TechStore",
"text": "Ciao {name}! Benvenuto in TechStore. Codice sconto WELCOME10 su techstore.it"
}
}
}'

Response: 200 OK with the updated template.

Step 5 — Delete a template​

When a template is no longer needed:

curl -X DELETE "https://api.qlara.ai/api/message-server/rcs/templates/55" \
-H "X-Api-Key: YOUR_API_KEY"

Response: 204 No Content

Permanent deletion

Deleting a template is permanent. Messages already sent with that template are not affected, but you can no longer use it in new campaigns.

Template types compared​

TypeContentWhen to use it
TEXTText + suggestions (buttons)Notifications, confirmations, simple messages with actions
CARDImage/video + title + description + buttonsSingle promotions, offers with an eye-catching visual
CAROUSEL2-10 scrollable cardsProduct catalogs, comparisons, option menus

Available suggestions​

TypeDescription
replyQuick reply with predefined text
urlOpens a link in the browser
dialStarts a phone call
locationCoordinatesShows a position on a map
locationQuerySearches for an address on a map
calendarCreates a calendar event
Behind the scenes

RCS templates are managed internally by the Qlara platform, with no external approval (unlike WhatsApp templates, which require Meta's approval):

  1. Creation -- The template is saved and linked to your account. It is immediately available for campaigns.
  2. Rendering -- The placeholders in the text ({name}, {codice}, etc.) are replaced when each message is sent.
  3. Fallback -- fallbackSms is the only fallback a template keeps: a fallbackWhatsApp sent when you create or update the template is not saved. A campaign sets its own SMS fallback, with the RCS_SMS sending mode and its smsSender and smsBody.
  4. Update -- PUT changes only the fields you send. Messages already sent are not modified.
  5. Results -- Read the counters of the campaign with GET /campaigns/{id}, or export its report as in UC-002: Complete Campaign Report.

Expected result​

AspectDetail
Action completedRCS template created, used in a campaign, updated or deleted
Channel usedRCS
ResultsCounters of the campaign, with GET /campaigns/{id}

Common errors​

ProblemProbable causeSolution
HTTP 401Missing or invalid API KeyCheck X-Api-Key header
HTTP 400 — Invalid template typeUnsupported type or malformed body structureVerify type is TEXT, CARD, or CAROUSEL with the matching body schema; when updating body, send type too
HTTP 404 — Template not foundWrong template ID or template was deletedList templates with GET /rcs/templates to verify the ID
HTTP 404 on POST /campaigns — RCS template not foundrcsTemplateId is not an enabled RCS template of your accountTake the id from GET /rcs/templates
HTTP 400 on POST /campaigns — Bad request.rcsTemplateType is not the type of the templateSend the type of the template as rcsTemplateType

Next steps​