> 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 batch

POST https://connect.chatbridge.mx/v1/whatsapp/batches
Content-Type: application/json

Sends the same message type to up to 250 recipients in a single request. The send is **asynchronous**: the API validates the request, responds `202 Accepted` immediately with a `batch_id` and one `message_id` per recipient (in the order of the request), and sends the messages in the background. Each recipient's result is notified through webhooks.

Only `type` (and the optional delivery settings) goes at the root; each item of `messages` carries the recipient (`to`) and the content of that `type`, with the same shape as `POST /v1/whatsapp/messages`. Validation is atomic: if any recipient is invalid the whole request is rejected and no message is sent. Per-number rules (format, numbering plan, operator output) are checked in the background and reported per recipient as `INVALID_FORMAT`, `INVALID_SOURCE` or `OUTPUT_NOT_FOUND`.

Limits: 250 recipients, 10 distinct templates (`errorCode` 577) and 50 distinct media URLs (`errorCode` 576) per batch; a media URL pointing to a private, loopback, link-local or cloud-metadata address is rejected with `errorCode` 575. A batch counts as a single request for the rate limit.

`webhook_mode` selects the notifications: `INDIVIDUAL` (default) sends the regular status webhook per recipient, with an extra `batch_id`; `BATCH` sends a single `batchStatus` webhook with the result of every recipient.

Reference: https://docs.chatbridge.mx/whats-app/messages/send-batch

## Authentication

- `x-api-key` header (required) — Account authentication key.
- `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 SendBatchRequest.

- `type` (enum, required) — Message type of the whole batch.
  - Allowed values: `TEXT`, `IMAGE`, `VIDEO`, `AUDIO`, `DOCUMENT`, `STICKER`, `LOCATION`, `CONTACTS`, `REACTION`, `INTERACTIVE`, `TEMPLATE`
- `messages` (list of BatchMessage, required)
- `webhook_mode` (enum, optional, default: INDIVIDUAL) — `INDIVIDUAL`: the regular status webhook per recipient, with `batch_id`. `BATCH`: a single `batchStatus` webhook for the whole batch.
  - Allowed values: `INDIVIDUAL`, `BATCH`
- `fallback` (FallbackConfig, optional) — Default SMS fallback for every recipient that does not carry its own. A per-recipient `fallback` replaces this one entirely.

## Response

### 202

Batch accepted and queued. Store `batch_id` and each recipient's `message_id`: they correlate the webhooks.

- `statusCode` (integer, optional)
- `message` ("ACCEPTED", optional)
- `batch_id` (string, optional) — Batch identifier.
- `webhook_mode` (enum, optional)
  - Allowed values: `INDIVIDUAL`, `BATCH`
- `total` (integer, optional) — Recipients received.
- `messages` (list of SendBatchResponseMessagesItems, optional) — One entry per recipient, in the order of the request.

## Errors

### 400 Bad Request Error

The request contains invalid data.

- `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 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 requested resource does not exist.

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

### 413 Content Too Large Error

The request body exceeds the maximum size allowed (~4 MB).

- `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)

### 500 Internal Server Error

Unhandled internal error, or the batch could not be queued. No message was sent; the request can be retried.

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

## Types

### BatchMessage

One recipient. Carries `to`, the content key of the batch `type` (same shape as `POST /v1/whatsapp/messages`) and, optionally, its own `fallback`.

- `to` (string, required) — Recipient in E.164 (`+5215512345678`) or a BSUID (`MX.1264908862298277`). A BSUID has no phone number, so it never gets a `fallback_id`.
- `text` (TextContent, optional)
- `image` (MediaContent, optional) — Provide `link` or `id`, but not both.
- `video` (MediaContent, optional) — Provide `link` or `id`, but not both.
- `audio` (AudioContent, optional) — Provide `link` or `id`, but not both.
- `document` (DocumentContent, optional) — Provide `link` or `id`, but not both.
- `sticker` (StickerContent, optional) — Provide `link` or `id`, but not both.
- `location` (Location, optional)
- `contacts` (list of Contact, optional)
- `reaction` (ReactionContent, optional) — Reaction to a previously sent or received message.
- `interactive` (Interactive, optional)
- `template` (TemplatePayload, optional) — Dynamic values for sending a template. `carousel` and `buttons` cannot coexist at the root.
- `fallback` (FallbackConfig, optional) — SMS fallback only for this recipient. Replaces the batch one entirely (fields are not merged).

### FallbackConfig

Optional SMS fallback for this send: if the WhatsApp message fails definitively (synchronously or through a status webhook), the API automatically retries the same recipient over SMS with this content. It fires only **once** per message (atomic lock: if the synchronous failure and a late webhook arrive almost simultaneously, only the first one triggers it) and it is a single hop — no further cascade. Requires the multichannel fallback to be enabled for the account (`errorCode` 380/381 otherwise). If `fallback` is not sent, behavior is exactly the current one.

- `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 WhatsApp 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` before attempting WhatsApp), not when the fallback fires.

### SendBatchResponseMessagesItems

- `to` (string, optional)
- `message_id` (string, optional) — Identifier of the message; it is the `message_id` the webhooks of this recipient carry (not Meta's `wamid`).
- `status` ("queued", optional)
- `fallback_id` (string, optional) — Only present when the recipient has an SMS fallback. It is the `message_id` of the SMS created if the WhatsApp message fails. A BSUID never has one.

### TextContent

- `body` (string, required) — Text message content.

### MediaContent

Provide `link` or `id`, but not both.

- `link` (string, optional) — Public URL of the resource.
- `id` (string, optional) — Meta media id of a previously uploaded resource (alternative to `link`).
- `caption` (string, optional) — Optional caption.

### AudioContent

Provide `link` or `id`, but not both.

- `link` (string, optional) — Public URL of the audio.
- `id` (string, optional) — Meta media id of a previously uploaded resource (alternative to `link`).

### DocumentContent

Provide `link` or `id`, but not both.

- `filename` (string, required) — File name with extension.
- `link` (string, optional) — Public URL of the document.
- `id` (string, optional) — Meta media id of a previously uploaded resource (alternative to `link`).
- `caption` (string, optional)

### StickerContent

Provide `link` or `id`, but not both.

- `link` (string, optional) — Public URL of the sticker in WebP format.
- `id` (string, optional) — Meta media id of a previously uploaded resource (alternative to `link`).

### Location

- `latitude` (double, optional)
- `longitude` (double, optional)
- `name` (string, optional)
- `address` (string, optional)

### Contact

- `name` (ContactName, optional)
- `phones` (list of ContactPhonesItems, optional)
- `emails` (list of ContactEmailsItems, optional)

### ReactionContent

Reaction to a previously sent or received message.

- `message_id` (string, required) — `message_id` (wamid) of the message being reacted to. For a message you sent that was answered with `status: queued` (queued send or batch) you can use the `message_id` identifier you received instead of the wamid. It must already have been sent; otherwise the request fails with `WHATSAPP_REFERENCED_MESSAGE_NOT_SENT`.
- `emoji` (string, required) — Reaction emoji.

### Interactive

- `type` (enum, optional)
  - Allowed values: `button`, `list`
- `body` (InteractiveBody, optional)
- `action` (InteractiveAction, optional) — Action structure. For `button` it contains `buttons`; for `list` it contains `button` and `sections`.

### TemplatePayload

Dynamic values for sending a template. `carousel` and `buttons` cannot coexist at the root.

- `_id` (string, required) — Template identifier.
- `header` (TemplatePayloadHeader, optional) — Header variables.
- `body` (list of TemplateVariable, optional)
- `buttons` (list of TemplatePayloadButtonsItems, optional)
- `carousel` (list of TemplatePayloadCarouselItems, optional)
- `otp` (TemplatePayloadOtp, 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 WhatsApp 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` before attempting WhatsApp), not when the fallback fires.

- `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.

### ContactName

- `formatted_name` (string, required)
- `first_name` (string, optional)
- `last_name` (string, optional)

### ContactPhonesItems

- `phone` (string, optional)
- `type` (string, optional)

### ContactEmailsItems

- `email` (string, optional)
- `type` (string, optional)

### InteractiveBody

- `text` (string, optional)

### InteractiveAction

Action structure. For `button` it contains `buttons`; for `list` it contains `button` and `sections`.

- `button` (string, optional)
- `buttons` (list of InteractiveActionButtonsItems, optional)
- `sections` (list of InteractiveActionSectionsItems, optional)

### TemplatePayloadHeader

Header variables.

- `text` (string, optional)
- `url` (string, optional)
- `location` (Location, optional)

### TemplateVariable

- `position` (integer, optional)
- `text` (string, optional)
- `name` (string, optional) — Variable name in templates with parameter_format NAMED.

### TemplatePayloadButtonsItems

- `index` (integer, optional)
- `text` (string, optional)
- `payload` (string, optional)

### TemplatePayloadCarouselItems

- `index` (integer, optional)
- `url` (string, optional)
- `body` (list of TemplateVariable, optional)
- `buttons` (list of TemplatePayloadCarouselItemsButtonsItems, optional)

### TemplatePayloadOtp

- `code` (string, optional)

### 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. Default: 1440 (24 hours).

### InteractiveActionButtonsItems

- `type` (string, optional)
- `reply` (InteractiveActionButtonsItemsReply, optional)

### InteractiveActionSectionsItems

- `title` (string, optional)
- `rows` (list of InteractiveActionSectionsItemsRowsItems, optional)

### TemplatePayloadCarouselItemsButtonsItems

- `index` (integer, optional)
- `text` (string, optional)

### InteractiveActionButtonsItemsReply

- `id` (string, optional)
- `title` (string, optional)

### InteractiveActionSectionsItemsRowsItems

- `id` (string, optional)
- `title` (string, optional)
- `description` (string, optional)

## Examples

### Fallback por destinatario (reemplaza al de la raíz)

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Ana"
          },
          {
            "position": 2,
            "text": "CLI-12345"
          }
        ]
      },
      "fallback": {
        "sms": {
          "mask": "665f1a2b3c4d5e6f7a8b9c0d",
          "text": "Hola Ana, tu pedido CLI-12345 está listo."
        }
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Luis"
          },
          {
            "position": 2,
            "text": "CLI-67890"
          }
        ]
      }
    },
    {
      "to": "MX.1264908862298277",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Eva"
          },
          {
            "position": 2,
            "text": "CLI-11111"
          }
        ]
      }
    }
  ],
  "webhook_mode": "BATCH",
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu pedido está listo."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python Fallback por destinatario (reemplaza al de la raíz)
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ac",
                "body": [
                    {
                        "position": 1,
                        "text": "Ana"
                    },
                    {
                        "position": 2,
                        "text": "CLI-12345"
                    }
                ]
            },
            "fallback": { "sms": {
                    "mask": "665f1a2b3c4d5e6f7a8b9c0d",
                    "text": "Hola Ana, tu pedido CLI-12345 está listo."
                } }
        },
        {
            "to": "+5215587654321",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ac",
                "body": [
                    {
                        "position": 1,
                        "text": "Luis"
                    },
                    {
                        "position": 2,
                        "text": "CLI-67890"
                    }
                ]
            }
        },
        {
            "to": "MX.1264908862298277",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ac",
                "body": [
                    {
                        "position": 1,
                        "text": "Eva"
                    },
                    {
                        "position": 2,
                        "text": "CLI-11111"
                    }
                ]
            }
        }
    ],
    "webhook_mode": "BATCH",
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tu pedido está listo."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Fallback por destinatario (reemplaza al de la raíz)
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Ana"},{"position":2,"text":"CLI-12345"}]},"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Hola Ana, tu pedido CLI-12345 está listo."}}},{"to":"+5215587654321","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Luis"},{"position":2,"text":"CLI-67890"}]}},{"to":"MX.1264908862298277","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Eva"},{"position":2,"text":"CLI-11111"}]}}],"webhook_mode":"BATCH","fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tu pedido está listo."}}}'
};

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

```go Fallback por destinatario (reemplaza al de la raíz)
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      },\n      \"fallback\": {\n        \"sms\": {\n          \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n          \"text\": \"Hola Ana, tu pedido CLI-12345 está listo.\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"MX.1264908862298277\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Eva\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-11111\"\n          }\n        ]\n      }\n    }\n  ],\n  \"webhook_mode\": \"BATCH\",\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido está listo.\"\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 Fallback por destinatario (reemplaza al de la raíz)
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      },\n      \"fallback\": {\n        \"sms\": {\n          \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n          \"text\": \"Hola Ana, tu pedido CLI-12345 está listo.\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"MX.1264908862298277\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Eva\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-11111\"\n          }\n        ]\n      }\n    }\n  ],\n  \"webhook_mode\": \"BATCH\",\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido está listo.\"\n    }\n  }\n}"

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

