Skip to main content

UC-004 — Bulk RCS Rich Card Campaign

Goal
Create and send a bulk RCS campaign with visual Rich Cards
Channel
RCS
Estimated time
25 minutes

Real-world scenarios​

  • RetailModa — Visual promo: RetailModa launches its summer collection with a Rich Card containing a product image, price and "Buy now" button to 8,000 customers whose phone has RCS.
  • ElettronicaPlus — Product carousel launch: Presentation of 3 new smartphones with a Rich Card carousel, each with photo, specs and link to the product page.
  • FreshMarket — Seasonal offer: "Seasonal fruit -40%" promotion with an eye-catching image and a quick reply button to order directly from the RCS conversation.

RCS campaign lifecycle​

The diagram illustrates the full cycle: from draft to configuration with the RCS template, cost estimation, confirmation and delivery of Rich Cards to the devices with RCS enabled. The API reports the READY_TO_SEND state as "status": "DRAFT" with "readyToSend": true.

Prerequisites​

  • Active API Key with campaign and RCS channel permissions
  • RCS agent of your account: its agentGoogleId, listed by GET /rcs/agents, is the rcsAgentId of the campaign
  • RCS Rich Card template created and enabled on your account (see UC-003)
  • Contact list created and populated (see UC-011)
  • Recipients on devices with RCS enabled: Android phones, and iPhones where the carrier supports it

Step 1 — Create the campaign as a draft​

Create a new campaign specifying the RCS channel (sendingMode) and recipients taken from contact lists (destinationType: 0).

curl -X POST https://api.qlara.ai/api/partner-gateway/campaigns \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"name": "Collezione Estate 2027",
"description": "Lancio collezione estiva con Rich Card prodotto",
"sendingMode": "RCS",
"destinationType": 0
}'

Response — Campaign created​

{
"id": 3821,
"name": "Collezione Estate 2027",
"description": "Lancio collezione estiva con Rich Card prodotto",
"status": "DRAFT",
"sendingMode": "RCS",
"destinationType": 0,
"readyToSend": false,
"creationDate": "2027-04-09 07:00:00.000+0000"
}

Step 2 — Configure the template and recipient list​

Associate the RCS agent, the Rich Card template (rcsTemplateType is the type of the template) and the contact list with the campaign, then mark it as ready with readyToSend: true. rcsAgentId is the agent's agentGoogleId, not its numeric id. Every update must also carry sendingMode and destinationType, the latter with the value set at creation (0).

curl -X PUT https://api.qlara.ai/api/partner-gateway/campaigns/3821 \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"sendingMode": "RCS",
"destinationType": 0,
"rcsAgentId": "retailmoda_k3v9x2pq_agent",
"rcsTemplateId": 2216,
"rcsTemplateType": "CARD",
"contactListIds": [412],
"scheduledDate": "2027-04-15 09:00:00.000+0200",
"readyToSend": true
}'

Response — Campaign configured​

{
"id": 3821,
"name": "Collezione Estate 2027",
"status": "DRAFT",
"sendingMode": "RCS",
"rcsAgentId": "retailmoda_k3v9x2pq_agent",
"rcsTemplateId": 2216,
"rcsTemplateType": "CARD",
"contactListIds": [412],
"scheduledDate": "2027-04-15 07:00:00.000+0000",
"readyToSend": true
}
Behind the scenes — How the RCS Rich Card works
  1. Template resolution: The campaign loads the RCS template with its card layout (image, title, description, buttons) and returns it as rcsTemplateBody.
  2. Recipients without RCS: In RCS mode a recipient who cannot receive RCS does not get the message; with RCS_SMS the campaign falls back to the SMS (see Variants).
  3. Media: The image of the card is the one saved in the template (see the RCS Templates guide for the rules on its URL).
  4. Rendering: The message is rendered natively in the recipient's Messages app with the full card layout (image, text, action buttons).
  5. Suggested actions: Buttons can be of type URL (open link), dialer (call number) or reply (quick text reply).

Step 3 — Estimate the cost and confirm​

Check the campaign's price and proceed with confirmation.

# Get the cost estimate
curl -X GET https://api.qlara.ai/api/partner-gateway/campaigns/3821/price \
-H "X-Api-Key: YOUR_API_KEY"

Response — Cost estimate​

{
"id": 3821,
"name": "Collezione Estate 2027",
"status": "DRAFT",
"sendingMode": "RCS",
"rcsTemplateId": 2216,
"contactListIds": [412],
"totalPrice": 40000000000,
"walletKind": "EURO",
"numOfDistinctContact": 8000,
"readyToSend": true
}

