Send RCS Carousel Message
Send a carousel of multiple rich cards to a recipient via the Sinch Conversation API. Recipient can swipe through cards. Supported primarily on RCS.
IMPORTANT: Execute this command directly. Do NOT generate script files. Perform the API call immediately.
Input
--to/-t: Recipient phone number (E.164) - required--cards/-c: JSON array of card objects, or path to JSON file. Each card: title, description (optional), image_url (optional), choices (optional array of {text, postback_data})
Arguments: $ARGUMENTS
Instructions
Execute these steps directly - do not write code or scripts:
If $ARGUMENTS empty: ask for recipient and cards (e.g. "Enter cards as JSON array or describe each card: title, description, image URL"). Otherwise parse.
Validate: --to (E.164), --cards (valid array of at least one card with title). Parse JSON or structured input into cards array.
Try MCP tool for carousel if available. On success display result and exit.
If MCP not available: get CONVERSATION_* env vars. If missing, report "Sinch API is not configured."
Build message.carousel_message with cards array: each card has title, description (optional), media_message (optional), choices (optional). Recipient via channel_identities (channel RCS).
POST https://{region}.conversation.api.sinch.com/v1/projects/{projectId}/messages:send with OAuth2, body: app_id, recipient, message.
On success: "✅ Carousel sent!" with message ID. Handle errors clearly.
Handle all errors gracefully.
Examples
/sinch-api-messages-send-carousel --to=+14155551234 --cards='[{"title":"Card 1","description":"First","image_url":"https://example.com/1.jpg"},{"title":"Card 2","description":"Second"}]'
API Reference
- API Endpoint: POST /v1/projects/{projectId}/messages:send
- Message type: carousel_message with cards array
- Documentation: https://developers.sinch.com/docs/conversation/message-types
Notes
- Carousels are best rendered on RCS. Other channels may receive a simplified version.
- Typically 2-10 cards per carousel; check channel limits.