```java Fallback por destinatario (reemplaza al de la raíz)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      },\n      \"fallback\": {\n        \"sms\": {\n          \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n          \"text\": \"Hola Ana, tu pedido CLI-12345 está listo.\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"MX.1264908862298277\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Eva\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-11111\"\n          }\n        ]\n      }\n    }\n  ],\n  \"webhook_mode\": \"BATCH\",\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido está listo.\"\n    }\n  }\n}")
  .asString();
```

```php Fallback por destinatario (reemplaza al de la raíz)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Ana"
          },
          {
            "position": 2,
            "text": "CLI-12345"
          }
        ]
      },
      "fallback": {
        "sms": {
          "mask": "665f1a2b3c4d5e6f7a8b9c0d",
          "text": "Hola Ana, tu pedido CLI-12345 está listo."
        }
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Luis"
          },
          {
            "position": 2,
            "text": "CLI-67890"
          }
        ]
      }
    },
    {
      "to": "MX.1264908862298277",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Eva"
          },
          {
            "position": 2,
            "text": "CLI-11111"
          }
        ]
      }
    }
  ],
  "webhook_mode": "BATCH",
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu pedido está listo."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Fallback por destinatario (reemplaza al de la raíz)
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      },\n      \"fallback\": {\n        \"sms\": {\n          \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n          \"text\": \"Hola Ana, tu pedido CLI-12345 está listo.\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"MX.1264908862298277\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Eva\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-11111\"\n          }\n        ]\n      }\n    }\n  ],\n  \"webhook_mode\": \"BATCH\",\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido está listo.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Fallback por destinatario (reemplaza al de la raíz)
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          [
            "position": 1,
            "text": "Ana"
          ],
          [
            "position": 2,
            "text": "CLI-12345"
          ]
        ]
      ],
      "fallback": ["sms": [
          "mask": "665f1a2b3c4d5e6f7a8b9c0d",
          "text": "Hola Ana, tu pedido CLI-12345 está listo."
        ]]
    ],
    [
      "to": "+5215587654321",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          [
            "position": 1,
            "text": "Luis"
          ],
          [
            "position": 2,
            "text": "CLI-67890"
          ]
        ]
      ]
    ],
    [
      "to": "MX.1264908862298277",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          [
            "position": 1,
            "text": "Eva"
          ],
          [
            "position": 2,
            "text": "CLI-11111"
          ]
        ]
      ]
    ]
  ],
  "webhook_mode": "BATCH",
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu pedido está listo."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### TEXT, sin fallback

**Request**

```json
{
  "type": "TEXT",
  "messages": [
    {
      "to": "+5215512345678",
      "text": {
        "body": "Hola Ana, tu pedido va en camino."
      }
    },
    {
      "to": "+5215587654321",
      "text": {
        "body": "Hola Luis, tu pedido va en camino."
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEXT, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEXT",
    "messages": [
        {
            "to": "+5215512345678",
            "text": { "body": "Hola Ana, tu pedido va en camino." }
        },
        {
            "to": "+5215587654321",
            "text": { "body": "Hola Luis, tu pedido va en camino." }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEXT, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEXT","messages":[{"to":"+5215512345678","text":{"body":"Hola Ana, tu pedido va en camino."}},{"to":"+5215587654321","text":{"body":"Hola Luis, tu pedido va en camino."}}]}'
};

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

```go TEXT, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\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 TEXT, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\n      }\n    }\n  ]\n}"

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

```java TEXT, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php TEXT, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEXT",
  "messages": [
    {
      "to": "+5215512345678",
      "text": {
        "body": "Hola Ana, tu pedido va en camino."
      }
    },
    {
      "to": "+5215587654321",
      "text": {
        "body": "Hola Luis, tu pedido va en camino."
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEXT, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEXT, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEXT",
  "messages": [
    [
      "to": "+5215512345678",
      "text": ["body": "Hola Ana, tu pedido va en camino."]
    ],
    [
      "to": "+5215587654321",
      "text": ["body": "Hola Luis, tu pedido va en camino."]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### TEXT, con fallback a SMS en la raíz

**Request**

```json
{
  "type": "TEXT",
  "messages": [
    {
      "to": "+5215512345678",
      "text": {
        "body": "Hola Ana, tu pedido va en camino."
      }
    },
    {
      "to": "+5215587654321",
      "text": {
        "body": "Hola Luis, tu pedido va en camino."
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu pedido va en camino."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEXT, con fallback a SMS en la raíz
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEXT",
    "messages": [
        {
            "to": "+5215512345678",
            "text": { "body": "Hola Ana, tu pedido va en camino." }
        },
        {
            "to": "+5215587654321",
            "text": { "body": "Hola Luis, tu pedido va en camino." }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tu pedido va en camino."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEXT, con fallback a SMS en la raíz
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEXT","messages":[{"to":"+5215512345678","text":{"body":"Hola Ana, tu pedido va en camino."}},{"to":"+5215587654321","text":{"body":"Hola Luis, tu pedido va en camino."}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tu pedido va en camino."}}}'
};

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

```go TEXT, con fallback a SMS en la raíz
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido va en camino.\"\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 TEXT, con fallback a SMS en la raíz
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido va en camino.\"\n    }\n  }\n}"

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

```java TEXT, con fallback a SMS en la raíz
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido va en camino.\"\n    }\n  }\n}")
  .asString();
```

```php TEXT, con fallback a SMS en la raíz
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEXT",
  "messages": [
    {
      "to": "+5215512345678",
      "text": {
        "body": "Hola Ana, tu pedido va en camino."
      }
    },
    {
      "to": "+5215587654321",
      "text": {
        "body": "Hola Luis, tu pedido va en camino."
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu pedido va en camino."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEXT, con fallback a SMS en la raíz
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEXT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"text\": {\n        \"body\": \"Hola Ana, tu pedido va en camino.\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"text\": {\n        \"body\": \"Hola Luis, tu pedido va en camino.\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu pedido va en camino.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEXT, con fallback a SMS en la raíz
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEXT",
  "messages": [
    [
      "to": "+5215512345678",
      "text": ["body": "Hola Ana, tu pedido va en camino."]
    ],
    [
      "to": "+5215587654321",
      "text": ["body": "Hola Luis, tu pedido va en camino."]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu pedido va en camino."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### IMAGE, sin fallback

**Request**

```json
{
  "type": "IMAGE",
  "messages": [
    {
      "to": "+5215512345678",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-ana.jpg",
        "caption": "Hola Ana, tu promoción"
      }
    },
    {
      "to": "+5215587654321",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-luis.jpg",
        "caption": "Hola Luis, tu promoción"
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python IMAGE, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "IMAGE",
    "messages": [
        {
            "to": "+5215512345678",
            "image": {
                "link": "https://cdn.ejemplo.com/promo-ana.jpg",
                "caption": "Hola Ana, tu promoción"
            }
        },
        {
            "to": "+5215587654321",
            "image": {
                "link": "https://cdn.ejemplo.com/promo-luis.jpg",
                "caption": "Hola Luis, tu promoción"
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript IMAGE, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"IMAGE","messages":[{"to":"+5215512345678","image":{"link":"https://cdn.ejemplo.com/promo-ana.jpg","caption":"Hola Ana, tu promoción"}},{"to":"+5215587654321","image":{"link":"https://cdn.ejemplo.com/promo-luis.jpg","caption":"Hola Luis, tu promoción"}}]}'
};

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

```go IMAGE, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoció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 IMAGE, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoción\"\n      }\n    }\n  ]\n}"

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

```java IMAGE, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoción\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php IMAGE, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "IMAGE",
  "messages": [
    {
      "to": "+5215512345678",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-ana.jpg",
        "caption": "Hola Ana, tu promoción"
      }
    },
    {
      "to": "+5215587654321",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-luis.jpg",
        "caption": "Hola Luis, tu promoción"
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp IMAGE, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoción\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift IMAGE, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "IMAGE",
  "messages": [
    [
      "to": "+5215512345678",
      "image": [
        "link": "https://cdn.ejemplo.com/promo-ana.jpg",
        "caption": "Hola Ana, tu promoción"
      ]
    ],
    [
      "to": "+5215587654321",
      "image": [
        "link": "https://cdn.ejemplo.com/promo-luis.jpg",
        "caption": "Hola Luis, tu promoción"
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### IMAGE, con fallback

**Request**

```json
{
  "type": "IMAGE",
  "messages": [
    {
      "to": "+5215512345678",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-ana.jpg",
        "caption": "Hola Ana, tu promoción"
      }
    },
    {
      "to": "+5215587654321",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-luis.jpg",
        "caption": "Hola Luis, tu promoción"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes una nueva promoción esperándote.",
      "complement": {
        "link": "https://ejemplo.com/promo",
        "ttl_events": 1440
      }
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python IMAGE, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "IMAGE",
    "messages": [
        {
            "to": "+5215512345678",
            "image": {
                "link": "https://cdn.ejemplo.com/promo-ana.jpg",
                "caption": "Hola Ana, tu promoción"
            }
        },
        {
            "to": "+5215587654321",
            "image": {
                "link": "https://cdn.ejemplo.com/promo-luis.jpg",
                "caption": "Hola Luis, tu promoción"
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tienes una nueva promoción esperándote.",
            "complement": {
                "link": "https://ejemplo.com/promo",
                "ttl_events": 1440
            }
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript IMAGE, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"IMAGE","messages":[{"to":"+5215512345678","image":{"link":"https://cdn.ejemplo.com/promo-ana.jpg","caption":"Hola Ana, tu promoción"}},{"to":"+5215587654321","image":{"link":"https://cdn.ejemplo.com/promo-luis.jpg","caption":"Hola Luis, tu promoción"}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tienes una nueva promoción esperándote.","complement":{"link":"https://ejemplo.com/promo","ttl_events":1440}}}}'
};

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

```go IMAGE, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoción\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción esperándote.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/promo\",\n        \"ttl_events\": 1440\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 IMAGE, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoción\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción esperándote.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/promo\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}"

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

```java IMAGE, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoción\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción esperándote.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/promo\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}")
  .asString();
```

```php IMAGE, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "IMAGE",
  "messages": [
    {
      "to": "+5215512345678",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-ana.jpg",
        "caption": "Hola Ana, tu promoción"
      }
    },
    {
      "to": "+5215587654321",
      "image": {
        "link": "https://cdn.ejemplo.com/promo-luis.jpg",
        "caption": "Hola Luis, tu promoción"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes una nueva promoción esperándote.",
      "complement": {
        "link": "https://ejemplo.com/promo",
        "ttl_events": 1440
      }
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp IMAGE, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"IMAGE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-ana.jpg\",\n        \"caption\": \"Hola Ana, tu promoción\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"image\": {\n        \"link\": \"https://cdn.ejemplo.com/promo-luis.jpg\",\n        \"caption\": \"Hola Luis, tu promoción\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción esperándote.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/promo\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift IMAGE, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "IMAGE",
  "messages": [
    [
      "to": "+5215512345678",
      "image": [
        "link": "https://cdn.ejemplo.com/promo-ana.jpg",
        "caption": "Hola Ana, tu promoción"
      ]
    ],
    [
      "to": "+5215587654321",
      "image": [
        "link": "https://cdn.ejemplo.com/promo-luis.jpg",
        "caption": "Hola Luis, tu promoción"
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes una nueva promoción esperándote.",
      "complement": [
        "link": "https://ejemplo.com/promo",
        "ttl_events": 1440
      ]
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### VIDEO, sin fallback

**Request**

```json
{
  "type": "VIDEO",
  "messages": [
    {
      "to": "+5215512345678",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-ana.mp4",
        "caption": "Hola Ana, mira tu demostración"
      }
    },
    {
      "to": "+5215587654321",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-luis.mp4",
        "caption": "Hola Luis, mira tu demostración"
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python VIDEO, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "VIDEO",
    "messages": [
        {
            "to": "+5215512345678",
            "video": {
                "link": "https://cdn.ejemplo.com/demo-ana.mp4",
                "caption": "Hola Ana, mira tu demostración"
            }
        },
        {
            "to": "+5215587654321",
            "video": {
                "link": "https://cdn.ejemplo.com/demo-luis.mp4",
                "caption": "Hola Luis, mira tu demostración"
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript VIDEO, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"VIDEO","messages":[{"to":"+5215512345678","video":{"link":"https://cdn.ejemplo.com/demo-ana.mp4","caption":"Hola Ana, mira tu demostración"}},{"to":"+5215587654321","video":{"link":"https://cdn.ejemplo.com/demo-luis.mp4","caption":"Hola Luis, mira tu demostración"}}]}'
};

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

```go VIDEO, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostració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 VIDEO, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostración\"\n      }\n    }\n  ]\n}"

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

```java VIDEO, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostración\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php VIDEO, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "VIDEO",
  "messages": [
    {
      "to": "+5215512345678",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-ana.mp4",
        "caption": "Hola Ana, mira tu demostración"
      }
    },
    {
      "to": "+5215587654321",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-luis.mp4",
        "caption": "Hola Luis, mira tu demostración"
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp VIDEO, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostración\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift VIDEO, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "VIDEO",
  "messages": [
    [
      "to": "+5215512345678",
      "video": [
        "link": "https://cdn.ejemplo.com/demo-ana.mp4",
        "caption": "Hola Ana, mira tu demostración"
      ]
    ],
    [
      "to": "+5215587654321",
      "video": [
        "link": "https://cdn.ejemplo.com/demo-luis.mp4",
        "caption": "Hola Luis, mira tu demostración"
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### VIDEO, con fallback

**Request**

```json
{
  "type": "VIDEO",
  "messages": [
    {
      "to": "+5215512345678",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-ana.mp4",
        "caption": "Hola Ana, mira tu demostración"
      }
    },
    {
      "to": "+5215587654321",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-luis.mp4",
        "caption": "Hola Luis, mira tu demostración"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu video de demostración está listo.",
      "complement": {
        "link": "https://ejemplo.com/demo"
      }
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python VIDEO, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "VIDEO",
    "messages": [
        {
            "to": "+5215512345678",
            "video": {
                "link": "https://cdn.ejemplo.com/demo-ana.mp4",
                "caption": "Hola Ana, mira tu demostración"
            }
        },
        {
            "to": "+5215587654321",
            "video": {
                "link": "https://cdn.ejemplo.com/demo-luis.mp4",
                "caption": "Hola Luis, mira tu demostración"
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tu video de demostración está listo.",
            "complement": { "link": "https://ejemplo.com/demo" }
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript VIDEO, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"VIDEO","messages":[{"to":"+5215512345678","video":{"link":"https://cdn.ejemplo.com/demo-ana.mp4","caption":"Hola Ana, mira tu demostración"}},{"to":"+5215587654321","video":{"link":"https://cdn.ejemplo.com/demo-luis.mp4","caption":"Hola Luis, mira tu demostración"}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tu video de demostración está listo.","complement":{"link":"https://ejemplo.com/demo"}}}}'
};

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

```go VIDEO, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostración\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu video de demostración está listo.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/demo\"\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 VIDEO, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostración\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu video de demostración está listo.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/demo\"\n      }\n    }\n  }\n}"

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

```java VIDEO, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostración\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu video de demostración está listo.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/demo\"\n      }\n    }\n  }\n}")
  .asString();
```

```php VIDEO, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "VIDEO",
  "messages": [
    {
      "to": "+5215512345678",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-ana.mp4",
        "caption": "Hola Ana, mira tu demostración"
      }
    },
    {
      "to": "+5215587654321",
      "video": {
        "link": "https://cdn.ejemplo.com/demo-luis.mp4",
        "caption": "Hola Luis, mira tu demostración"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu video de demostración está listo.",
      "complement": {
        "link": "https://ejemplo.com/demo"
      }
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp VIDEO, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"VIDEO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-ana.mp4\",\n        \"caption\": \"Hola Ana, mira tu demostración\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"video\": {\n        \"link\": \"https://cdn.ejemplo.com/demo-luis.mp4\",\n        \"caption\": \"Hola Luis, mira tu demostración\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu video de demostración está listo.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/demo\"\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift VIDEO, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "VIDEO",
  "messages": [
    [
      "to": "+5215512345678",
      "video": [
        "link": "https://cdn.ejemplo.com/demo-ana.mp4",
        "caption": "Hola Ana, mira tu demostración"
      ]
    ],
    [
      "to": "+5215587654321",
      "video": [
        "link": "https://cdn.ejemplo.com/demo-luis.mp4",
        "caption": "Hola Luis, mira tu demostración"
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu video de demostración está listo.",
      "complement": ["link": "https://ejemplo.com/demo"]
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### AUDIO, sin fallback

**Request**

```json
{
  "type": "AUDIO",
  "messages": [
    {
      "to": "+5215512345678",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-ana.mp3"
      }
    },
    {
      "to": "+5215587654321",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-luis.mp3"
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python AUDIO, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "AUDIO",
    "messages": [
        {
            "to": "+5215512345678",
            "audio": { "link": "https://cdn.ejemplo.com/mensaje-ana.mp3" }
        },
        {
            "to": "+5215587654321",
            "audio": { "link": "https://cdn.ejemplo.com/mensaje-luis.mp3" }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript AUDIO, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"AUDIO","messages":[{"to":"+5215512345678","audio":{"link":"https://cdn.ejemplo.com/mensaje-ana.mp3"}},{"to":"+5215587654321","audio":{"link":"https://cdn.ejemplo.com/mensaje-luis.mp3"}}]}'
};

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

```go AUDIO, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\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 AUDIO, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\n      }\n    }\n  ]\n}"

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

```java AUDIO, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php AUDIO, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "AUDIO",
  "messages": [
    {
      "to": "+5215512345678",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-ana.mp3"
      }
    },
    {
      "to": "+5215587654321",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-luis.mp3"
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp AUDIO, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift AUDIO, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "AUDIO",
  "messages": [
    [
      "to": "+5215512345678",
      "audio": ["link": "https://cdn.ejemplo.com/mensaje-ana.mp3"]
    ],
    [
      "to": "+5215587654321",
      "audio": ["link": "https://cdn.ejemplo.com/mensaje-luis.mp3"]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### AUDIO, con fallback

**Request**

```json
{
  "type": "AUDIO",
  "messages": [
    {
      "to": "+5215512345678",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-ana.mp3"
      }
    },
    {
      "to": "+5215587654321",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-luis.mp3"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python AUDIO, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "AUDIO",
    "messages": [
        {
            "to": "+5215512345678",
            "audio": { "link": "https://cdn.ejemplo.com/mensaje-ana.mp3" }
        },
        {
            "to": "+5215587654321",
            "audio": { "link": "https://cdn.ejemplo.com/mensaje-luis.mp3" }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript AUDIO, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"AUDIO","messages":[{"to":"+5215512345678","audio":{"link":"https://cdn.ejemplo.com/mensaje-ana.mp3"}},{"to":"+5215587654321","audio":{"link":"https://cdn.ejemplo.com/mensaje-luis.mp3"}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo."}}}'
};

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

```go AUDIO, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo.\"\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 AUDIO, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo.\"\n    }\n  }\n}"

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

```java AUDIO, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo.\"\n    }\n  }\n}")
  .asString();
```

```php AUDIO, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "AUDIO",
  "messages": [
    {
      "to": "+5215512345678",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-ana.mp3"
      }
    },
    {
      "to": "+5215587654321",
      "audio": {
        "link": "https://cdn.ejemplo.com/mensaje-luis.mp3"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp AUDIO, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"AUDIO\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-ana.mp3\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"audio\": {\n        \"link\": \"https://cdn.ejemplo.com/mensaje-luis.mp3\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift AUDIO, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "AUDIO",
  "messages": [
    [
      "to": "+5215512345678",
      "audio": ["link": "https://cdn.ejemplo.com/mensaje-ana.mp3"]
    ],
    [
      "to": "+5215587654321",
      "audio": ["link": "https://cdn.ejemplo.com/mensaje-luis.mp3"]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes un nuevo mensaje de voz. Abre WhatsApp para escucharlo."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### DOCUMENT, sin fallback

**Request**

```json
{
  "type": "DOCUMENT",
  "messages": [
    {
      "to": "+5215512345678",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-ana.pdf",
        "caption": "Hola Ana, tu factura"
      }
    },
    {
      "to": "+5215587654321",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-luis.pdf",
        "caption": "Hola Luis, tu factura"
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python DOCUMENT, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "DOCUMENT",
    "messages": [
        {
            "to": "+5215512345678",
            "document": {
                "filename": "factura_octubre_2026.pdf",
                "link": "https://cdn.ejemplo.com/factura-ana.pdf",
                "caption": "Hola Ana, tu factura"
            }
        },
        {
            "to": "+5215587654321",
            "document": {
                "filename": "factura_octubre_2026.pdf",
                "link": "https://cdn.ejemplo.com/factura-luis.pdf",
                "caption": "Hola Luis, tu factura"
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript DOCUMENT, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"DOCUMENT","messages":[{"to":"+5215512345678","document":{"filename":"factura_octubre_2026.pdf","link":"https://cdn.ejemplo.com/factura-ana.pdf","caption":"Hola Ana, tu factura"}},{"to":"+5215587654321","document":{"filename":"factura_octubre_2026.pdf","link":"https://cdn.ejemplo.com/factura-luis.pdf","caption":"Hola Luis, tu factura"}}]}'
};

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

```go DOCUMENT, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\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 DOCUMENT, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\n      }\n    }\n  ]\n}"

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

```java DOCUMENT, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php DOCUMENT, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "DOCUMENT",
  "messages": [
    {
      "to": "+5215512345678",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-ana.pdf",
        "caption": "Hola Ana, tu factura"
      }
    },
    {
      "to": "+5215587654321",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-luis.pdf",
        "caption": "Hola Luis, tu factura"
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp DOCUMENT, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift DOCUMENT, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "DOCUMENT",
  "messages": [
    [
      "to": "+5215512345678",
      "document": [
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-ana.pdf",
        "caption": "Hola Ana, tu factura"
      ]
    ],
    [
      "to": "+5215587654321",
      "document": [
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-luis.pdf",
        "caption": "Hola Luis, tu factura"
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### DOCUMENT, con fallback

**Request**

```json
{
  "type": "DOCUMENT",
  "messages": [
    {
      "to": "+5215512345678",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-ana.pdf",
        "caption": "Hola Ana, tu factura"
      }
    },
    {
      "to": "+5215587654321",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-luis.pdf",
        "caption": "Hola Luis, tu factura"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu factura de octubre ya está disponible.",
      "complement": {
        "link": "https://ejemplo.com/facturas",
        "ttl_events": 1440
      }
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python DOCUMENT, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "DOCUMENT",
    "messages": [
        {
            "to": "+5215512345678",
            "document": {
                "filename": "factura_octubre_2026.pdf",
                "link": "https://cdn.ejemplo.com/factura-ana.pdf",
                "caption": "Hola Ana, tu factura"
            }
        },
        {
            "to": "+5215587654321",
            "document": {
                "filename": "factura_octubre_2026.pdf",
                "link": "https://cdn.ejemplo.com/factura-luis.pdf",
                "caption": "Hola Luis, tu factura"
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tu factura de octubre ya está disponible.",
            "complement": {
                "link": "https://ejemplo.com/facturas",
                "ttl_events": 1440
            }
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript DOCUMENT, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"DOCUMENT","messages":[{"to":"+5215512345678","document":{"filename":"factura_octubre_2026.pdf","link":"https://cdn.ejemplo.com/factura-ana.pdf","caption":"Hola Ana, tu factura"}},{"to":"+5215587654321","document":{"filename":"factura_octubre_2026.pdf","link":"https://cdn.ejemplo.com/factura-luis.pdf","caption":"Hola Luis, tu factura"}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tu factura de octubre ya está disponible.","complement":{"link":"https://ejemplo.com/facturas","ttl_events":1440}}}}'
};

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

```go DOCUMENT, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu factura de octubre ya está disponible.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/facturas\",\n        \"ttl_events\": 1440\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 DOCUMENT, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu factura de octubre ya está disponible.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/facturas\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}"

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

```java DOCUMENT, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu factura de octubre ya está disponible.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/facturas\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}")
  .asString();
```

```php DOCUMENT, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "DOCUMENT",
  "messages": [
    {
      "to": "+5215512345678",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-ana.pdf",
        "caption": "Hola Ana, tu factura"
      }
    },
    {
      "to": "+5215587654321",
      "document": {
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-luis.pdf",
        "caption": "Hola Luis, tu factura"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu factura de octubre ya está disponible.",
      "complement": {
        "link": "https://ejemplo.com/facturas",
        "ttl_events": 1440
      }
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp DOCUMENT, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"DOCUMENT\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-ana.pdf\",\n        \"caption\": \"Hola Ana, tu factura\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"document\": {\n        \"filename\": \"factura_octubre_2026.pdf\",\n        \"link\": \"https://cdn.ejemplo.com/factura-luis.pdf\",\n        \"caption\": \"Hola Luis, tu factura\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu factura de octubre ya está disponible.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/facturas\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift DOCUMENT, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "DOCUMENT",
  "messages": [
    [
      "to": "+5215512345678",
      "document": [
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-ana.pdf",
        "caption": "Hola Ana, tu factura"
      ]
    ],
    [
      "to": "+5215587654321",
      "document": [
        "filename": "factura_octubre_2026.pdf",
        "link": "https://cdn.ejemplo.com/factura-luis.pdf",
        "caption": "Hola Luis, tu factura"
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu factura de octubre ya está disponible.",
      "complement": [
        "link": "https://ejemplo.com/facturas",
        "ttl_events": 1440
      ]
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### LOCATION, sin fallback

**Request**

```json
{
  "type": "LOCATION",
  "messages": [
    {
      "to": "+5215512345678",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    },
    {
      "to": "+5215587654321",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python LOCATION, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "LOCATION",
    "messages": [
        {
            "to": "+5215512345678",
            "location": {
                "latitude": 19.432608,
                "longitude": -99.133209,
                "name": "Sucursal Centro",
                "address": "Centro Histórico, Ciudad de México"
            }
        },
        {
            "to": "+5215587654321",
            "location": {
                "latitude": 19.432608,
                "longitude": -99.133209,
                "name": "Sucursal Centro",
                "address": "Centro Histórico, Ciudad de México"
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript LOCATION, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"LOCATION","messages":[{"to":"+5215512345678","location":{"latitude":19.432608,"longitude":-99.133209,"name":"Sucursal Centro","address":"Centro Histórico, Ciudad de México"}},{"to":"+5215587654321","location":{"latitude":19.432608,"longitude":-99.133209,"name":"Sucursal Centro","address":"Centro Histórico, Ciudad de México"}}]}'
};

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

```go LOCATION, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\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 LOCATION, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    }\n  ]\n}"

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

```java LOCATION, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php LOCATION, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "LOCATION",
  "messages": [
    {
      "to": "+5215512345678",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    },
    {
      "to": "+5215587654321",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp LOCATION, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift LOCATION, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "LOCATION",
  "messages": [
    [
      "to": "+5215512345678",
      "location": [
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      ]
    ],
    [
      "to": "+5215587654321",
      "location": [
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### LOCATION, con fallback

**Request**

```json
{
  "type": "LOCATION",
  "messages": [
    {
      "to": "+5215512345678",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    },
    {
      "to": "+5215587654321",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python LOCATION, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "LOCATION",
    "messages": [
        {
            "to": "+5215512345678",
            "location": {
                "latitude": 19.432608,
                "longitude": -99.133209,
                "name": "Sucursal Centro",
                "address": "Centro Histórico, Ciudad de México"
            }
        },
        {
            "to": "+5215587654321",
            "location": {
                "latitude": 19.432608,
                "longitude": -99.133209,
                "name": "Sucursal Centro",
                "address": "Centro Histórico, Ciudad de México"
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript LOCATION, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"LOCATION","messages":[{"to":"+5215512345678","location":{"latitude":19.432608,"longitude":-99.133209,"name":"Sucursal Centro","address":"Centro Histórico, Ciudad de México"}},{"to":"+5215587654321","location":{"latitude":19.432608,"longitude":-99.133209,"name":"Sucursal Centro","address":"Centro Histórico, Ciudad de México"}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico."}}}'
};

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

```go LOCATION, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico.\"\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 LOCATION, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico.\"\n    }\n  }\n}"

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

```java LOCATION, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico.\"\n    }\n  }\n}")
  .asString();
```

```php LOCATION, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "LOCATION",
  "messages": [
    {
      "to": "+5215512345678",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    },
    {
      "to": "+5215587654321",
      "location": {
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp LOCATION, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"LOCATION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"location\": {\n        \"latitude\": 19.432608,\n        \"longitude\": -99.133209,\n        \"name\": \"Sucursal Centro\",\n        \"address\": \"Centro Histórico, Ciudad de México\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift LOCATION, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "LOCATION",
  "messages": [
    [
      "to": "+5215512345678",
      "location": [
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      ]
    ],
    [
      "to": "+5215587654321",
      "location": [
        "latitude": 19.432608,
        "longitude": -99.133209,
        "name": "Sucursal Centro",
        "address": "Centro Histórico, Ciudad de México"
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Visítanos en la Sucursal Centro: Centro Historico, Ciudad de Mexico."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### CONTACTS, sin fallback

**Request**

```json
{
  "type": "CONTACTS",
  "messages": [
    {
      "to": "+5215512345678",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    },
    {
      "to": "+5215587654321",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python CONTACTS, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "CONTACTS",
    "messages": [
        {
            "to": "+5215512345678",
            "contacts": [
                {
                    "name": {
                        "formatted_name": "Juan Pérez",
                        "first_name": "Juan",
                        "last_name": "Pérez"
                    },
                    "phones": [
                        {
                            "phone": "+5215512340000",
                            "type": "MOBILE"
                        }
                    ],
                    "emails": [
                        {
                            "email": "juan@ejemplo.com",
                            "type": "WORK"
                        }
                    ]
                }
            ]
        },
        {
            "to": "+5215587654321",
            "contacts": [
                {
                    "name": {
                        "formatted_name": "Juan Pérez",
                        "first_name": "Juan",
                        "last_name": "Pérez"
                    },
                    "phones": [
                        {
                            "phone": "+5215512340000",
                            "type": "MOBILE"
                        }
                    ],
                    "emails": [
                        {
                            "email": "juan@ejemplo.com",
                            "type": "WORK"
                        }
                    ]
                }
            ]
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript CONTACTS, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"CONTACTS","messages":[{"to":"+5215512345678","contacts":[{"name":{"formatted_name":"Juan Pérez","first_name":"Juan","last_name":"Pérez"},"phones":[{"phone":"+5215512340000","type":"MOBILE"}],"emails":[{"email":"juan@ejemplo.com","type":"WORK"}]}]},{"to":"+5215587654321","contacts":[{"name":{"formatted_name":"Juan Pérez","first_name":"Juan","last_name":"Pérez"},"phones":[{"phone":"+5215512340000","type":"MOBILE"}],"emails":[{"email":"juan@ejemplo.com","type":"WORK"}]}]}]}'
};

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

```go CONTACTS, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\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 CONTACTS, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"

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

```java CONTACTS, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}")
  .asString();
```

```php CONTACTS, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "CONTACTS",
  "messages": [
    {
      "to": "+5215512345678",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    },
    {
      "to": "+5215587654321",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp CONTACTS, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift CONTACTS, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "CONTACTS",
  "messages": [
    [
      "to": "+5215512345678",
      "contacts": [
        [
          "name": [
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          ],
          "phones": [
            [
              "phone": "+5215512340000",
              "type": "MOBILE"
            ]
          ],
          "emails": [
            [
              "email": "juan@ejemplo.com",
              "type": "WORK"
            ]
          ]
        ]
      ]
    ],
    [
      "to": "+5215587654321",
      "contacts": [
        [
          "name": [
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          ],
          "phones": [
            [
              "phone": "+5215512340000",
              "type": "MOBILE"
            ]
          ],
          "emails": [
            [
              "email": "juan@ejemplo.com",
              "type": "WORK"
            ]
          ]
        ]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### CONTACTS, con fallback

**Request**

```json
{
  "type": "CONTACTS",
  "messages": [
    {
      "to": "+5215512345678",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    },
    {
      "to": "+5215587654321",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python CONTACTS, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "CONTACTS",
    "messages": [
        {
            "to": "+5215512345678",
            "contacts": [
                {
                    "name": {
                        "formatted_name": "Juan Pérez",
                        "first_name": "Juan",
                        "last_name": "Pérez"
                    },
                    "phones": [
                        {
                            "phone": "+5215512340000",
                            "type": "MOBILE"
                        }
                    ],
                    "emails": [
                        {
                            "email": "juan@ejemplo.com",
                            "type": "WORK"
                        }
                    ]
                }
            ]
        },
        {
            "to": "+5215587654321",
            "contacts": [
                {
                    "name": {
                        "formatted_name": "Juan Pérez",
                        "first_name": "Juan",
                        "last_name": "Pérez"
                    },
                    "phones": [
                        {
                            "phone": "+5215512340000",
                            "type": "MOBILE"
                        }
                    ],
                    "emails": [
                        {
                            "email": "juan@ejemplo.com",
                            "type": "WORK"
                        }
                    ]
                }
            ]
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript CONTACTS, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"CONTACTS","messages":[{"to":"+5215512345678","contacts":[{"name":{"formatted_name":"Juan Pérez","first_name":"Juan","last_name":"Pérez"},"phones":[{"phone":"+5215512340000","type":"MOBILE"}],"emails":[{"email":"juan@ejemplo.com","type":"WORK"}]}]},{"to":"+5215587654321","contacts":[{"name":{"formatted_name":"Juan Pérez","first_name":"Juan","last_name":"Pérez"},"phones":[{"phone":"+5215512340000","type":"MOBILE"}],"emails":[{"email":"juan@ejemplo.com","type":"WORK"}]}]}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000."}}}'
};

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

```go CONTACTS, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000.\"\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 CONTACTS, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000.\"\n    }\n  }\n}"

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

```java CONTACTS, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000.\"\n    }\n  }\n}")
  .asString();
```

```php CONTACTS, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "CONTACTS",
  "messages": [
    {
      "to": "+5215512345678",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    },
    {
      "to": "+5215587654321",
      "contacts": [
        {
          "name": {
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          },
          "phones": [
            {
              "phone": "+5215512340000",
              "type": "MOBILE"
            }
          ],
          "emails": [
            {
              "email": "juan@ejemplo.com",
              "type": "WORK"
            }
          ]
        }
      ]
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp CONTACTS, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"CONTACTS\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"contacts\": [\n        {\n          \"name\": {\n            \"formatted_name\": \"Juan Pérez\",\n            \"first_name\": \"Juan\",\n            \"last_name\": \"Pérez\"\n          },\n          \"phones\": [\n            {\n              \"phone\": \"+5215512340000\",\n              \"type\": \"MOBILE\"\n            }\n          ],\n          \"emails\": [\n            {\n              \"email\": \"juan@ejemplo.com\",\n              \"type\": \"WORK\"\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift CONTACTS, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "CONTACTS",
  "messages": [
    [
      "to": "+5215512345678",
      "contacts": [
        [
          "name": [
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          ],
          "phones": [
            [
              "phone": "+5215512340000",
              "type": "MOBILE"
            ]
          ],
          "emails": [
            [
              "email": "juan@ejemplo.com",
              "type": "WORK"
            ]
          ]
        ]
      ]
    ],
    [
      "to": "+5215587654321",
      "contacts": [
        [
          "name": [
            "formatted_name": "Juan Pérez",
            "first_name": "Juan",
            "last_name": "Pérez"
          ],
          "phones": [
            [
              "phone": "+5215512340000",
              "type": "MOBILE"
            ]
          ],
          "emails": [
            [
              "email": "juan@ejemplo.com",
              "type": "WORK"
            ]
          ]
        ]
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tu ejecutivo de cuenta es Juan Perez, tel. 55 1234 0000."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### REACTION, sin fallback

**Request**

```json
{
  "type": "REACTION",
  "messages": [
    {
      "to": "+5215512345678",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
        "emoji": "👍"
      }
    },
    {
      "to": "+5215587654321",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
        "emoji": "👍"
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python REACTION, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "REACTION",
    "messages": [
        {
            "to": "+5215512345678",
            "reaction": {
                "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
                "emoji": "👍"
            }
        },
        {
            "to": "+5215587654321",
            "reaction": {
                "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
                "emoji": "👍"
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript REACTION, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"REACTION","messages":[{"to":"+5215512345678","reaction":{"message_id":"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5","emoji":"👍"}},{"to":"+5215587654321","reaction":{"message_id":"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE","emoji":"👍"}}]}'
};

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

```go REACTION, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\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 REACTION, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\n      }\n    }\n  ]\n}"

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

```java REACTION, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php REACTION, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "REACTION",
  "messages": [
    {
      "to": "+5215512345678",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
        "emoji": "👍"
      }
    },
    {
      "to": "+5215587654321",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
        "emoji": "👍"
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp REACTION, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift REACTION, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "REACTION",
  "messages": [
    [
      "to": "+5215512345678",
      "reaction": [
        "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
        "emoji": "👍"
      ]
    ],
    [
      "to": "+5215587654321",
      "reaction": [
        "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
        "emoji": "👍"
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### REACTION, con fallback

**Request**

```json
{
  "type": "REACTION",
  "messages": [
    {
      "to": "+5215512345678",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
        "emoji": "👍"
      }
    },
    {
      "to": "+5215587654321",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
        "emoji": "👍"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Recibimos tu mensaje. Gracias."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python REACTION, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "REACTION",
    "messages": [
        {
            "to": "+5215512345678",
            "reaction": {
                "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
                "emoji": "👍"
            }
        },
        {
            "to": "+5215587654321",
            "reaction": {
                "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
                "emoji": "👍"
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Recibimos tu mensaje. Gracias."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript REACTION, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"REACTION","messages":[{"to":"+5215512345678","reaction":{"message_id":"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5","emoji":"👍"}},{"to":"+5215587654321","reaction":{"message_id":"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE","emoji":"👍"}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Recibimos tu mensaje. Gracias."}}}'
};

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

```go REACTION, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Recibimos tu mensaje. Gracias.\"\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 REACTION, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Recibimos tu mensaje. Gracias.\"\n    }\n  }\n}"

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

```java REACTION, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Recibimos tu mensaje. Gracias.\"\n    }\n  }\n}")
  .asString();
```

```php REACTION, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "REACTION",
  "messages": [
    {
      "to": "+5215512345678",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
        "emoji": "👍"
      }
    },
    {
      "to": "+5215587654321",
      "reaction": {
        "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
        "emoji": "👍"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Recibimos tu mensaje. Gracias."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp REACTION, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"REACTION\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5\",\n        \"emoji\": \"👍\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"reaction\": {\n        \"message_id\": \"wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE\",\n        \"emoji\": \"👍\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Recibimos tu mensaje. Gracias.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift REACTION, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "REACTION",
  "messages": [
    [
      "to": "+5215512345678",
      "reaction": [
        "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
        "emoji": "👍"
      ]
    ],
    [
      "to": "+5215587654321",
      "reaction": [
        "message_id": "wamid.HBgNNTIxNTU4NzY1NDMyMRUCABIYFjNFQjBDMTAyRjg5NzRBMEE4RUNE",
        "emoji": "👍"
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Recibimos tu mensaje. Gracias."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### INTERACTIVE (botones), sin fallback

**Request**

```json
{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Ana, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    },
    {
      "to": "+5215587654321",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Luis, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python INTERACTIVE (botones), sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "INTERACTIVE",
    "messages": [
        {
            "to": "+5215512345678",
            "interactive": {
                "type": "button",
                "body": { "text": "Hola Ana, ¿en qué podemos ayudarte?" },
                "action": { "buttons": [
                        {
                            "type": "reply",
                            "reply": {
                                "id": "ventas",
                                "title": "Ventas"
                            }
                        },
                        {
                            "type": "reply",
                            "reply": {
                                "id": "soporte",
                                "title": "Soporte"
                            }
                        }
                    ] }
            }
        },
        {
            "to": "+5215587654321",
            "interactive": {
                "type": "button",
                "body": { "text": "Hola Luis, ¿en qué podemos ayudarte?" },
                "action": { "buttons": [
                        {
                            "type": "reply",
                            "reply": {
                                "id": "ventas",
                                "title": "Ventas"
                            }
                        },
                        {
                            "type": "reply",
                            "reply": {
                                "id": "soporte",
                                "title": "Soporte"
                            }
                        }
                    ] }
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript INTERACTIVE (botones), sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"INTERACTIVE","messages":[{"to":"+5215512345678","interactive":{"type":"button","body":{"text":"Hola Ana, ¿en qué podemos ayudarte?"},"action":{"buttons":[{"type":"reply","reply":{"id":"ventas","title":"Ventas"}},{"type":"reply","reply":{"id":"soporte","title":"Soporte"}}]}}},{"to":"+5215587654321","interactive":{"type":"button","body":{"text":"Hola Luis, ¿en qué podemos ayudarte?"},"action":{"buttons":[{"type":"reply","reply":{"id":"ventas","title":"Ventas"}},{"type":"reply","reply":{"id":"soporte","title":"Soporte"}}]}}}]}'
};

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

```go INTERACTIVE (botones), sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\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 INTERACTIVE (botones), sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    }\n  ]\n}"

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

```java INTERACTIVE (botones), sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    }\n  ]\n}")
  .asString();
```

```php INTERACTIVE (botones), sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Ana, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    },
    {
      "to": "+5215587654321",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Luis, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp INTERACTIVE (botones), sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift INTERACTIVE (botones), sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "INTERACTIVE",
  "messages": [
    [
      "to": "+5215512345678",
      "interactive": [
        "type": "button",
        "body": ["text": "Hola Ana, ¿en qué podemos ayudarte?"],
        "action": ["buttons": [
            [
              "type": "reply",
              "reply": [
                "id": "ventas",
                "title": "Ventas"
              ]
            ],
            [
              "type": "reply",
              "reply": [
                "id": "soporte",
                "title": "Soporte"
              ]
            ]
          ]]
      ]
    ],
    [
      "to": "+5215587654321",
      "interactive": [
        "type": "button",
        "body": ["text": "Hola Luis, ¿en qué podemos ayudarte?"],
        "action": ["buttons": [
            [
              "type": "reply",
              "reply": [
                "id": "ventas",
                "title": "Ventas"
              ]
            ],
            [
              "type": "reply",
              "reply": [
                "id": "soporte",
                "title": "Soporte"
              ]
            ]
          ]]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### INTERACTIVE (botones), con fallback

**Request**

```json
{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Ana, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    },
    {
      "to": "+5215587654321",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Luis, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "¿En qué podemos ayudarte? Llámanos al 55 1234 5678."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python INTERACTIVE (botones), con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "INTERACTIVE",
    "messages": [
        {
            "to": "+5215512345678",
            "interactive": {
                "type": "button",
                "body": { "text": "Hola Ana, ¿en qué podemos ayudarte?" },
                "action": { "buttons": [
                        {
                            "type": "reply",
                            "reply": {
                                "id": "ventas",
                                "title": "Ventas"
                            }
                        },
                        {
                            "type": "reply",
                            "reply": {
                                "id": "soporte",
                                "title": "Soporte"
                            }
                        }
                    ] }
            }
        },
        {
            "to": "+5215587654321",
            "interactive": {
                "type": "button",
                "body": { "text": "Hola Luis, ¿en qué podemos ayudarte?" },
                "action": { "buttons": [
                        {
                            "type": "reply",
                            "reply": {
                                "id": "ventas",
                                "title": "Ventas"
                            }
                        },
                        {
                            "type": "reply",
                            "reply": {
                                "id": "soporte",
                                "title": "Soporte"
                            }
                        }
                    ] }
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "¿En qué podemos ayudarte? Llámanos al 55 1234 5678."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript INTERACTIVE (botones), con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"INTERACTIVE","messages":[{"to":"+5215512345678","interactive":{"type":"button","body":{"text":"Hola Ana, ¿en qué podemos ayudarte?"},"action":{"buttons":[{"type":"reply","reply":{"id":"ventas","title":"Ventas"}},{"type":"reply","reply":{"id":"soporte","title":"Soporte"}}]}}},{"to":"+5215587654321","interactive":{"type":"button","body":{"text":"Hola Luis, ¿en qué podemos ayudarte?"},"action":{"buttons":[{"type":"reply","reply":{"id":"ventas","title":"Ventas"}},{"type":"reply","reply":{"id":"soporte","title":"Soporte"}}]}}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"¿En qué podemos ayudarte? Llámanos al 55 1234 5678."}}}'
};

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

```go INTERACTIVE (botones), con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"¿En qué podemos ayudarte? Llámanos al 55 1234 5678.\"\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 INTERACTIVE (botones), con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"¿En qué podemos ayudarte? Llámanos al 55 1234 5678.\"\n    }\n  }\n}"

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

```java INTERACTIVE (botones), con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"¿En qué podemos ayudarte? Llámanos al 55 1234 5678.\"\n    }\n  }\n}")
  .asString();
```

```php INTERACTIVE (botones), con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Ana, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    },
    {
      "to": "+5215587654321",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Hola Luis, ¿en qué podemos ayudarte?"
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "ventas",
                "title": "Ventas"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "soporte",
                "title": "Soporte"
              }
            }
          ]
        }
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "¿En qué podemos ayudarte? Llámanos al 55 1234 5678."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp INTERACTIVE (botones), con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Ana, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"interactive\": {\n        \"type\": \"button\",\n        \"body\": {\n          \"text\": \"Hola Luis, ¿en qué podemos ayudarte?\"\n        },\n        \"action\": {\n          \"buttons\": [\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"ventas\",\n                \"title\": \"Ventas\"\n              }\n            },\n            {\n              \"type\": \"reply\",\n              \"reply\": {\n                \"id\": \"soporte\",\n                \"title\": \"Soporte\"\n              }\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"¿En qué podemos ayudarte? Llámanos al 55 1234 5678.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift INTERACTIVE (botones), con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "INTERACTIVE",
  "messages": [
    [
      "to": "+5215512345678",
      "interactive": [
        "type": "button",
        "body": ["text": "Hola Ana, ¿en qué podemos ayudarte?"],
        "action": ["buttons": [
            [
              "type": "reply",
              "reply": [
                "id": "ventas",
                "title": "Ventas"
              ]
            ],
            [
              "type": "reply",
              "reply": [
                "id": "soporte",
                "title": "Soporte"
              ]
            ]
          ]]
      ]
    ],
    [
      "to": "+5215587654321",
      "interactive": [
        "type": "button",
        "body": ["text": "Hola Luis, ¿en qué podemos ayudarte?"],
        "action": ["buttons": [
            [
              "type": "reply",
              "reply": [
                "id": "ventas",
                "title": "Ventas"
              ]
            ],
            [
              "type": "reply",
              "reply": [
                "id": "soporte",
                "title": "Soporte"
              ]
            ]
          ]]
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "¿En qué podemos ayudarte? Llámanos al 55 1234 5678."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### INTERACTIVE (lista), sin fallback

**Request**

```json
{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "list",
        "body": {
          "text": "Hola Ana, selecciona una opción"
        },
        "action": {
          "button": "Ver opciones",
          "sections": [
            {
              "title": "Servicios",
              "rows": [
                {
                  "id": "consultoria",
                  "title": "Consultoría",
                  "description": "Asesoría especializada"
                },
                {
                  "id": "capacitacion",
                  "title": "Capacitación",
                  "description": "Cursos para tu equipo"
                }
              ]
            }
          ]
        }
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python INTERACTIVE (lista), sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "INTERACTIVE",
    "messages": [
        {
            "to": "+5215512345678",
            "interactive": {
                "type": "list",
                "body": { "text": "Hola Ana, selecciona una opción" },
                "action": {
                    "button": "Ver opciones",
                    "sections": [
                        {
                            "title": "Servicios",
                            "rows": [
                                {
                                    "id": "consultoria",
                                    "title": "Consultoría",
                                    "description": "Asesoría especializada"
                                },
                                {
                                    "id": "capacitacion",
                                    "title": "Capacitación",
                                    "description": "Cursos para tu equipo"
                                }
                            ]
                        }
                    ]
                }
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript INTERACTIVE (lista), sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"INTERACTIVE","messages":[{"to":"+5215512345678","interactive":{"type":"list","body":{"text":"Hola Ana, selecciona una opción"},"action":{"button":"Ver opciones","sections":[{"title":"Servicios","rows":[{"id":"consultoria","title":"Consultoría","description":"Asesoría especializada"},{"id":"capacitacion","title":"Capacitación","description":"Cursos para tu equipo"}]}]}}}]}'
};

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

```go INTERACTIVE (lista), sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\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 INTERACTIVE (lista), sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  ]\n}"

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

```java INTERACTIVE (lista), sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  ]\n}")
  .asString();
```

```php INTERACTIVE (lista), sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "list",
        "body": {
          "text": "Hola Ana, selecciona una opción"
        },
        "action": {
          "button": "Ver opciones",
          "sections": [
            {
              "title": "Servicios",
              "rows": [
                {
                  "id": "consultoria",
                  "title": "Consultoría",
                  "description": "Asesoría especializada"
                },
                {
                  "id": "capacitacion",
                  "title": "Capacitación",
                  "description": "Cursos para tu equipo"
                }
              ]
            }
          ]
        }
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp INTERACTIVE (lista), sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift INTERACTIVE (lista), sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "INTERACTIVE",
  "messages": [
    [
      "to": "+5215512345678",
      "interactive": [
        "type": "list",
        "body": ["text": "Hola Ana, selecciona una opción"],
        "action": [
          "button": "Ver opciones",
          "sections": [
            [
              "title": "Servicios",
              "rows": [
                [
                  "id": "consultoria",
                  "title": "Consultoría",
                  "description": "Asesoría especializada"
                ],
                [
                  "id": "capacitacion",
                  "title": "Capacitación",
                  "description": "Cursos para tu equipo"
                ]
              ]
            ]
          ]
        ]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### INTERACTIVE (lista), con fallback

**Request**

```json
{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "list",
        "body": {
          "text": "Hola Ana, selecciona una opción"
        },
        "action": {
          "button": "Ver opciones",
          "sections": [
            {
              "title": "Servicios",
              "rows": [
                {
                  "id": "consultoria",
                  "title": "Consultoría",
                  "description": "Asesoría especializada"
                },
                {
                  "id": "capacitacion",
                  "title": "Capacitación",
                  "description": "Cursos para tu equipo"
                }
              ]
            }
          ]
        }
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python INTERACTIVE (lista), con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "INTERACTIVE",
    "messages": [
        {
            "to": "+5215512345678",
            "interactive": {
                "type": "list",
                "body": { "text": "Hola Ana, selecciona una opción" },
                "action": {
                    "button": "Ver opciones",
                    "sections": [
                        {
                            "title": "Servicios",
                            "rows": [
                                {
                                    "id": "consultoria",
                                    "title": "Consultoría",
                                    "description": "Asesoría especializada"
                                },
                                {
                                    "id": "capacitacion",
                                    "title": "Capacitación",
                                    "description": "Cursos para tu equipo"
                                }
                            ]
                        }
                    ]
                }
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript INTERACTIVE (lista), con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"INTERACTIVE","messages":[{"to":"+5215512345678","interactive":{"type":"list","body":{"text":"Hola Ana, selecciona una opción"},"action":{"button":"Ver opciones","sections":[{"title":"Servicios","rows":[{"id":"consultoria","title":"Consultoría","description":"Asesoría especializada"},{"id":"capacitacion","title":"Capacitación","description":"Cursos para tu equipo"}]}]}}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678."}}}'
};

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

```go INTERACTIVE (lista), con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678.\"\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 INTERACTIVE (lista), con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678.\"\n    }\n  }\n}"

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

```java INTERACTIVE (lista), con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678.\"\n    }\n  }\n}")
  .asString();
```

```php INTERACTIVE (lista), con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "INTERACTIVE",
  "messages": [
    {
      "to": "+5215512345678",
      "interactive": {
        "type": "list",
        "body": {
          "text": "Hola Ana, selecciona una opción"
        },
        "action": {
          "button": "Ver opciones",
          "sections": [
            {
              "title": "Servicios",
              "rows": [
                {
                  "id": "consultoria",
                  "title": "Consultoría",
                  "description": "Asesoría especializada"
                },
                {
                  "id": "capacitacion",
                  "title": "Capacitación",
                  "description": "Cursos para tu equipo"
                }
              ]
            }
          ]
        }
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp INTERACTIVE (lista), con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"INTERACTIVE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"interactive\": {\n        \"type\": \"list\",\n        \"body\": {\n          \"text\": \"Hola Ana, selecciona una opción\"\n        },\n        \"action\": {\n          \"button\": \"Ver opciones\",\n          \"sections\": [\n            {\n              \"title\": \"Servicios\",\n              \"rows\": [\n                {\n                  \"id\": \"consultoria\",\n                  \"title\": \"Consultoría\",\n                  \"description\": \"Asesoría especializada\"\n                },\n                {\n                  \"id\": \"capacitacion\",\n                  \"title\": \"Capacitación\",\n                  \"description\": \"Cursos para tu equipo\"\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift INTERACTIVE (lista), con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "INTERACTIVE",
  "messages": [
    [
      "to": "+5215512345678",
      "interactive": [
        "type": "list",
        "body": ["text": "Hola Ana, selecciona una opción"],
        "action": [
          "button": "Ver opciones",
          "sections": [
            [
              "title": "Servicios",
              "rows": [
                [
                  "id": "consultoria",
                  "title": "Consultoría",
                  "description": "Asesoría especializada"
                ],
                [
                  "id": "capacitacion",
                  "title": "Capacitación",
                  "description": "Cursos para tu equipo"
                ]
              ]
            ]
          ]
        ]
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Elige un servicio: consultoria o capacitacion. Llama al 55 1234 5678."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### STICKER, sin fallback

**Request**

```json
{
  "type": "STICKER",
  "messages": [
    {
      "to": "+5215512345678",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    },
    {
      "to": "+5215587654321",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python STICKER, sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "STICKER",
    "messages": [
        {
            "to": "+5215512345678",
            "sticker": { "link": "https://cdn.ejemplo.com/stickers/gracias.webp" }
        },
        {
            "to": "+5215587654321",
            "sticker": { "link": "https://cdn.ejemplo.com/stickers/gracias.webp" }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript STICKER, sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"STICKER","messages":[{"to":"+5215512345678","sticker":{"link":"https://cdn.ejemplo.com/stickers/gracias.webp"}},{"to":"+5215587654321","sticker":{"link":"https://cdn.ejemplo.com/stickers/gracias.webp"}}]}'
};

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

```go STICKER, sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\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 STICKER, sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    }\n  ]\n}"

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

```java STICKER, sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php STICKER, sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "STICKER",
  "messages": [
    {
      "to": "+5215512345678",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    },
    {
      "to": "+5215587654321",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp STICKER, sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift STICKER, sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "STICKER",
  "messages": [
    [
      "to": "+5215512345678",
      "sticker": ["link": "https://cdn.ejemplo.com/stickers/gracias.webp"]
    ],
    [
      "to": "+5215587654321",
      "sticker": ["link": "https://cdn.ejemplo.com/stickers/gracias.webp"]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```

### STICKER, con fallback

**Request**

```json
{
  "type": "STICKER",
  "messages": [
    {
      "to": "+5215512345678",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    },
    {
      "to": "+5215587654321",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Gracias por tu preferencia."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python STICKER, con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "STICKER",
    "messages": [
        {
            "to": "+5215512345678",
            "sticker": { "link": "https://cdn.ejemplo.com/stickers/gracias.webp" }
        },
        {
            "to": "+5215587654321",
            "sticker": { "link": "https://cdn.ejemplo.com/stickers/gracias.webp" }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Gracias por tu preferencia."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript STICKER, con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"STICKER","messages":[{"to":"+5215512345678","sticker":{"link":"https://cdn.ejemplo.com/stickers/gracias.webp"}},{"to":"+5215587654321","sticker":{"link":"https://cdn.ejemplo.com/stickers/gracias.webp"}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Gracias por tu preferencia."}}}'
};

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

```go STICKER, con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Gracias por tu preferencia.\"\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 STICKER, con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Gracias por tu preferencia.\"\n    }\n  }\n}"

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

```java STICKER, con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Gracias por tu preferencia.\"\n    }\n  }\n}")
  .asString();
```

```php STICKER, con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "STICKER",
  "messages": [
    {
      "to": "+5215512345678",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    },
    {
      "to": "+5215587654321",
      "sticker": {
        "link": "https://cdn.ejemplo.com/stickers/gracias.webp"
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Gracias por tu preferencia."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp STICKER, con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"STICKER\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"sticker\": {\n        \"link\": \"https://cdn.ejemplo.com/stickers/gracias.webp\"\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Gracias por tu preferencia.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift STICKER, con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "STICKER",
  "messages": [
    [
      "to": "+5215512345678",
      "sticker": ["link": "https://cdn.ejemplo.com/stickers/gracias.webp"]
    ],
    [
      "to": "+5215587654321",
      "sticker": ["link": "https://cdn.ejemplo.com/stickers/gracias.webp"]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Gracias por tu preferencia."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (variables de body), sin fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Ana"
          },
          {
            "position": 2,
            "text": "CLI-12345"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Luis"
          },
          {
            "position": 2,
            "text": "CLI-67890"
          }
        ]
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (variables de body), sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ac",
                "body": [
                    {
                        "position": 1,
                        "text": "Ana"
                    },
                    {
                        "position": 2,
                        "text": "CLI-12345"
                    }
                ]
            }
        },
        {
            "to": "+5215587654321",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ac",
                "body": [
                    {
                        "position": 1,
                        "text": "Luis"
                    },
                    {
                        "position": 2,
                        "text": "CLI-67890"
                    }
                ]
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (variables de body), sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Ana"},{"position":2,"text":"CLI-12345"}]}},{"to":"+5215587654321","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Luis"},{"position":2,"text":"CLI-67890"}]}}]}'
};

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

```go TEMPLATE (variables de body), sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\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 TEMPLATE (variables de body), sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    }\n  ]\n}"

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

```java TEMPLATE (variables de body), sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    }\n  ]\n}")
  .asString();
```

```php TEMPLATE (variables de body), sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Ana"
          },
          {
            "position": 2,
            "text": "CLI-12345"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Luis"
          },
          {
            "position": 2,
            "text": "CLI-67890"
          }
        ]
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (variables de body), sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (variables de body), sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          [
            "position": 1,
            "text": "Ana"
          ],
          [
            "position": 2,
            "text": "CLI-12345"
          ]
        ]
      ]
    ],
    [
      "to": "+5215587654321",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          [
            "position": 1,
            "text": "Luis"
          ],
          [
            "position": 2,
            "text": "CLI-67890"
          ]
        ]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (variables de body), con fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Ana"
          },
          {
            "position": 2,
            "text": "CLI-12345"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Luis"
          },
          {
            "position": 2,
            "text": "CLI-67890"
          }
        ]
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por WhatsApp. Tu pedido está confirmado.",
      "complement": {
        "link": "https://ejemplo.com/rastreo",
        "ttl_events": 1440
      }
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (variables de body), con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ac",
                "body": [
                    {
                        "position": 1,
                        "text": "Ana"
                    },
                    {
                        "position": 2,
                        "text": "CLI-12345"
                    }
                ]
            }
        },
        {
            "to": "+5215587654321",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ac",
                "body": [
                    {
                        "position": 1,
                        "text": "Luis"
                    },
                    {
                        "position": 2,
                        "text": "CLI-67890"
                    }
                ]
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "No pudimos contactarte por WhatsApp. Tu pedido está confirmado.",
            "complement": {
                "link": "https://ejemplo.com/rastreo",
                "ttl_events": 1440
            }
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (variables de body), con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Ana"},{"position":2,"text":"CLI-12345"}]}},{"to":"+5215587654321","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Luis"},{"position":2,"text":"CLI-67890"}]}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"No pudimos contactarte por WhatsApp. Tu pedido está confirmado.","complement":{"link":"https://ejemplo.com/rastreo","ttl_events":1440}}}}'
};

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

```go TEMPLATE (variables de body), con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por WhatsApp. Tu pedido está confirmado.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/rastreo\",\n        \"ttl_events\": 1440\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 TEMPLATE (variables de body), con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por WhatsApp. Tu pedido está confirmado.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/rastreo\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}"

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

```java TEMPLATE (variables de body), con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por WhatsApp. Tu pedido está confirmado.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/rastreo\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}")
  .asString();
```

```php TEMPLATE (variables de body), con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Ana"
          },
          {
            "position": 2,
            "text": "CLI-12345"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          {
            "position": 1,
            "text": "Luis"
          },
          {
            "position": 2,
            "text": "CLI-67890"
          }
        ]
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por WhatsApp. Tu pedido está confirmado.",
      "complement": {
        "link": "https://ejemplo.com/rastreo",
        "ttl_events": 1440
      }
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (variables de body), con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-12345\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ac\",\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          },\n          {\n            \"position\": 2,\n            \"text\": \"CLI-67890\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por WhatsApp. Tu pedido está confirmado.\",\n      \"complement\": {\n        \"link\": \"https://ejemplo.com/rastreo\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (variables de body), con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          [
            "position": 1,
            "text": "Ana"
          ],
          [
            "position": 2,
            "text": "CLI-12345"
          ]
        ]
      ]
    ],
    [
      "to": "+5215587654321",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
          [
            "position": 1,
            "text": "Luis"
          ],
          [
            "position": 2,
            "text": "CLI-67890"
          ]
        ]
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por WhatsApp. Tu pedido está confirmado.",
      "complement": [
        "link": "https://ejemplo.com/rastreo",
        "ttl_events": 1440
      ]
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (header imagen + botón URL dinámica), sin fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-ana.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Ana"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "ana-promo"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-luis.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Luis"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "luis-promo"
          }
        ]
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (header imagen + botón URL dinámica), sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ad",
                "header": { "url": "https://cdn.ejemplo.com/promo-ana.jpg" },
                "body": [
                    {
                        "position": 1,
                        "text": "Ana"
                    }
                ],
                "buttons": [
                    {
                        "index": 0,
                        "text": "ana-promo"
                    }
                ]
            }
        },
        {
            "to": "+5215587654321",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ad",
                "header": { "url": "https://cdn.ejemplo.com/promo-luis.jpg" },
                "body": [
                    {
                        "position": 1,
                        "text": "Luis"
                    }
                ],
                "buttons": [
                    {
                        "index": 0,
                        "text": "luis-promo"
                    }
                ]
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (header imagen + botón URL dinámica), sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706ad","header":{"url":"https://cdn.ejemplo.com/promo-ana.jpg"},"body":[{"position":1,"text":"Ana"}],"buttons":[{"index":0,"text":"ana-promo"}]}},{"to":"+5215587654321","template":{"_id":"69f9520edc73e2f8d0f706ad","header":{"url":"https://cdn.ejemplo.com/promo-luis.jpg"},"body":[{"position":1,"text":"Luis"}],"buttons":[{"index":0,"text":"luis-promo"}]}}]}'
};

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

```go TEMPLATE (header imagen + botón URL dinámica), sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\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 TEMPLATE (header imagen + botón URL dinámica), sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\n          }\n        ]\n      }\n    }\n  ]\n}"

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

```java TEMPLATE (header imagen + botón URL dinámica), sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\n          }\n        ]\n      }\n    }\n  ]\n}")
  .asString();
```

```php TEMPLATE (header imagen + botón URL dinámica), sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-ana.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Ana"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "ana-promo"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-luis.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Luis"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "luis-promo"
          }
        ]
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (header imagen + botón URL dinámica), sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\n          }\n        ]\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (header imagen + botón URL dinámica), sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": ["url": "https://cdn.ejemplo.com/promo-ana.jpg"],
        "body": [
          [
            "position": 1,
            "text": "Ana"
          ]
        ],
        "buttons": [
          [
            "index": 0,
            "text": "ana-promo"
          ]
        ]
      ]
    ],
    [
      "to": "+5215587654321",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": ["url": "https://cdn.ejemplo.com/promo-luis.jpg"],
        "body": [
          [
            "position": 1,
            "text": "Luis"
          ]
        ],
        "buttons": [
          [
            "index": 0,
            "text": "luis-promo"
          ]
        ]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (header imagen + botón URL dinámica), con fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-ana.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Ana"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "ana-promo"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-luis.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Luis"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "luis-promo"
          }
        ]
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes una nueva promoción. Visita ejemplo.com/promo"
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (header imagen + botón URL dinámica), con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ad",
                "header": { "url": "https://cdn.ejemplo.com/promo-ana.jpg" },
                "body": [
                    {
                        "position": 1,
                        "text": "Ana"
                    }
                ],
                "buttons": [
                    {
                        "index": 0,
                        "text": "ana-promo"
                    }
                ]
            }
        },
        {
            "to": "+5215587654321",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ad",
                "header": { "url": "https://cdn.ejemplo.com/promo-luis.jpg" },
                "body": [
                    {
                        "position": 1,
                        "text": "Luis"
                    }
                ],
                "buttons": [
                    {
                        "index": 0,
                        "text": "luis-promo"
                    }
                ]
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Tienes una nueva promoción. Visita ejemplo.com/promo"
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (header imagen + botón URL dinámica), con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706ad","header":{"url":"https://cdn.ejemplo.com/promo-ana.jpg"},"body":[{"position":1,"text":"Ana"}],"buttons":[{"index":0,"text":"ana-promo"}]}},{"to":"+5215587654321","template":{"_id":"69f9520edc73e2f8d0f706ad","header":{"url":"https://cdn.ejemplo.com/promo-luis.jpg"},"body":[{"position":1,"text":"Luis"}],"buttons":[{"index":0,"text":"luis-promo"}]}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Tienes una nueva promoción. Visita ejemplo.com/promo"}}}'
};

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

```go TEMPLATE (header imagen + botón URL dinámica), con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción. Visita ejemplo.com/promo\"\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 (header imagen + botón URL dinámica), con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción. Visita ejemplo.com/promo\"\n    }\n  }\n}"

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

```java TEMPLATE (header imagen + botón URL dinámica), con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción. Visita ejemplo.com/promo\"\n    }\n  }\n}")
  .asString();
```

```php TEMPLATE (header imagen + botón URL dinámica), con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-ana.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Ana"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "ana-promo"
          }
        ]
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": {
          "url": "https://cdn.ejemplo.com/promo-luis.jpg"
        },
        "body": [
          {
            "position": 1,
            "text": "Luis"
          }
        ],
        "buttons": [
          {
            "index": 0,
            "text": "luis-promo"
          }
        ]
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes una nueva promoción. Visita ejemplo.com/promo"
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (header imagen + botón URL dinámica), con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-ana.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Ana\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"ana-promo\"\n          }\n        ]\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ad\",\n        \"header\": {\n          \"url\": \"https://cdn.ejemplo.com/promo-luis.jpg\"\n        },\n        \"body\": [\n          {\n            \"position\": 1,\n            \"text\": \"Luis\"\n          }\n        ],\n        \"buttons\": [\n          {\n            \"index\": 0,\n            \"text\": \"luis-promo\"\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Tienes una nueva promoción. Visita ejemplo.com/promo\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (header imagen + botón URL dinámica), con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": ["url": "https://cdn.ejemplo.com/promo-ana.jpg"],
        "body": [
          [
            "position": 1,
            "text": "Ana"
          ]
        ],
        "buttons": [
          [
            "index": 0,
            "text": "ana-promo"
          ]
        ]
      ]
    ],
    [
      "to": "+5215587654321",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ad",
        "header": ["url": "https://cdn.ejemplo.com/promo-luis.jpg"],
        "body": [
          [
            "position": 1,
            "text": "Luis"
          ]
        ],
        "buttons": [
          [
            "index": 0,
            "text": "luis-promo"
          ]
        ]
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Tienes una nueva promoción. Visita ejemplo.com/promo"
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (autenticación OTP), sin fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "482913"
        }
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "730158"
        }
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (autenticación OTP), sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ae",
                "otp": { "code": "482913" }
            }
        },
        {
            "to": "+5215587654321",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ae",
                "otp": { "code": "730158" }
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (autenticación OTP), sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706ae","otp":{"code":"482913"}}},{"to":"+5215587654321","template":{"_id":"69f9520edc73e2f8d0f706ae","otp":{"code":"730158"}}}]}'
};

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

```go TEMPLATE (autenticación OTP), sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\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 TEMPLATE (autenticación OTP), sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\n        }\n      }\n    }\n  ]\n}"

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

```java TEMPLATE (autenticación OTP), sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\n        }\n      }\n    }\n  ]\n}")
  .asString();
```

```php TEMPLATE (autenticación OTP), sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "482913"
        }
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "730158"
        }
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (autenticación OTP), sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\n        }\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (autenticación OTP), sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": ["code": "482913"]
      ]
    ],
    [
      "to": "+5215587654321",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": ["code": "730158"]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (autenticación OTP), con fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "482913"
        }
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "730158"
        }
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Usa el código que enviamos a tu WhatsApp para continuar."
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (autenticación OTP), con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ae",
                "otp": { "code": "482913" }
            }
        },
        {
            "to": "+5215587654321",
            "template": {
                "_id": "69f9520edc73e2f8d0f706ae",
                "otp": { "code": "730158" }
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Usa el código que enviamos a tu WhatsApp para continuar."
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (autenticación OTP), con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706ae","otp":{"code":"482913"}}},{"to":"+5215587654321","template":{"_id":"69f9520edc73e2f8d0f706ae","otp":{"code":"730158"}}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Usa el código que enviamos a tu WhatsApp para continuar."}}}'
};

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

```go TEMPLATE (autenticación OTP), con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Usa el código que enviamos a tu WhatsApp para continuar.\"\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 (autenticación OTP), con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Usa el código que enviamos a tu WhatsApp para continuar.\"\n    }\n  }\n}"

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

```java TEMPLATE (autenticación OTP), con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Usa el código que enviamos a tu WhatsApp para continuar.\"\n    }\n  }\n}")
  .asString();
```

```php TEMPLATE (autenticación OTP), con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "482913"
        }
      }
    },
    {
      "to": "+5215587654321",
      "template": {
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": {
          "code": "730158"
        }
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Usa el código que enviamos a tu WhatsApp para continuar."
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (autenticación OTP), con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"482913\"\n        }\n      }\n    },\n    {\n      \"to\": \"+5215587654321\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706ae\",\n        \"otp\": {\n          \"code\": \"730158\"\n        }\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Usa el código que enviamos a tu WhatsApp para continuar.\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (autenticación OTP), con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": ["code": "482913"]
      ]
    ],
    [
      "to": "+5215587654321",
      "template": [
        "_id": "69f9520edc73e2f8d0f706ae",
        "otp": ["code": "730158"]
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Usa el código que enviamos a tu WhatsApp para continuar."
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (carrusel), sin fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706af",
        "carousel": [
          {
            "index": 0,
            "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
            "body": [
              {
                "position": 1,
                "text": "Laptop 14\""
              },
              {
                "position": 2,
                "text": "$12,999"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "laptop-14"
              }
            ]
          },
          {
            "index": 1,
            "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
            "body": [
              {
                "position": 1,
                "text": "Tablet 10\""
              },
              {
                "position": 2,
                "text": "$5,499"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "tablet-10"
              }
            ]
          }
        ]
      }
    }
  ]
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (carrusel), sin fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706af",
                "carousel": [
                    {
                        "index": 0,
                        "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
                        "body": [
                            {
                                "position": 1,
                                "text": "Laptop 14\""
                            },
                            {
                                "position": 2,
                                "text": "$12,999"
                            }
                        ],
                        "buttons": [
                            {
                                "index": 0,
                                "text": "laptop-14"
                            }
                        ]
                    },
                    {
                        "index": 1,
                        "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
                        "body": [
                            {
                                "position": 1,
                                "text": "Tablet 10\""
                            },
                            {
                                "position": 2,
                                "text": "$5,499"
                            }
                        ],
                        "buttons": [
                            {
                                "index": 0,
                                "text": "tablet-10"
                            }
                        ]
                    }
                ]
            }
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (carrusel), sin fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706af","carousel":[{"index":0,"url":"https://cdn.ejemplo.com/productos/laptop.jpg","body":[{"position":1,"text":"Laptop 14\""},{"position":2,"text":"$12,999"}],"buttons":[{"index":0,"text":"laptop-14"}]},{"index":1,"url":"https://cdn.ejemplo.com/productos/tablet.jpg","body":[{"position":1,"text":"Tablet 10\""},{"position":2,"text":"$5,499"}],"buttons":[{"index":0,"text":"tablet-10"}]}]}}]}'
};

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

```go TEMPLATE (carrusel), sin fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\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 TEMPLATE (carrusel), sin fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\n              }\n            ]\n          }\n        ]\n      }\n    }\n  ]\n}"

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

```java TEMPLATE (carrusel), sin fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\n              }\n            ]\n          }\n        ]\n      }\n    }\n  ]\n}")
  .asString();
