> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.chatbridge.mx/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.chatbridge.mx/_mcp/server.

# Send message

POST https://connect.chatbridge.mx/v1/rcs/messages
Content-Type: application/json

Sends an RCS message to a recipient. Two modes, selected with the `type` field: **template-based** (`type: TEMPLATE`, the default — combining a `template_id` and an `agent_id` of the account) and **free-form** (`type: TEXT | FILE | RICH_CARD | CAROUSEL`, with the content directly in the body and no template). The send is **asynchronous** in both modes: the API responds `202 Accepted` immediately with a `message_id`; the actual result (delivered / read / failed) and the user's interactions arrive later through webhooks, correlated by that `message_id`.

Validation rules (both modes):

* `to` must be exactly 10 digits, without the country code (the system prepends `52`).
* Variables: the `{{placeholders}}` — of the template, or written in the free-form content — are substituted with `variables`, all of them must be provided (`RCS_MISSING_VARIABLES` otherwise), variables of type URL (those placed in `fileUrl`/`thumbnailUrl`/`iconUrl`/`url`) must be valid `http`/`https` URLs (`RCS_INVALID_VARIABLE_FORMAT` otherwise), and `UUID_MESSAGE` is a **reserved name** rejected with `400` — it is resolved internally by the system.
* Referenced media (images/video) is validated with a real HEAD request: MIME type and size must comply with the RCS specifications (`RCS_INVALID_MEDIA_FILE` otherwise).

Template mode only:

* The agent and the template must belong to the account and be of the **same type** (`RCS_TYPE_MISMATCH` otherwise).

Free-form mode only:

* `template_id` is **forbidden** (and vice versa: it is required in `TEMPLATE` mode).
* One content per request → 1 credit.
* Content is validated against the **agent's type** instead of `RCS_TYPE_MISMATCH`: a `BASIC` agent only supports `type: TEXT` and no `suggestions` (RCS Basic has no buttons) — `RCS_CONTENT_TYPE_NOT_ALLOWED_FOR_AGENT` (376) / `RCS_SUGGESTIONS_NOT_ALLOWED` (377) otherwise; `SINGLE` and `CONVERSATIONAL` agents support the four content types and suggestions.
* Root-level `suggestions` (message-level chips, max 11) are independent from the `suggestions` embedded inside a card: they can be combined. Never send `postbackData` in a suggestion — the backend generates it.

Reference: https://docs.chatbridge.mx/rcs/messages/send-rcs-message

## Authentication

- `x-api-key` header (required) — Account authentication key. The App-Key must have the RCS channel enabled.
- `Authorization` header (bearer token, required) — OAuth 2.0 access token issued by `POST /api/oauth/token` (client-credentials). Takes precedence over `x-api-key` when both are sent. See the Authentication section.

## Request

### Body (application/json)

This endpoint expects a SendMessageRequest.

- `to` (string, required) — Destination number: exactly 10 digits, WITHOUT the country code (the system automatically prepends `52`).
- `agent_id` (string, required) — Agent identifier. It must be enabled (`status: true`). In template mode it must be of the SAME `type` as the template; in free-form mode the content is validated against the agent's type (a `BASIC` agent only supports `TEXT` without `suggestions`) and the billing channel (`RCS_BASIC` / `RCS_SINGLE` / `RCS_CONVERSATIONAL`) is derived from it.
- `type` (enum, optional, default: TEMPLATE) — Sending mode. `TEMPLATE` (the default when omitted) sends by template; the other four are free-form sends with the content directly in the body: `TEXT` (`text`), `FILE` (`contentInfo`), `RICH_CARD` (`richCard.standaloneCard`), `CAROUSEL` (`richCard.carouselCard`).
  - Allowed values: `TEMPLATE`, `TEXT`, `FILE`, `RICH_CARD`, `CAROUSEL`
- `template_id` (string, optional) — Template identifier. Required with `type: TEMPLATE` (it must exist, be active, and belong to the account of the App-Key); **forbidden** (400) with any free-form `type`.
- `text` (string, optional) — Free-form `TEXT` content. Required with `type: TEXT`, forbidden with any other `type`. Supports `{{placeholders}}` substituted with `variables`.
- `contentInfo` (FreeContentInfo, optional) — Free-form `FILE` content. Required with `type: FILE`, forbidden with any other `type`.
- `richCard` (SendMessageRequestRichCard, optional) — Free-form card content. With `type: RICH_CARD` it must carry `standaloneCard` (and `carouselCard` is forbidden); with `type: CAROUSEL` it must carry `carouselCard` (2 to 10 cards, and `standaloneCard` is forbidden). Forbidden with any other `type`.
- `suggestions` (list of FreeSuggestion, optional) — Message-level chips, only for the four free-form types (forbidden with `type: TEMPLATE`; also rejected with a `BASIC` agent — errorCode 377). Maximum 11. Independent from the `suggestions` embedded inside a card: they can be combined. Never send `postbackData`: the backend generates it.
- `variables` (map from string to string, optional) — Map `{ variable_name: value }`. In template mode, ALL the variables declared by the template must be sent; in free-form mode it substitutes the `{{placeholders}}` written in the body content, with the same type rules (URL in `fileUrl`/`thumbnailUrl`/`iconUrl`/`url`, free text elsewhere) and the same HEAD media validation. If any is missing, the request is rejected with `RCS_MISSING_VARIABLES` (errorCode 344). `UUID_MESSAGE` is a reserved name, rejected with `400` in every mode.
- `ttl_message` (integer, optional) — Optional, in minutes. Time during which delivery of the message is attempted before it expires. Default: provider default (~24 h). Maximum: 1440 (24 h).
- `ttl_events` (integer, optional) — Optional, in minutes. Window during which user interactions (clicks/replies) on this message are accepted. Default: 1440 (24 h). Maximum: 4320 (72 h). After the window, inbound events are discarded and NOT notified through webhooks.
- `fallback` (FallbackConfig, optional) — Optional SMS fallback for this send: if the RCS message is not delivered (its delivery status webhook reports `FAILED` or `EXPIRED`), the API automatically retries the same recipient over SMS with this content. A late `FAILED`/`EXPIRED` that the RCS status priority logic already discards (a suppressed downgrade, an out-of-order event) does NOT fire the fallback — only a failure that actually advances the message status does. It fires only **once** per message and it is a single hop (RCS → SMS, no further cascade). Requires the multichannel fallback to be enabled for the account (`errorCode` 380/381 otherwise). Applies the same in both sending modes.

