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

# Send message

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

Sends a WhatsApp message to a recipient. The `type` field determines the structure of the body and which additional object must be included (for example, `text`, `image`, `template`).

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

## 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 SendMessageRequest.

- `to` (string, required) — Recipient. Two alternative formats: a number in E.164 format (`^\+[1-9]\d{1,14}$`, e.g. `+5215512345678`) or a BSUID (`^[A-Z]{2}\.[A-Za-z0-9]{1,128}$`, e.g. `MX.1264908862298277`) — the anonymous contact id Meta assigns on "Click to WhatsApp" flows, carried by inbound webhooks in `message.from_user_id`. If neither format matches, the API rejects with `400`. Note: a BSUID has no real phone number behind it, so if the send fails and an SMS fallback was requested, the chain is marked exhausted directly without attempting the SMS.
- `type` (enum, required)
  - Allowed values: `TEXT`, `IMAGE`, `VIDEO`, `AUDIO`, `DOCUMENT`, `STICKER`, `LOCATION`, `CONTACTS`, `REACTION`, `INTERACTIVE`, `TEMPLATE`
- `reply_to` (string, optional) — Optional. `message_id` (wamid) of a previous message this one replies to; the recipient sees it quoted.
- `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) — 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.

## Response

### 201

Message accepted by the provider.

- `message_id` (string, optional) — Message identifier in Meta (wamid.xxx). Comes empty (`""`) when the send failed synchronously and the SMS fallback was activated.
- `status` (string, optional) — Indicates that Meta accepted the send request (`accepted`), or `queued` when the send failed synchronously and the request included `fallback.sms` (the backup SMS was queued).
- `fallback_id` (string, optional) — Only present when the send failed **synchronously** and the request included `fallback.sms`: identifier to correlate the backup SMS in the webhooks (its status events arrive as SMS webhooks carrying this id as `message_id`, plus `origin_identifier` pointing back to the WhatsApp send). When the fallback fires later through a status webhook instead, correlate through `origin_identifier`.

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

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

### 429 Too Many Requests Error

The requests-per-minute limit was exceeded.

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

## Types

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

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

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

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

### InteractiveActionButtonsItems

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

### InteractiveActionSectionsItems

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

### TemplatePayloadCarouselItemsButtonsItems

- `index` (integer, optional)
- `text` (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. Minimum: 60 (1 hour); maximum: 4320 (72 hours). A value outside that range is rejected with `400`. Default: 1440 (24 hours).

### InteractiveActionButtonsItemsReply

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

### InteractiveActionSectionsItemsRowsItems

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

## Examples

### Text

**Request**

```json
{
  "to": "+5215512345678",
  "type": "TEXT",
  "text": {
    "body": "Hello, this is a test message"
  }
}
```

**Response**

```json
{
  "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
  "status": "accepted"
}
```

**SDK Code**

```python Text
import requests

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

payload = {
    "to": "+5215512345678",
    "type": "TEXT",
    "text": { "body": "Hello, this is a test message" }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Text
const url = 'https://connect.chatbridge.mx/v1/whatsapp/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"+5215512345678","type":"TEXT","text":{"body":"Hello, this is a test message"}}'
};

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

```go Text
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hello, this is a test message\"\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
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hello, this is a test message\"\n  }\n}"

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

```java Text
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hello, this is a test message\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/messages', [
  'body' => '{
  "to": "+5215512345678",
  "type": "TEXT",
  "text": {
    "body": "Hello, this is a test message"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Text
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hello, this is a test message\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Text
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "+5215512345678",
  "type": "TEXT",
  "text": ["body": "Hello, this is a test message"]
] as [String : Any]

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

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

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

dataTask.resume()
```

### Image

**Request**

```json
{
  "to": "+5215512345678",
  "type": "IMAGE",
  "image": {
    "link": "https://ejemplo.com/imagen.jpg",
    "caption": "This is a sample image"
  }
}
```

**Response**

```json
{
  "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
  "status": "accepted"
}
```

**SDK Code**

```python Image
import requests

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

payload = {
    "to": "+5215512345678",
    "type": "IMAGE",
    "image": {
        "link": "https://ejemplo.com/imagen.jpg",
        "caption": "This is a sample image"
    }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Image
const url = 'https://connect.chatbridge.mx/v1/whatsapp/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"+5215512345678","type":"IMAGE","image":{"link":"https://ejemplo.com/imagen.jpg","caption":"This is a sample image"}}'
};

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

```go Image
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"IMAGE\",\n  \"image\": {\n    \"link\": \"https://ejemplo.com/imagen.jpg\",\n    \"caption\": \"This is a sample image\"\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
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"IMAGE\",\n  \"image\": {\n    \"link\": \"https://ejemplo.com/imagen.jpg\",\n    \"caption\": \"This is a sample image\"\n  }\n}"

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

```java Image
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"IMAGE\",\n  \"image\": {\n    \"link\": \"https://ejemplo.com/imagen.jpg\",\n    \"caption\": \"This is a sample image\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/messages', [
  'body' => '{
  "to": "+5215512345678",
  "type": "IMAGE",
  "image": {
    "link": "https://ejemplo.com/imagen.jpg",
    "caption": "This is a sample image"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Image
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"IMAGE\",\n  \"image\": {\n    \"link\": \"https://ejemplo.com/imagen.jpg\",\n    \"caption\": \"This is a sample image\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Image
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "+5215512345678",
  "type": "IMAGE",
  "image": [
    "link": "https://ejemplo.com/imagen.jpg",
    "caption": "This is a sample image"
  ]
] as [String : Any]

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

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

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