```

```php TEMPLATE (carrusel), sin fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706af",
        "carousel": [
          {
            "index": 0,
            "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
            "body": [
              {
                "position": 1,
                "text": "Laptop 14\\""
              },
              {
                "position": 2,
                "text": "$12,999"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "laptop-14"
              }
            ]
          },
          {
            "index": 1,
            "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
            "body": [
              {
                "position": 1,
                "text": "Tablet 10\\""
              },
              {
                "position": 2,
                "text": "$5,499"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "tablet-10"
              }
            ]
          }
        ]
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (carrusel), sin fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\n              }\n            ]\n          }\n        ]\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (carrusel), sin fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706af",
        "carousel": [
          [
            "index": 0,
            "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
            "body": [
              [
                "position": 1,
                "text": "Laptop 14\""
              ],
              [
                "position": 2,
                "text": "$12,999"
              ]
            ],
            "buttons": [
              [
                "index": 0,
                "text": "laptop-14"
              ]
            ]
          ],
          [
            "index": 1,
            "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
            "body": [
              [
                "position": 1,
                "text": "Tablet 10\""
              ],
              [
                "position": 2,
                "text": "$5,499"
              ]
            ],
            "buttons": [
              [
                "index": 0,
                "text": "tablet-10"
              ]
            ]
          ]
        ]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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 (carrusel), con fallback