## Response

### 202

Message accepted for delivery. Store `message_id`: it is the key to correlate every webhook of this send.

- `message_id` (string, optional) — Send identifier. Store it: it is the key to correlate every webhook of this send.
- `status` ("ACCEPTED", optional) — Initial status of the send.

## Errors

### 400 Bad Request Error

The request contains invalid data or violates an RCS channel rule. The `errorCode` distinguishes the cause; `metadata` carries the details (missing variables, mismatched types, invalid files).

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)
- `metadata` (map from string to any, optional)

### 401 Unauthorized Error

Authentication is missing or invalid.

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)
- `metadata` (map from string to any, optional)

### 403 Forbidden Error

The API Key does not have access to the RCS channel, or the request used the SMS fallback without the account meeting its requirements (`errorCode` 380/381).

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)
- `metadata` (map from string to any, optional)

### 404 Not Found Error

The template or the agent does not exist, is inactive, or does not belong to the account (`errorCode` 341 or 342).

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)
- `metadata` (map from string to any, optional)

### 429 Too Many Requests Error

The requests-per-minute limit was exceeded.

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)
- `metadata` (map from string to any, optional)

## Types

### FreeContentInfo

Media file reference. The URL must be a real, reachable `http`/`https` resource; it is validated with a HEAD request (MIME type and size).

- `fileUrl` (string, required) — Public URL of the file.
- `thumbnailUrl` (string, optional) — Optional thumbnail URL.
- `type` (enum, optional)
  - Allowed values: `IMAGE`, `VIDEO`

### SendMessageRequestRichCard

Free-form card content. With `type: RICH_CARD` it must carry `standaloneCard` (and `carouselCard` is forbidden); with `type: CAROUSEL` it must carry `carouselCard` (2 to 10 cards, and `standaloneCard` is forbidden). Forbidden with any other `type`.

- `standaloneCard` (FreeStandaloneCard, optional)
- `carouselCard` (FreeCarouselCard, optional)

### FreeSuggestion

Each element is `reply` **or** `action` (not both). Never send `postbackData` or `next_template_id`: the backend generates them.

- `reply` (FreeSuggestionReply, optional)
- `action` (FreeSuggestionAction, optional) — Carries `text` plus exactly one action: `openUrlAction` (`url`), `dialAction` (`phoneNumber`), `viewLocationAction` (`latLong`/`label`), `shareLocationAction`, or `createCalendarEventAction` (`startTime`, `endTime`, `title`, `description`).

### FallbackConfig

Optional SMS fallback for this send: if the RCS message is not delivered (its delivery status webhook reports `FAILED` or `EXPIRED`), the API automatically retries the same recipient over SMS with this content. A late `FAILED`/`EXPIRED` that the RCS status priority logic already discards (a suppressed downgrade, an out-of-order event) does NOT fire the fallback — only a failure that actually advances the message status does. It fires only **once** per message and it is a single hop (RCS → SMS, no further cascade). Requires the multichannel fallback to be enabled for the account (`errorCode` 380/381 otherwise). Applies the same in both sending modes.

- `sms` (FallbackSms, required) — Content of the backup SMS. Exactly the same shape as the body of `POST /v1/sms/messages` (`mask`, `text`, `has_accents`, `complement`) **except** `to` — the recipient is inherited from the original RCS message and is never sent in the fallback. The `mask` is validated at the moment of the original send (an invalid or disabled mask rejects the whole request with `400`), not when the fallback fires hours later.

### FreeStandaloneCard

- `cardOrientation` (enum, required)
  - Allowed values: `HORIZONTAL`, `VERTICAL`
- `cardContent` (FreeCardContent, required)

### FreeCarouselCard

- `cardWidth` (enum, required)
  - Allowed values: `SMALL`, `MEDIUM`, `LARGE`
- `cardContents` (list of FreeCardContent, required)

### FreeSuggestionReply

- `text` (string, optional)

### FreeSuggestionAction

Carries `text` plus exactly one action: `openUrlAction` (`url`), `dialAction` (`phoneNumber`), `viewLocationAction` (`latLong`/`label`), `shareLocationAction`, or `createCalendarEventAction` (`startTime`, `endTime`, `title`, `description`).