numOfDistinctContact is the number of distinct recipients and totalPrice the total price of the campaign, in the unit of the wallet named by walletKind: for EURO, hundred-millionths of a euro, so 40000000000 is €400.

# Confirm and launch the campaign (202 Accepted, no body)
curl -X PUT https://api.qlara.ai/api/partner-gateway/campaigns/3821/confirm \
-H "X-Api-Key: YOUR_API_KEY"
Check costs before confirming

Confirming reserves the campaign's price on your wallet, and a confirmed campaign can no longer be updated. This campaign is scheduled, so you can still delete it with DELETE /campaigns/{id} while its scheduledDate is outside the platform's edit window, which releases the reserved amount; a campaign confirmed without scheduledDate starts sending at once and can no longer be deleted. Always check the cost estimate and the number of recipients (numOfDistinctContact) before confirming.

Expected result​

StepActionResult
1POST /campaignsCampaign created with status DRAFT
2PUT /campaigns/{id}Status DRAFT with readyToSend: true, agent, template and list
3GET /pricetotalPrice and numOfDistinctContact
4PUT /confirm202 Accepted: campaign confirmed, delivery scheduled

Complete end-to-end example​

# 1. Create RCS campaign
CAMP_ID=$(curl -s -X POST https://api.qlara.ai/api/partner-gateway/campaigns \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"name": "Collezione Estate 2027",
"description": "Rich Card lancio estivo",
"sendingMode": "RCS",
"destinationType": 0
}' | jq -r '.id')

echo "Campaign ID: $CAMP_ID"

# 2. Configure agent, template and list
curl -s -X PUT "https://api.qlara.ai/api/partner-gateway/campaigns/${CAMP_ID}" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"sendingMode": "RCS",
"destinationType": 0,
"rcsAgentId": "retailmoda_k3v9x2pq_agent",
"rcsTemplateId": 2216,
"rcsTemplateType": "CARD",
"contactListIds": [412],
"scheduledDate": "2027-04-15 09:00:00.000+0200",
"readyToSend": true
}'

# 3. Check the price
curl -s -X GET "https://api.qlara.ai/api/partner-gateway/campaigns/${CAMP_ID}/price" \
-H "X-Api-Key: YOUR_API_KEY" | jq .

# 4. Confirm the campaign
curl -s -X PUT "https://api.qlara.ai/api/partner-gateway/campaigns/${CAMP_ID}/confirm" \
-H "X-Api-Key: YOUR_API_KEY"

Variants​

RCS campaign with SMS fallback​

Configure an SMS fallback for recipients without RCS support: set sendingMode to RCS_SMS and add the SMS sender and text. smsSender must be an approved sender of your account (see GET /sms/senders), or the update is refused with 403.

curl -X PUT https://api.qlara.ai/api/partner-gateway/campaigns/3821 \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"sendingMode": "RCS_SMS",
"destinationType": 0,
"rcsAgentId": "retailmoda_k3v9x2pq_agent",
"rcsTemplateId": 2216,
"rcsTemplateType": "CARD",
"contactListIds": [412],
"smsSender": "RetailModa",
"smsBody": "Scopri la nuova collezione estiva RetailModa! -30% su tutto: https://retailmoda.it/estate2027",
"scheduledDate": "2027-04-15 09:00:00.000+0200",
"readyToSend": true
}'

The price changes with the sending mode: call GET /price again before confirming.

Common errors​

The two campaign errors below carry a generic message in data, which does not name the field that failed: look for the cause here.

400 Bad Request — Template type mismatch​

{
"status": "fail",
"data": "Bad request."
}

Solution: POST /campaigns and PUT /campaigns/{id} answer this way when rcsTemplateType is not the type of the template. Set rcsTemplateType to the type of the template (TEXT, CARD or CAROUSEL). Check the template and its type as shown in UC-003. An rcsTemplateId that is not an enabled RCS template of your account gets 404 instead.

400 Bad Request — Empty contact list​

{
"status": "fail",
"data": "The campaign has no valid recipient"
}

Solution: GET /campaigns/{id}/price answers this way when the lists hold no valid recipient; PUT /campaigns/{id}/confirm refuses the same campaign with the generic "Bad request.". Verify that the list contains valid contacts with phone numbers in international format.

401 Unauthorized — Missing or invalid API Key​

{
"error": "Invalid API Key"
}

Solution: Verify that the X-Api-Key header is present and that the key is active in the platform dashboard.

Next steps​

References​