**Request**

```json
{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706af",
        "carousel": [
          {
            "index": 0,
            "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
            "body": [
              {
                "position": 1,
                "text": "Laptop 14\""
              },
              {
                "position": 2,
                "text": "$12,999"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "laptop-14"
              }
            ]
          },
          {
            "index": 1,
            "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
            "body": [
              {
                "position": 1,
                "text": "Tablet 10\""
              },
              {
                "position": 2,
                "text": "$5,499"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "tablet-10"
              }
            ]
          }
        ]
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Conoce nuestros nuevos productos en ejemplo.com/catalogo"
    }
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "batch_id": "6710a2b3c4d5e6f708192a3b",
  "webhook_mode": "BATCH",
  "total": 3,
  "messages": [
    {
      "to": "+5215512345678",
      "message_id": "1791954711314-c2b6e1a4-1f3d-4b7a-8c1e-2a6f9d3b7e10",
      "status": "queued",
      "fallback_id": "5d2f7a90-3c1b-5e84-9a6d-0b7c4e1f2a38"
    },
    {
      "to": "+5215587654321",
      "message_id": "1791954711314-9f1a2b3c-4d5e-4f60-8a1b-2c3d4e5f6071",
      "status": "queued",
      "fallback_id": "7a1b2c3d-4e5f-6071-8a9b-0c1d2e3f4a5b"
    },
    {
      "to": "MX.1264908862298277",
      "message_id": "1791954711314-4d7e8f90-1a2b-4c3d-9e4f-5a6b7c8d9e0f",
      "status": "queued"
    }
  ]
}
```