dataTask.resume()
```

### Template with body variables

**Request**

```json
{
  "to": "+5215512345678",
  "type": "TEMPLATE",
  "template": {
    "_id": "69f9520edc73e2f8d0f706ac",
    "body": [
      {
        "position": 1,
        "text": "Juan Pérez"
      },
      {
        "position": 2,
        "text": "CLI-12345"
      }
    ]
  }
}
```

**Response**

```json
{
  "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
  "status": "accepted"
}
```

**SDK Code**

```python Template with body variables
import requests

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

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

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

print(response.json())
```

```javascript Template with body variables
const url = 'https://connect.chatbridge.mx/v1/whatsapp/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"+5215512345678","type":"TEMPLATE","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Juan Pérez"},{"position":2,"text":"CLI-12345"}]}}'
};

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

```go Template with body variables
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEMPLATE\",\n  \"template\": {\n    \"_id\": \"69f9520edc73e2f8d0f706ac\",\n    \"body\": [\n      {\n        \"position\": 1,\n        \"text\": \"Juan Pérez\"\n      },\n      {\n        \"position\": 2,\n        \"text\": \"CLI-12345\"\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 with body variables
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEMPLATE\",\n  \"template\": {\n    \"_id\": \"69f9520edc73e2f8d0f706ac\",\n    \"body\": [\n      {\n        \"position\": 1,\n        \"text\": \"Juan Pérez\"\n      },\n      {\n        \"position\": 2,\n        \"text\": \"CLI-12345\"\n      }\n    ]\n  }\n}"

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

```java Template with body variables
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Template with body variables
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Template with body variables
using RestSharp;

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

```swift Template with body variables
import Foundation

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

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

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

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

dataTask.resume()
```

### Interactive with buttons

**Request**

```json
{
  "to": "+5215512345678",
  "type": "INTERACTIVE",
  "interactive": {
    "type": "button",
    "body": {
      "text": "¿En qué podemos ayudarte?"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "ventas",
            "title": "Ventas"
          }
        }
      ]
    }
  }
}
```

**Response**

```json
{
  "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
  "status": "accepted"
}
```

**SDK Code**

```python Interactive with buttons
import requests

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

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

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

print(response.json())
```

```javascript Interactive with buttons
const url = 'https://connect.chatbridge.mx/v1/whatsapp/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"+5215512345678","type":"INTERACTIVE","interactive":{"type":"button","body":{"text":"¿En qué podemos ayudarte?"},"action":{"buttons":[{"type":"reply","reply":{"id":"ventas","title":"Ventas"}}]}}}'
};

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

```go Interactive with buttons
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"INTERACTIVE\",\n  \"interactive\": {\n    \"type\": \"button\",\n    \"body\": {\n      \"text\": \"¿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    }\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 with buttons
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"INTERACTIVE\",\n  \"interactive\": {\n    \"type\": \"button\",\n    \"body\": {\n      \"text\": \"¿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    }\n  }\n}"

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

```java Interactive with buttons
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"INTERACTIVE\",\n  \"interactive\": {\n    \"type\": \"button\",\n    \"body\": {\n      \"text\": \"¿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    }\n  }\n}")
  .asString();
```

```php Interactive with buttons
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Interactive with buttons
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"INTERACTIVE\",\n  \"interactive\": {\n    \"type\": \"button\",\n    \"body\": {\n      \"text\": \"¿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    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Interactive with buttons
import Foundation

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

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

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

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

dataTask.resume()
```

### Template with SMS fallback

**Request**

```json
{
  "to": "+5215512345678",
  "type": "TEMPLATE",
  "template": {
    "_id": "69f9520edc73e2f8d0f706ac",
    "body": [
      {
        "position": 1,
        "text": "Juan Pérez"
      }
    ]
  },
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.",
      "has_accents": true,
      "complement": {
        "link": "https://midominio.com/tracking/1234",
        "ttl_events": 1440
      }
    }
  }
}
```

**Response**

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

**SDK Code**