- `text` (string, optional)

### FallbackSms

Content of the backup SMS. Exactly the same shape as the body of `POST /v1/sms/messages` (`mask`, `text`, `has_accents`, `complement`) **except** `to` — the recipient is inherited from the original RCS message and is never sent in the fallback. The `mask` is validated at the moment of the original send (an invalid or disabled mask rejects the whole request with `400`), not when the fallback fires hours later.

- `mask` (string, required) — Sender mask identifier, obtained through `GET /v1/sms/masks`.
- `text` (string, required) — Text of the backup SMS.
- `has_accents` (boolean, optional, default: false) — Send `true` when the text contains accents, `ñ`, or other characters outside the GSM-7 alphabet (the SMS is encoded in UCS-2, which reduces the maximum size per segment).
- `complement` (FallbackSmsComplement, optional) — Appends a trackable short link to the end of the SMS text, generated automatically before sending.

### FreeCardContent

- `media` (FreeCardContentMedia, required)
- `title` (string, optional) — Maximum 200 characters after variable substitution.
- `description` (string, optional) — Maximum 2000 characters after variable substitution.
- `suggestions` (list of FreeSuggestion, optional) — Buttons INSIDE the card, independent from the message-level `suggestions`.

### FallbackSmsComplement

Appends a trackable short link to the end of the SMS text, generated automatically before sending.

- `link` (string, required) — Destination URL to shorten.
- `ttl_events` (integer, optional, default: 1440) — Validity of the short link for click tracking, in minutes. Minimum: 60 (1 hour); maximum: 4320 (72 hours). A value outside that range is rejected with `400`. Default: 1440 (24 hours).

### FreeCardContentMedia

- `height` (enum, required)
  - Allowed values: `SHORT`, `MEDIUM`, `TALL`
- `contentInfo` (FreeContentInfo, required) — Media file reference. The URL must be a real, reachable `http`/`https` resource; it is validated with a HEAD request (MIME type and size).

## Examples

### BASIC (text)

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": {
    "nombre": "Iván"
  }
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python BASIC (text)
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
    "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
    "variables": { "nombre": "Iván" }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript BASIC (text)
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9a","template_id":"665f1a2b3c4d5e6f7a8b9c0d","variables":{"nombre":"Iván"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go BASIC (text)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby BASIC (text)
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java BASIC (text)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}")
  .asString();
```

```php BASIC (text)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": {
    "nombre": "Iván"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp BASIC (text)
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift BASIC (text)
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": ["nombre": "Iván"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### SINGLE / CONVERSATIONAL (with media)

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "template_id": "665f1a2b3c4d5e6f7a8b9c1e",
  "variables": {
    "descripcion": "Descubre nuestros productos de temporada",
    "imagen": "https://cdn.tudominio.com/catalogo.jpg",
    "titulo": "Nuevo catálogo",
    "url_producto": "https://tienda.tudominio.com/producto/123"
  }
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python SINGLE / CONVERSATIONAL (with media)
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
    "template_id": "665f1a2b3c4d5e6f7a8b9c1e",
    "variables": {
        "descripcion": "Descubre nuestros productos de temporada",
        "imagen": "https://cdn.tudominio.com/catalogo.jpg",
        "titulo": "Nuevo catálogo",
        "url_producto": "https://tienda.tudominio.com/producto/123"
    }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript SINGLE / CONVERSATIONAL (with media)
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9b","template_id":"665f1a2b3c4d5e6f7a8b9c1e","variables":{"descripcion":"Descubre nuestros productos de temporada","imagen":"https://cdn.tudominio.com/catalogo.jpg","titulo":"Nuevo catálogo","url_producto":"https://tienda.tudominio.com/producto/123"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go SINGLE / CONVERSATIONAL (with media)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c1e\",\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby SINGLE / CONVERSATIONAL (with media)
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c1e\",\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java SINGLE / CONVERSATIONAL (with media)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c1e\",\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}")
  .asString();
```

```php SINGLE / CONVERSATIONAL (with media)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "template_id": "665f1a2b3c4d5e6f7a8b9c1e",
  "variables": {
    "descripcion": "Descubre nuestros productos de temporada",
    "imagen": "https://cdn.tudominio.com/catalogo.jpg",
    "titulo": "Nuevo catálogo",
    "url_producto": "https://tienda.tudominio.com/producto/123"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp SINGLE / CONVERSATIONAL (with media)
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c1e\",\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift SINGLE / CONVERSATIONAL (with media)
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "template_id": "665f1a2b3c4d5e6f7a8b9c1e",
  "variables": [
    "descripcion": "Descubre nuestros productos de temporada",
    "imagen": "https://cdn.tudominio.com/catalogo.jpg",
    "titulo": "Nuevo catálogo",
    "url_producto": "https://tienda.tudominio.com/producto/123"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### With custom TTLs

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": {
    "nombre": "Iván"
  },
  "ttl_message": 60,
  "ttl_events": 1440
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python With custom TTLs
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
    "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
    "variables": { "nombre": "Iván" },
    "ttl_message": 60,
    "ttl_events": 1440
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript With custom TTLs
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9a","template_id":"665f1a2b3c4d5e6f7a8b9c0d","variables":{"nombre":"Iván"},"ttl_message":60,"ttl_events":1440}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go With custom TTLs
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"ttl_message\": 60,\n  \"ttl_events\": 1440\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby With custom TTLs
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"ttl_message\": 60,\n  \"ttl_events\": 1440\n}"

response = http.request(request)
puts response.read_body
```

```java With custom TTLs
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"ttl_message\": 60,\n  \"ttl_events\": 1440\n}")
  .asString();