**SDK Code**

```python TEMPLATE (carrusel), con fallback
import requests

url = "https://connect.chatbridge.mx/v1/whatsapp/batches"

payload = {
    "type": "TEMPLATE",
    "messages": [
        {
            "to": "+5215512345678",
            "template": {
                "_id": "69f9520edc73e2f8d0f706af",
                "carousel": [
                    {
                        "index": 0,
                        "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
                        "body": [
                            {
                                "position": 1,
                                "text": "Laptop 14\""
                            },
                            {
                                "position": 2,
                                "text": "$12,999"
                            }
                        ],
                        "buttons": [
                            {
                                "index": 0,
                                "text": "laptop-14"
                            }
                        ]
                    },
                    {
                        "index": 1,
                        "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
                        "body": [
                            {
                                "position": 1,
                                "text": "Tablet 10\""
                            },
                            {
                                "position": 2,
                                "text": "$5,499"
                            }
                        ],
                        "buttons": [
                            {
                                "index": 0,
                                "text": "tablet-10"
                            }
                        ]
                    }
                ]
            }
        }
    ],
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "Conoce nuestros nuevos productos en ejemplo.com/catalogo"
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript TEMPLATE (carrusel), con fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/batches';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":"TEMPLATE","messages":[{"to":"+5215512345678","template":{"_id":"69f9520edc73e2f8d0f706af","carousel":[{"index":0,"url":"https://cdn.ejemplo.com/productos/laptop.jpg","body":[{"position":1,"text":"Laptop 14\""},{"position":2,"text":"$12,999"}],"buttons":[{"index":0,"text":"laptop-14"}]},{"index":1,"url":"https://cdn.ejemplo.com/productos/tablet.jpg","body":[{"position":1,"text":"Tablet 10\""},{"position":2,"text":"$5,499"}],"buttons":[{"index":0,"text":"tablet-10"}]}]}}],"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"Conoce nuestros nuevos productos en ejemplo.com/catalogo"}}}'
};

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

```go TEMPLATE (carrusel), con fallback
package main

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