```python Template with SMS fallback
import requests

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

payload = {
    "to": "+5215512345678",
    "type": "TEMPLATE",
    "template": {
        "_id": "69f9520edc73e2f8d0f706ac",
        "body": [
            {
                "position": 1,
                "text": "Juan Pérez"
            }
        ]
    },
    "fallback": { "sms": {
            "mask": "665f1a2b3c4d5e6f7a8b9c0d",
            "text": "No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.",
            "has_accents": True,
            "complement": {
                "link": "https://midominio.com/tracking/1234",
                "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 with SMS fallback
const url = 'https://connect.chatbridge.mx/v1/whatsapp/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"+5215512345678","type":"TEMPLATE","template":{"_id":"69f9520edc73e2f8d0f706ac","body":[{"position":1,"text":"Juan Pérez"}]},"fallback":{"sms":{"mask":"665f1a2b3c4d5e6f7a8b9c0d","text":"No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.","has_accents":true,"complement":{"link":"https://midominio.com/tracking/1234","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 with SMS fallback
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEMPLATE\",\n  \"template\": {\n    \"_id\": \"69f9520edc73e2f8d0f706ac\",\n    \"body\": [\n      {\n        \"position\": 1,\n        \"text\": \"Juan Pérez\"\n      }\n    ]\n  },\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.\",\n      \"has_accents\": true,\n      \"complement\": {\n        \"link\": \"https://midominio.com/tracking/1234\",\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 with SMS fallback
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEMPLATE\",\n  \"template\": {\n    \"_id\": \"69f9520edc73e2f8d0f706ac\",\n    \"body\": [\n      {\n        \"position\": 1,\n        \"text\": \"Juan Pérez\"\n      }\n    ]\n  },\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.\",\n      \"has_accents\": true,\n      \"complement\": {\n        \"link\": \"https://midominio.com/tracking/1234\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"+5215512345678\",\n  \"type\": \"TEMPLATE\",\n  \"template\": {\n    \"_id\": \"69f9520edc73e2f8d0f706ac\",\n    \"body\": [\n      {\n        \"position\": 1,\n        \"text\": \"Juan Pérez\"\n      }\n    ]\n  },\n  \"fallback\": {\n    \"sms\": {\n      \"mask\": \"665f1a2b3c4d5e6f7a8b9c0d\",\n      \"text\": \"No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.\",\n      \"has_accents\": true,\n      \"complement\": {\n        \"link\": \"https://midominio.com/tracking/1234\",\n        \"ttl_events\": 1440\n      }\n    }\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/messages', [
  'body' => '{
  "to": "+5215512345678",
  "type": "TEMPLATE",
  "template": {
    "_id": "69f9520edc73e2f8d0f706ac",
    "body": [
      {
        "position": 1,
        "text": "Juan Pérez"
      }
    ]
  },
  "fallback": {
    "sms": {
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.",
      "has_accents": true,
      "complement": {
        "link": "https://midominio.com/tracking/1234",
        "ttl_events": 1440
      }
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Template with SMS fallback
using RestSharp;

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

```swift Template with SMS fallback
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "+5215512345678",
  "type": "TEMPLATE",
  "template": [
    "_id": "69f9520edc73e2f8d0f706ac",
    "body": [
      [
        "position": 1,
        "text": "Juan Pérez"
      ]
    ]
  ],
  "fallback": ["sms": [
      "mask": "665f1a2b3c4d5e6f7a8b9c0d",
      "text": "No pudimos contactarte por WhatsApp. Tu pedido #1234 está confirmado.",
      "has_accents": true,
      "complement": [
        "link": "https://midominio.com/tracking/1234",
        "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/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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

dataTask.resume()
```

### Send to a BSUID (Click to WhatsApp contact)

**Request**

```json
{
  "to": "MX.1264908862298277",
  "type": "TEXT",
  "text": {
    "body": "Hola, gracias por contactarnos"
  }
}
```

**Response**

```json
{
  "message_id": "wamid.HBgNNTIxNTUxMjM0NTY3OBUCABIYIDNBMzk3RjdGNzY5QzQxRjhCMzY5",
  "status": "accepted"
}
```

**SDK Code**

```python Send to a BSUID (Click to WhatsApp contact)
import requests

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

payload = {
    "to": "MX.1264908862298277",
    "type": "TEXT",
    "text": { "body": "Hola, gracias por contactarnos" }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Send to a BSUID (Click to WhatsApp contact)
const url = 'https://connect.chatbridge.mx/v1/whatsapp/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"to":"MX.1264908862298277","type":"TEXT","text":{"body":"Hola, gracias por contactarnos"}}'
};

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

```go Send to a BSUID (Click to WhatsApp contact)
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"to\": \"MX.1264908862298277\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hola, gracias por contactarnos\"\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 Send to a BSUID (Click to WhatsApp contact)
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"MX.1264908862298277\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hola, gracias por contactarnos\"\n  }\n}"

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

```java Send to a BSUID (Click to WhatsApp contact)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/whatsapp/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"MX.1264908862298277\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hola, gracias por contactarnos\"\n  }\n}")
  .asString();
```

```php Send to a BSUID (Click to WhatsApp contact)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/whatsapp/messages', [
  'body' => '{
  "to": "MX.1264908862298277",
  "type": "TEXT",
  "text": {
    "body": "Hola, gracias por contactarnos"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Send to a BSUID (Click to WhatsApp contact)
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/whatsapp/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"to\": \"MX.1264908862298277\",\n  \"type\": \"TEXT\",\n  \"text\": {\n    \"body\": \"Hola, gracias por contactarnos\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Send to a BSUID (Click to WhatsApp contact)
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "to": "MX.1264908862298277",
  "type": "TEXT",
  "text": ["body": "Hola, gracias por contactarnos"]
] as [String : Any]

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

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

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

dataTask.resume()
```