Lewati ke konten

create_rcs_template

POST
/v1/agents/{agent_id}/templates
curl --request POST \
--url https://example.com/v1/agents/example/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "order_confirm_v1", "message_type": "TEXT_ONLY", "description": "Order confirmation", "content": { "text": "Hi {{1}}, your order {{2}} is confirmed.", "suggestions": [ { "reply": { "text": "Track", "postbackData": "track" } } ] }, "default_traffic_type": "TRANSACTION", "default_ttl_seconds": 86400 }'

Create a Mahadata RCS template (local catalogue; no Google review). Becomes ACTIVE immediately. Name is Meta-normalized (lowercase, underscores).

Request Payload Examples

1. TEXT_ONLY (Primary / Default)

{
  "name": "order_confirm_v1",
  "message_type": "TEXT_ONLY",
  "description": "Order confirmation text",
  "content": {
    "text": "Hi {{1}}, your order {{2}} is confirmed. Thank you!",
    "suggestions": [
      { "reply": { "text": "Thanks", "postbackData": "thanks" } },
      {
        "action": {
          "text": "Track order",
          "postbackData": "track",
          "openUrlAction": { "url": "https://example.com/track" }
        }
      }
    ]
  },
  "default_traffic_type": "TRANSACTION",
  "default_ttl_seconds": 86400
}

2. CARD (Nested card structure)

{
  "name": "promo_card_v1",
  "message_type": "CARD",
  "description": "Weekend promo card",
  "content": {
    "card": {
      "title": "Weekend promo",
      "description": "Save {{1}}% this weekend only",
      "orientation": "VERTICAL",
      "media": {
        "url": "https://cdn.example.com/promo.jpg",
        "height": "MEDIUM",
        "thumbnailUrl": "https://cdn.example.com/promo-thumb.jpg"
      },
      "suggestions": [
        {
          "action": {
            "text": "Shop now",
            "postbackData": "shop",
            "openUrlAction": { "url": "https://example.com/shop" }
          }
        },
        {
          "action": {
            "text": "Call us",
            "postbackData": "call",
            "dialAction": { "phoneNumber": "+6281234567890" }
          }
        }
      ]
    },
    "suggestions": [
      { "reply": { "text": "Not interested", "postbackData": "opt_out" } }
    ]
  },
  "default_traffic_type": "PROMOTION",
  "default_ttl_seconds": 172800
}
{
  "name": "product_carousel_v1",
  "message_type": "CAROUSEL",
  "description": "Two-product carousel",
  "content": {
    "carousel": {
      "cardWidth": "MEDIUM",
      "cards": [
        {
          "title": "Product A",
          "description": "From {{1}} IDR",
          "orientation": "VERTICAL",
          "media": {
            "url": "https://cdn.example.com/a.jpg",
            "height": "MEDIUM"
          },
          "suggestions": [
            {
              "action": {
                "text": "Buy A",
                "postbackData": "buy_a",
                "openUrlAction": { "url": "https://example.com/a" }
              }
            }
          ]
        },
        {
          "title": "Product B",
          "description": "From {{2}} IDR",
          "orientation": "VERTICAL",
          "media": {
            "url": "https://cdn.example.com/b.jpg",
            "height": "MEDIUM"
          },
          "suggestions": [
            {
              "action": {
                "text": "Buy B",
                "postbackData": "buy_b",
                "openUrlAction": { "url": "https://example.com/b" }
              }
            }
          ]
        }
      ]
    },
    "suggestions": [
      { "reply": { "text": "Talk to agent", "postbackData": "agent" } }
    ]
  },
  "default_traffic_type": "PROMOTION"
}

4. MEDIA_RICH_CARD (Media-first card, requires valid media URL)

{
  "name": "hero_media_v1",
  "message_type": "MEDIA_RICH_CARD",
  "description": "Hero image with caption",
  "content": {
    "card": {
      "title": "New collection",
      "description": "Tap to explore",
      "orientation": "VERTICAL",
      "media": {
        "url": "https://cdn.example.com/hero.jpg",
        "height": "TALL"
      },
      "suggestions": [
        {
          "action": {
            "text": "Open",
            "postbackData": "open_hero",
            "openUrlAction": { "url": "https://example.com/collection" }
          }
        }
      ]
    },
    "suggestions": []
  },
  "default_traffic_type": "PROMOTION"
}

Suggestions / Actions Catalogue

  • Reply: { "reply": { "text": "…", "postbackData": "…" } }
  • Open URL: { "action": { "text": "…", "postbackData": "…", "openUrlAction": { "url": "…" } } }
  • Dial Phone: { "action": { "text": "…", "postbackData": "…", "dialAction": { "phoneNumber": "…" } } }
  • View Location: { "action": { "text": "…", "postbackData": "…", "viewLocationAction": { "latLong": { "latitude": 0.0, "longitude": 0.0 }, "label": "…" } } }
  • Share Location: { "action": { "text": "…", "postbackData": "…", "shareLocationAction": {} } }
  • Create Calendar Event: { "action": { "text": "…", "postbackData": "…", "createCalendarEventAction": { "startTime": "2026-08-07T10:00:00Z", "endTime": "2026-08-07T11:00:00Z", "title": "Event" } } }
agent_id
required
string

The RCS Agent identifier (platform UUID or Google agent ID from GET /v1/channels).

Media type application/json

Create a Mahadata RCS template (local catalogue; no Google review). Becomes ACTIVE immediately. Name is Meta-normalized (lowercase, underscores).

object
content
required
object
default_traffic_type
string | null
default_ttl_seconds
integer | null format: int32
description
string | null
message_type
required
string
Allowed values: CARD CAROUSEL TEXT_ONLY MEDIA_RICH_CARD
name
required
string
rbm_agent_id

Optional; if set must match path agent.

string | null format: uuid
Example
{
"name": "order_confirm_v1",
"message_type": "TEXT_ONLY",
"description": "Order confirmation",
"content": {
"text": "Hi {{1}}, your order {{2}} is confirmed.",
"suggestions": [
{
"reply": {
"text": "Track",
"postbackData": "track"
}
}
]
},
"default_traffic_type": "TRANSACTION",
"default_ttl_seconds": 86400
}

RCS Template created successfully

Media type application/json
object
content
required
object
created_at
required
string format: date-time
default_traffic_type
string | null
default_ttl_seconds
integer | null format: int32
description
string | null
id
required
string format: uuid
message_type
required
string
Allowed values: CARD CAROUSEL TEXT_ONLY MEDIA_RICH_CARD
name
required
string
rbm_agent_id
required
string format: uuid
status
required
string
Allowed values: ACTIVE DELETED DRAFT
updated_at
required
string format: date-time
Example
{
"message_type": "CARD",
"status": "ACTIVE"
}

Invalid request or validation failure

RCS Agent not found