func main() {

	url := "https://connect.chatbridge.mx/v1/whatsapp/batches"

	payload := strings.NewReader("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\n              }\n            ]\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Conoce nuestros nuevos productos en ejemplo.com/catalogo\"\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 (carrusel), con fallback
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/whatsapp/batches")

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  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\n              }\n            ]\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Conoce nuestros nuevos productos en ejemplo.com/catalogo\"\n    }\n  }\n}"

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

```java TEMPLATE (carrusel), con fallback
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/batches")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\n              }\n            ]\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Conoce nuestros nuevos productos en ejemplo.com/catalogo\"\n    }\n  }\n}")
  .asString();
```

```php TEMPLATE (carrusel), con fallback
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/batches', [
  'body' => '{
  "type": "TEMPLATE",
  "messages": [
    {
      "to": "+5215512345678",
      "template": {
        "_id": "69f9520edc73e2f8d0f706af",
        "carousel": [
          {
            "index": 0,
            "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
            "body": [
              {
                "position": 1,
                "text": "Laptop 14\\""
              },
              {
                "position": 2,
                "text": "$12,999"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "laptop-14"
              }
            ]
          },
          {
            "index": 1,
            "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
            "body": [
              {
                "position": 1,
                "text": "Tablet 10\\""
              },
              {
                "position": 2,
                "text": "$5,499"
              }
            ],
            "buttons": [
              {
                "index": 0,
                "text": "tablet-10"
              }
            ]
          }
        ]
      }
    }
  ],
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Conoce nuestros nuevos productos en ejemplo.com/catalogo"
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp TEMPLATE (carrusel), con fallback
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"TEMPLATE\",\n  \"messages\": [\n    {\n      \"to\": \"+5215512345678\",\n      \"template\": {\n        \"_id\": \"69f9520edc73e2f8d0f706af\",\n        \"carousel\": [\n          {\n            \"index\": 0,\n            \"url\": \"https://cdn.ejemplo.com/productos/laptop.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Laptop 14\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$12,999\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"laptop-14\"\n              }\n            ]\n          },\n          {\n            \"index\": 1,\n            \"url\": \"https://cdn.ejemplo.com/productos/tablet.jpg\",\n            \"body\": [\n              {\n                \"position\": 1,\n                \"text\": \"Tablet 10\\\"\"\n              },\n              {\n                \"position\": 2,\n                \"text\": \"$5,499\"\n              }\n            ],\n            \"buttons\": [\n              {\n                \"index\": 0,\n                \"text\": \"tablet-10\"\n              }\n            ]\n          }\n        ]\n      }\n    }\n  ],\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"Conoce nuestros nuevos productos en ejemplo.com/catalogo\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift TEMPLATE (carrusel), con fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "TEMPLATE",
  "messages": [
    [
      "to": "+5215512345678",
      "template": [
        "_id": "69f9520edc73e2f8d0f706af",
        "carousel": [
          [
            "index": 0,
            "url": "https://cdn.ejemplo.com/productos/laptop.jpg",
            "body": [
              [
                "position": 1,
                "text": "Laptop 14\""
              ],
              [
                "position": 2,
                "text": "$12,999"
              ]
            ],
            "buttons": [
              [
                "index": 0,
                "text": "laptop-14"
              ]
            ]
          ],
          [
            "index": 1,
            "url": "https://cdn.ejemplo.com/productos/tablet.jpg",
            "body": [
              [
                "position": 1,
                "text": "Tablet 10\""
              ],
              [
                "position": 2,
                "text": "$5,499"
              ]
            ],
            "buttons": [
              [
                "index": 0,
                "text": "tablet-10"
              ]
            ]
          ]
        ]
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "Conoce nuestros nuevos productos en ejemplo.com/catalogo"
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/whatsapp/batches")! 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()
```