```

```php With custom TTLs
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": {
    "nombre": "Iván"
  },
  "ttl_message": 60,
  "ttl_events": 1440
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp With custom TTLs
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"ttl_message\": 60,\n  \"ttl_events\": 1440\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift With custom TTLs
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": ["nombre": "Iván"],
  "ttl_message": 60,
  "ttl_events": 1440
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Free-form: TEXT

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "type": "TEXT",
  "text": "Hola {{nombre}}, tu pedido va en camino.",
  "suggestions": [
    {
      "reply": {
        "text": "Rastrear"
      }
    },
    {
      "action": {
        "text": "Llamar",
        "dialAction": {
          "phoneNumber": "+525512345678"
        }
      }
    }
  ],
  "variables": {
    "nombre": "Iván"
  }
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python Free-form: TEXT
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
    "type": "TEXT",
    "text": "Hola {{nombre}}, tu pedido va en camino.",
    "suggestions": [{ "reply": { "text": "Rastrear" } }, { "action": {
                "text": "Llamar",
                "dialAction": { "phoneNumber": "+525512345678" }
            } }],
    "variables": { "nombre": "Iván" }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Free-form: TEXT
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9a","type":"TEXT","text":"Hola {{nombre}}, tu pedido va en camino.","suggestions":[{"reply":{"text":"Rastrear"}},{"action":{"text":"Llamar","dialAction":{"phoneNumber":"+525512345678"}}}],"variables":{"nombre":"Iván"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Free-form: TEXT
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"type\": \"TEXT\",\n  \"text\": \"Hola {{nombre}}, tu pedido va en camino.\",\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Rastrear\"\n      }\n    },\n    {\n      \"action\": {\n        \"text\": \"Llamar\",\n        \"dialAction\": {\n          \"phoneNumber\": \"+525512345678\"\n        }\n      }\n    }\n  ],\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Free-form: TEXT
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"type\": \"TEXT\",\n  \"text\": \"Hola {{nombre}}, tu pedido va en camino.\",\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Rastrear\"\n      }\n    },\n    {\n      \"action\": {\n        \"text\": \"Llamar\",\n        \"dialAction\": {\n          \"phoneNumber\": \"+525512345678\"\n        }\n      }\n    }\n  ],\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Free-form: TEXT
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"type\": \"TEXT\",\n  \"text\": \"Hola {{nombre}}, tu pedido va en camino.\",\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Rastrear\"\n      }\n    },\n    {\n      \"action\": {\n        \"text\": \"Llamar\",\n        \"dialAction\": {\n          \"phoneNumber\": \"+525512345678\"\n        }\n      }\n    }\n  ],\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}")
  .asString();
```

```php Free-form: TEXT
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "type": "TEXT",
  "text": "Hola {{nombre}}, tu pedido va en camino.",
  "suggestions": [
    {
      "reply": {
        "text": "Rastrear"
      }
    },
    {
      "action": {
        "text": "Llamar",
        "dialAction": {
          "phoneNumber": "+525512345678"
        }
      }
    }
  ],
  "variables": {
    "nombre": "Iván"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Free-form: TEXT
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"type\": \"TEXT\",\n  \"text\": \"Hola {{nombre}}, tu pedido va en camino.\",\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Rastrear\"\n      }\n    },\n    {\n      \"action\": {\n        \"text\": \"Llamar\",\n        \"dialAction\": {\n          \"phoneNumber\": \"+525512345678\"\n        }\n      }\n    }\n  ],\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Free-form: TEXT
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "type": "TEXT",
  "text": "Hola {{nombre}}, tu pedido va en camino.",
  "suggestions": [["reply": ["text": "Rastrear"]], ["action": [
        "text": "Llamar",
        "dialAction": ["phoneNumber": "+525512345678"]
      ]]],
  "variables": ["nombre": "Iván"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Free-form: FILE

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "FILE",
  "contentInfo": {
    "fileUrl": "https://cdn.tudominio.com/promo.jpg",
    "thumbnailUrl": "https://cdn.tudominio.com/promo.jpg",
    "type": "IMAGE"
  },
  "suggestions": [
    {
      "action": {
        "text": "Ver oferta",
        "openUrlAction": {
          "url": "https://tienda.tudominio.com/promo"
        }
      }
    }
  ]
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python Free-form: FILE
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
    "type": "FILE",
    "contentInfo": {
        "fileUrl": "https://cdn.tudominio.com/promo.jpg",
        "thumbnailUrl": "https://cdn.tudominio.com/promo.jpg",
        "type": "IMAGE"
    },
    "suggestions": [{ "action": {
                "text": "Ver oferta",
                "openUrlAction": { "url": "https://tienda.tudominio.com/promo" }
            } }]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Free-form: FILE
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9b","type":"FILE","contentInfo":{"fileUrl":"https://cdn.tudominio.com/promo.jpg","thumbnailUrl":"https://cdn.tudominio.com/promo.jpg","type":"IMAGE"},"suggestions":[{"action":{"text":"Ver oferta","openUrlAction":{"url":"https://tienda.tudominio.com/promo"}}}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Free-form: FILE
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"FILE\",\n  \"contentInfo\": {\n    \"fileUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"thumbnailUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"type\": \"IMAGE\"\n  },\n  \"suggestions\": [\n    {\n      \"action\": {\n        \"text\": \"Ver oferta\",\n        \"openUrlAction\": {\n          \"url\": \"https://tienda.tudominio.com/promo\"\n        }\n      }\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Free-form: FILE
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"FILE\",\n  \"contentInfo\": {\n    \"fileUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"thumbnailUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"type\": \"IMAGE\"\n  },\n  \"suggestions\": [\n    {\n      \"action\": {\n        \"text\": \"Ver oferta\",\n        \"openUrlAction\": {\n          \"url\": \"https://tienda.tudominio.com/promo\"\n        }\n      }\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Free-form: FILE
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"FILE\",\n  \"contentInfo\": {\n    \"fileUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"thumbnailUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"type\": \"IMAGE\"\n  },\n  \"suggestions\": [\n    {\n      \"action\": {\n        \"text\": \"Ver oferta\",\n        \"openUrlAction\": {\n          \"url\": \"https://tienda.tudominio.com/promo\"\n        }\n      }\n    }\n  ]\n}")
  .asString();
```

```php Free-form: FILE
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "FILE",
  "contentInfo": {
    "fileUrl": "https://cdn.tudominio.com/promo.jpg",
    "thumbnailUrl": "https://cdn.tudominio.com/promo.jpg",
    "type": "IMAGE"
  },
  "suggestions": [
    {
      "action": {
        "text": "Ver oferta",
        "openUrlAction": {
          "url": "https://tienda.tudominio.com/promo"
        }
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Free-form: FILE
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"FILE\",\n  \"contentInfo\": {\n    \"fileUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"thumbnailUrl\": \"https://cdn.tudominio.com/promo.jpg\",\n    \"type\": \"IMAGE\"\n  },\n  \"suggestions\": [\n    {\n      \"action\": {\n        \"text\": \"Ver oferta\",\n        \"openUrlAction\": {\n          \"url\": \"https://tienda.tudominio.com/promo\"\n        }\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Free-form: FILE
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "FILE",
  "contentInfo": [
    "fileUrl": "https://cdn.tudominio.com/promo.jpg",
    "thumbnailUrl": "https://cdn.tudominio.com/promo.jpg",
    "type": "IMAGE"
  ],
  "suggestions": [["action": [
        "text": "Ver oferta",
        "openUrlAction": ["url": "https://tienda.tudominio.com/promo"]
      ]]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Free-form: RICH_CARD

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "RICH_CARD",
  "richCard": {
    "standaloneCard": {
      "cardOrientation": "VERTICAL",
      "cardContent": {
        "media": {
          "height": "MEDIUM",
          "contentInfo": {
            "fileUrl": "{{imagen}}",
            "thumbnailUrl": "{{imagen}}",
            "type": "IMAGE"
          }
        },
        "title": "{{titulo}}",
        "description": "{{descripcion}}",
        "suggestions": [
          {
            "action": {
              "text": "Comprar",
              "openUrlAction": {
                "url": "{{url_producto}}"
              }
            }
          }
        ]
      }
    }
  },
  "suggestions": [
    {
      "reply": {
        "text": "Más info"
      }
    }
  ],
  "variables": {
    "descripcion": "Descubre nuestros productos de temporada",
    "imagen": "https://cdn.tudominio.com/catalogo.jpg",
    "titulo": "Nuevo catálogo",
    "url_producto": "https://tienda.tudominio.com/producto/123"
  }
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python Free-form: RICH_CARD
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
    "type": "RICH_CARD",
    "richCard": { "standaloneCard": {
            "cardOrientation": "VERTICAL",
            "cardContent": {
                "media": {
                    "height": "MEDIUM",
                    "contentInfo": {
                        "fileUrl": "{{imagen}}",
                        "thumbnailUrl": "{{imagen}}",
                        "type": "IMAGE"
                    }
                },
                "title": "{{titulo}}",
                "description": "{{descripcion}}",
                "suggestions": [{ "action": {
                            "text": "Comprar",
                            "openUrlAction": { "url": "{{url_producto}}" }
                        } }]
            }
        } },
    "suggestions": [{ "reply": { "text": "Más info" } }],
    "variables": {
        "descripcion": "Descubre nuestros productos de temporada",
        "imagen": "https://cdn.tudominio.com/catalogo.jpg",
        "titulo": "Nuevo catálogo",
        "url_producto": "https://tienda.tudominio.com/producto/123"
    }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Free-form: RICH_CARD
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9b","type":"RICH_CARD","richCard":{"standaloneCard":{"cardOrientation":"VERTICAL","cardContent":{"media":{"height":"MEDIUM","contentInfo":{"fileUrl":"{{imagen}}","thumbnailUrl":"{{imagen}}","type":"IMAGE"}},"title":"{{titulo}}","description":"{{descripcion}}","suggestions":[{"action":{"text":"Comprar","openUrlAction":{"url":"{{url_producto}}"}}}]}}},"suggestions":[{"reply":{"text":"Más info"}}],"variables":{"descripcion":"Descubre nuestros productos de temporada","imagen":"https://cdn.tudominio.com/catalogo.jpg","titulo":"Nuevo catálogo","url_producto":"https://tienda.tudominio.com/producto/123"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Free-form: RICH_CARD
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"RICH_CARD\",\n  \"richCard\": {\n    \"standaloneCard\": {\n      \"cardOrientation\": \"VERTICAL\",\n      \"cardContent\": {\n        \"media\": {\n          \"height\": \"MEDIUM\",\n          \"contentInfo\": {\n            \"fileUrl\": \"{{imagen}}\",\n            \"thumbnailUrl\": \"{{imagen}}\",\n            \"type\": \"IMAGE\"\n          }\n        },\n        \"title\": \"{{titulo}}\",\n        \"description\": \"{{descripcion}}\",\n        \"suggestions\": [\n          {\n            \"action\": {\n              \"text\": \"Comprar\",\n              \"openUrlAction\": {\n                \"url\": \"{{url_producto}}\"\n              }\n            }\n          }\n        ]\n      }\n    }\n  },\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Más info\"\n      }\n    }\n  ],\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Free-form: RICH_CARD
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"RICH_CARD\",\n  \"richCard\": {\n    \"standaloneCard\": {\n      \"cardOrientation\": \"VERTICAL\",\n      \"cardContent\": {\n        \"media\": {\n          \"height\": \"MEDIUM\",\n          \"contentInfo\": {\n            \"fileUrl\": \"{{imagen}}\",\n            \"thumbnailUrl\": \"{{imagen}}\",\n            \"type\": \"IMAGE\"\n          }\n        },\n        \"title\": \"{{titulo}}\",\n        \"description\": \"{{descripcion}}\",\n        \"suggestions\": [\n          {\n            \"action\": {\n              \"text\": \"Comprar\",\n              \"openUrlAction\": {\n                \"url\": \"{{url_producto}}\"\n              }\n            }\n          }\n        ]\n      }\n    }\n  },\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Más info\"\n      }\n    }\n  ],\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Free-form: RICH_CARD
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"RICH_CARD\",\n  \"richCard\": {\n    \"standaloneCard\": {\n      \"cardOrientation\": \"VERTICAL\",\n      \"cardContent\": {\n        \"media\": {\n          \"height\": \"MEDIUM\",\n          \"contentInfo\": {\n            \"fileUrl\": \"{{imagen}}\",\n            \"thumbnailUrl\": \"{{imagen}}\",\n            \"type\": \"IMAGE\"\n          }\n        },\n        \"title\": \"{{titulo}}\",\n        \"description\": \"{{descripcion}}\",\n        \"suggestions\": [\n          {\n            \"action\": {\n              \"text\": \"Comprar\",\n              \"openUrlAction\": {\n                \"url\": \"{{url_producto}}\"\n              }\n            }\n          }\n        ]\n      }\n    }\n  },\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Más info\"\n      }\n    }\n  ],\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}")
  .asString();
```

```php Free-form: RICH_CARD
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "RICH_CARD",
  "richCard": {
    "standaloneCard": {
      "cardOrientation": "VERTICAL",
      "cardContent": {
        "media": {
          "height": "MEDIUM",
          "contentInfo": {
            "fileUrl": "{{imagen}}",
            "thumbnailUrl": "{{imagen}}",
            "type": "IMAGE"
          }
        },
        "title": "{{titulo}}",
        "description": "{{descripcion}}",
        "suggestions": [
          {
            "action": {
              "text": "Comprar",
              "openUrlAction": {
                "url": "{{url_producto}}"
              }
            }
          }
        ]
      }
    }
  },
  "suggestions": [
    {
      "reply": {
        "text": "Más info"
      }
    }
  ],
  "variables": {
    "descripcion": "Descubre nuestros productos de temporada",
    "imagen": "https://cdn.tudominio.com/catalogo.jpg",
    "titulo": "Nuevo catálogo",
    "url_producto": "https://tienda.tudominio.com/producto/123"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Free-form: RICH_CARD
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"RICH_CARD\",\n  \"richCard\": {\n    \"standaloneCard\": {\n      \"cardOrientation\": \"VERTICAL\",\n      \"cardContent\": {\n        \"media\": {\n          \"height\": \"MEDIUM\",\n          \"contentInfo\": {\n            \"fileUrl\": \"{{imagen}}\",\n            \"thumbnailUrl\": \"{{imagen}}\",\n            \"type\": \"IMAGE\"\n          }\n        },\n        \"title\": \"{{titulo}}\",\n        \"description\": \"{{descripcion}}\",\n        \"suggestions\": [\n          {\n            \"action\": {\n              \"text\": \"Comprar\",\n              \"openUrlAction\": {\n                \"url\": \"{{url_producto}}\"\n              }\n            }\n          }\n        ]\n      }\n    }\n  },\n  \"suggestions\": [\n    {\n      \"reply\": {\n        \"text\": \"Más info\"\n      }\n    }\n  ],\n  \"variables\": {\n    \"descripcion\": \"Descubre nuestros productos de temporada\",\n    \"imagen\": \"https://cdn.tudominio.com/catalogo.jpg\",\n    \"titulo\": \"Nuevo catálogo\",\n    \"url_producto\": \"https://tienda.tudominio.com/producto/123\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Free-form: RICH_CARD
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "RICH_CARD",
  "richCard": ["standaloneCard": [
      "cardOrientation": "VERTICAL",
      "cardContent": [
        "media": [
          "height": "MEDIUM",
          "contentInfo": [
            "fileUrl": "{{imagen}}",
            "thumbnailUrl": "{{imagen}}",
            "type": "IMAGE"
          ]
        ],
        "title": "{{titulo}}",
        "description": "{{descripcion}}",
        "suggestions": [["action": [
              "text": "Comprar",
              "openUrlAction": ["url": "{{url_producto}}"]
            ]]]
      ]
    ]],
  "suggestions": [["reply": ["text": "Más info"]]],
  "variables": [
    "descripcion": "Descubre nuestros productos de temporada",
    "imagen": "https://cdn.tudominio.com/catalogo.jpg",
    "titulo": "Nuevo catálogo",
    "url_producto": "https://tienda.tudominio.com/producto/123"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Free-form: CAROUSEL

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "CAROUSEL",
  "richCard": {
    "carouselCard": {
      "cardWidth": "MEDIUM",
      "cardContents": [
        {
          "media": {
            "height": "MEDIUM",
            "contentInfo": {
              "fileUrl": "https://cdn.tudominio.com/a.jpg",
              "type": "IMAGE"
            }
          },
          "title": "Producto A",
          "description": "Desde $199",
          "suggestions": [
            {
              "action": {
                "text": "Ver A",
                "openUrlAction": {
                  "url": "https://tienda.tudominio.com/a"
                }
              }
            }
          ]
        },
        {
          "media": {
            "height": "MEDIUM",
            "contentInfo": {
              "fileUrl": "https://cdn.tudominio.com/b.jpg",
              "type": "IMAGE"
            }
          },
          "title": "Producto B",
          "description": "Desde $299",
          "suggestions": [
            {
              "action": {
                "text": "Ver B",
                "openUrlAction": {
                  "url": "https://tienda.tudominio.com/b"
                }
              }
            }
          ]
        }
      ]
    }
  }
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python Free-form: CAROUSEL
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
    "type": "CAROUSEL",
    "richCard": { "carouselCard": {
            "cardWidth": "MEDIUM",
            "cardContents": [
                {
                    "media": {
                        "height": "MEDIUM",
                        "contentInfo": {
                            "fileUrl": "https://cdn.tudominio.com/a.jpg",
                            "type": "IMAGE"
                        }
                    },
                    "title": "Producto A",
                    "description": "Desde $199",
                    "suggestions": [{ "action": {
                                "text": "Ver A",
                                "openUrlAction": { "url": "https://tienda.tudominio.com/a" }
                            } }]
                },
                {
                    "media": {
                        "height": "MEDIUM",
                        "contentInfo": {
                            "fileUrl": "https://cdn.tudominio.com/b.jpg",
                            "type": "IMAGE"
                        }
                    },
                    "title": "Producto B",
                    "description": "Desde $299",
                    "suggestions": [{ "action": {
                                "text": "Ver B",
                                "openUrlAction": { "url": "https://tienda.tudominio.com/b" }
                            } }]
                }
            ]
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Free-form: CAROUSEL
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9b","type":"CAROUSEL","richCard":{"carouselCard":{"cardWidth":"MEDIUM","cardContents":[{"media":{"height":"MEDIUM","contentInfo":{"fileUrl":"https://cdn.tudominio.com/a.jpg","type":"IMAGE"}},"title":"Producto A","description":"Desde $199","suggestions":[{"action":{"text":"Ver A","openUrlAction":{"url":"https://tienda.tudominio.com/a"}}}]},{"media":{"height":"MEDIUM","contentInfo":{"fileUrl":"https://cdn.tudominio.com/b.jpg","type":"IMAGE"}},"title":"Producto B","description":"Desde $299","suggestions":[{"action":{"text":"Ver B","openUrlAction":{"url":"https://tienda.tudominio.com/b"}}}]}]}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Free-form: CAROUSEL
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"CAROUSEL\",\n  \"richCard\": {\n    \"carouselCard\": {\n      \"cardWidth\": \"MEDIUM\",\n      \"cardContents\": [\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/a.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto A\",\n          \"description\": \"Desde $199\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver A\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/a\"\n                }\n              }\n            }\n          ]\n        },\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/b.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto B\",\n          \"description\": \"Desde $299\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver B\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/b\"\n                }\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Free-form: CAROUSEL
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"CAROUSEL\",\n  \"richCard\": {\n    \"carouselCard\": {\n      \"cardWidth\": \"MEDIUM\",\n      \"cardContents\": [\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/a.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto A\",\n          \"description\": \"Desde $199\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver A\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/a\"\n                }\n              }\n            }\n          ]\n        },\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/b.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto B\",\n          \"description\": \"Desde $299\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver B\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/b\"\n                }\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Free-form: CAROUSEL
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"CAROUSEL\",\n  \"richCard\": {\n    \"carouselCard\": {\n      \"cardWidth\": \"MEDIUM\",\n      \"cardContents\": [\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/a.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto A\",\n          \"description\": \"Desde $199\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver A\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/a\"\n                }\n              }\n            }\n          ]\n        },\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/b.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto B\",\n          \"description\": \"Desde $299\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver B\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/b\"\n                }\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}")
  .asString();
```

```php Free-form: CAROUSEL
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "CAROUSEL",
  "richCard": {
    "carouselCard": {
      "cardWidth": "MEDIUM",
      "cardContents": [
        {
          "media": {
            "height": "MEDIUM",
            "contentInfo": {
              "fileUrl": "https://cdn.tudominio.com/a.jpg",
              "type": "IMAGE"
            }
          },
          "title": "Producto A",
          "description": "Desde $199",
          "suggestions": [
            {
              "action": {
                "text": "Ver A",
                "openUrlAction": {
                  "url": "https://tienda.tudominio.com/a"
                }
              }
            }
          ]
        },
        {
          "media": {
            "height": "MEDIUM",
            "contentInfo": {
              "fileUrl": "https://cdn.tudominio.com/b.jpg",
              "type": "IMAGE"
            }
          },
          "title": "Producto B",
          "description": "Desde $299",
          "suggestions": [
            {
              "action": {
                "text": "Ver B",
                "openUrlAction": {
                  "url": "https://tienda.tudominio.com/b"
                }
              }
            }
          ]
        }
      ]
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Free-form: CAROUSEL
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9b\",\n  \"type\": \"CAROUSEL\",\n  \"richCard\": {\n    \"carouselCard\": {\n      \"cardWidth\": \"MEDIUM\",\n      \"cardContents\": [\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/a.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto A\",\n          \"description\": \"Desde $199\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver A\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/a\"\n                }\n              }\n            }\n          ]\n        },\n        {\n          \"media\": {\n            \"height\": \"MEDIUM\",\n            \"contentInfo\": {\n              \"fileUrl\": \"https://cdn.tudominio.com/b.jpg\",\n              \"type\": \"IMAGE\"\n            }\n          },\n          \"title\": \"Producto B\",\n          \"description\": \"Desde $299\",\n          \"suggestions\": [\n            {\n              \"action\": {\n                \"text\": \"Ver B\",\n                \"openUrlAction\": {\n                  \"url\": \"https://tienda.tudominio.com/b\"\n                }\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Free-form: CAROUSEL
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9b",
  "type": "CAROUSEL",
  "richCard": ["carouselCard": [
      "cardWidth": "MEDIUM",
      "cardContents": [
        [
          "media": [
            "height": "MEDIUM",
            "contentInfo": [
              "fileUrl": "https://cdn.tudominio.com/a.jpg",
              "type": "IMAGE"
            ]
          ],
          "title": "Producto A",
          "description": "Desde $199",
          "suggestions": [["action": [
                "text": "Ver A",
                "openUrlAction": ["url": "https://tienda.tudominio.com/a"]
              ]]]
        ],
        [
          "media": [
            "height": "MEDIUM",
            "contentInfo": [
              "fileUrl": "https://cdn.tudominio.com/b.jpg",
              "type": "IMAGE"
            ]
          ],
          "title": "Producto B",
          "description": "Desde $299",
          "suggestions": [["action": [
                "text": "Ver B",
                "openUrlAction": ["url": "https://tienda.tudominio.com/b"]
              ]]]
        ]
      ]
    ]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Template with SMS fallback

**Request**

```json
{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": {
    "nombre": "Iván"
  },
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por RCS. Tu pedido #1234 está confirmado."
    }
  }
}
```

**Response**

```json
{
  "message_id": "b3f1c2d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "status": "ACCEPTED"
}
```

**SDK Code**

```python Template with SMS fallback
import requests

url = "https://connect.chatbridge.mx/v1/rcs/messages"

payload = {
    "to": "5512345678",
    "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
    "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
    "variables": { "nombre": "Iván" },
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "No pudimos contactarte por RCS. Tu pedido #1234 está confirmado."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Template with SMS fallback
const url = 'https://connect.chatbridge.mx/v1/rcs/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"5512345678","agent_id":"665f1a2b3c4d5e6f7a8b9c9a","template_id":"665f1a2b3c4d5e6f7a8b9c0d","variables":{"nombre":"Iván"},"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"No pudimos contactarte por RCS. Tu pedido #1234 está confirmado."}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Template with SMS fallback
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/rcs/messages"

	payload := strings.NewReader("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por RCS. Tu pedido #1234 está confirmado.\"\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Template with SMS fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/rcs/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por RCS. Tu pedido #1234 está confirmado.\"\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Template with SMS fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/rcs/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por RCS. Tu pedido #1234 está confirmado.\"\n    }\n  }\n}")
  .asString();
```

```php Template with SMS fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/rcs/messages', [
  'body' => '{
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": {
    "nombre": "Iván"
  },
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por RCS. Tu pedido #1234 está confirmado."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Template with SMS fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/rcs/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"5512345678\",\n  \"agent_id\": \"665f1a2b3c4d5e6f7a8b9c9a\",\n  \"template_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n  \"variables\": {\n    \"nombre\": \"Iván\"\n  },\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por RCS. Tu pedido #1234 está confirmado.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Template with SMS fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "5512345678",
  "agent_id": "665f1a2b3c4d5e6f7a8b9c9a",
  "template_id": "665f1a2b3c4d5e6f7a8b9c0d",
  "variables": ["nombre": "Iván"],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por RCS. Tu pedido #1234 está confirmado."
    ]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/rcs/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```