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

# Send a WhatsApp message

POST https://api.jelliu.co/api/whatsapp/send
Content-Type: application/json

Sends a WhatsApp message to an existing contact, in one of two forms you
choose:

* **Freeform:** send `message`. Only allowed while the contact is inside WhatsApp's 24-hour
  customer-service window (they wrote to your WhatsApp line in the last 24 hours). Outside
  it, the call fails with `422 OUTSIDE_24H_WINDOW` **before** the cap is touched or the telephony carrier is
  called.
* **Template:** send `templateId` and optional `templateVariables`. Works whether or not the
  window is open, but the template must be `approved`. When both are sent, the template wins.

If you cannot know the window state, as with an AI agent, use `POST /api/whatsapp/reach`,
which picks the form for you.

The message goes out from the workspace's `ONLINE` WhatsApp sender, preferring the line the
contact last wrote to so the reply stays in the same thread. `status` is the carrier's initial status (usually `queued`). Delivery updates arrive later through the carrier's status callbacks.
The message is **not** added to a conversation thread. To have it recorded, use
`POST /api/conversations` or `POST /api/conversations/{conversationId}/messages`.

**Checks, in order:** contact exists in the workspace with a `whatsapp_number`
(`NO_WHATSAPP_NUMBER` otherwise, even for an unknown `contactId`), compliance rules
(`COMPLIANCE_BLOCKED`), opt-out (`CONTACT_OPTED_OUT`), template or window, daily send cap
(`DAILY_CAP_REACHED`), then sender resolution (`SENDER_NOT_REGISTERED`).

**Side effects.** Sends a real WhatsApp message that WhatsApp bills to the workspace's WhatsApp
account, since a template opens a business-initiated conversation. Consumes one unit of the
daily WhatsApp send cap: 1,000 per UTC day by default, 25,000 on plans with no monthly
limit. The unit is refunded if the telephony carrier rejects the send. Does not draw on the AI-message
allowance. Writes an audit entry.

**Idempotency.** Not idempotent. There is no dedup, so a retry after a timeout can deliver
the message twice. Treat a timeout as "possibly sent".

**Webhook events.** `audit.log_recorded` for subscribers that selected it explicitly. See [Webhooks](/webhooks).

**Access**

* **Required scope:** `write`.
* **Rate limit:** Outbound — 20 requests/min per workspace, fail-closed, counted on every `/api/whatsapp` request **and** the configuration-mutations limiter — 10 requests/min per workspace, shared with other configuration mutations. See [Rate limits](/rate-limits).
* **Plan:** Available on every plan. Requires a WhatsApp sender in `ONLINE` status.

Reference: https://developer.jelliu.co/api-reference/whats-app/post-whatsapp-send

## Authentication

- `Authorization` header (bearer token, required) — Workspace API key: `jl_` followed by 64 lowercase hex characters, created by the workspace owner in the dashboard (**Settings → API Keys**) and sent as `Authorization: Bearer jl_...`. The plaintext is shown once, at creation; Jelliu stores only a SHA-256 hash. A workspace can hold up to 25 active keys. | Scope | GET / HEAD | POST / PUT / PATCH / DELETE | Admin-only routes | | --- | --- | --- | --- | | `read` | Yes | No | No | | `write` | Yes | Yes | No | | `full` | Yes | Yes | Yes | Operations restricted to admins or owners reject keys without the `full` scope with `403`, and say so in their description. No key, whatever its scope, can mint or revoke API keys or rotate a webhook secret — that requires a signed-in owner session. A revoked key stops authenticating within about 10 seconds. See [Authentication](/authentication).

## Request

### Body (application/json)

This endpoint expects an object.

- `contactId` (string, required) — Contact to message. Must belong to the workspace and have a `whatsapp_number`.
- `message` (string, optional) — Freeform text, trimmed before sending. Only accepted inside the 24-hour window. Ignored when `templateId` is sent.
- `templateId` (string, optional) — Id of an approved WhatsApp template of the workspace. Sendable at any time.
- `templateVariables` (list of string or map from string to string, optional) — Values for the template placeholders. An ordered list fills `{{1}}`, `{{2}}`, … in order. An object is used as-is, keyed by placeholder number. Only used with `templateId`. Empty lists or objects are treated as absent.

## Response

### 200

The telephony carrier accepted the message.

- `data` (object, required)
  - `messageSid` (string, required) — Carrier message id. Delivery status callbacks refer to it.
  - `status` (string, required) — The carrier's initial message status, usually `queued` or `accepted`.

## Errors

### 400 Bad Request Error

Body failed validation (`Invalid input`, field map in `details`), or a send refusal: `NO_WHATSAPP_NUMBER` (the contact is unknown or has no WhatsApp number), `INVALID_RECIPIENT` (the telephony carrier rejected the number).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 401 Unauthorized Error

No usable credential. Either the `Authorization` header is missing or is not a well-formed `Bearer jl_…` key, or the key is unknown, revoked or expired. Do not retry with the same key. See [Authentication](/authentication#401-unauthorized).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 403 Forbidden Error

The contact opted out or is marked do-not-contact, or the API key lacks the `write` scope.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 404 Not Found Error

The `templateId` does not exist in this workspace or was deleted.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 409 Conflict Error

The workspace's WhatsApp sender exists but is not `ONLINE` yet (being approved) or is offline.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 422 Unprocessable Entity Error

`OUTSIDE_24H_WINDOW` (freeform outside the window: send a template), `TEMPLATE_NOT_APPROVED`, or `SENDER_NOT_REGISTERED` (no sender set up, or the telephony carrier does not recognise the sender number).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 423 Locked Error

`COMPLIANCE_BLOCKED`: do-not-contact list, opt-out suppression list, blocked prefix, or outside the workspace's allowed hours.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 429 Too Many Requests Error

A request limiter was exceeded, the daily WhatsApp send cap is used up (`DAILY_CAP_REACHED`), or the carrier or WhatsApp is throttling (`RATE_LIMITED`).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 502 Bad Gateway Error

`WHATSAPP_SEND_FAILED`: the telephony carrier returned an error Jelliu does not map. The carrier's error code is kept in the message.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

## Examples

### WhatsApp_postWhatsappSend_example

**Request**

```json
undefined
```

**Response**

```json
{
  "data": {
    "messageSid": "SM0123456789abcdef0123456789abcdef",
    "status": "queued"
  }
}
```

**SDK Code**

```python WhatsApp_postWhatsappSend_example
import requests

url = "https://api.jelliu.co/api/whatsapp/send"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript WhatsApp_postWhatsappSend_example
const url = 'https://api.jelliu.co/api/whatsapp/send';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go WhatsApp_postWhatsappSend_example
package main

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

func main() {

	url := "https://api.jelliu.co/api/whatsapp/send"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby WhatsApp_postWhatsappSend_example
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/whatsapp/send")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/whatsapp/send")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/whatsapp/send', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp WhatsApp_postWhatsappSend_example
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/whatsapp/send");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift WhatsApp_postWhatsappSend_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/whatsapp/send")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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

### Freeform (contact inside the 24-hour window)

**Request**

```json
{
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "message": "Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?"
}
```

**Response**

```json
{
  "data": {
    "messageSid": "SM0123456789abcdef0123456789abcdef",
    "status": "queued"
  }
}
```

**SDK Code**

```python Freeform (contact inside the 24-hour window)
import requests

url = "https://api.jelliu.co/api/whatsapp/send"

payload = {
    "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
    "message": "Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Freeform (contact inside the 24-hour window)
const url = 'https://api.jelliu.co/api/whatsapp/send';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"contactId":"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d","message":"Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?"}'
};

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

```go Freeform (contact inside the 24-hour window)
package main

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

func main() {

	url := "https://api.jelliu.co/api/whatsapp/send"

	payload := strings.NewReader("{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"message\": \"Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Freeform (contact inside the 24-hour window)
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/whatsapp/send")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"message\": \"Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?\"\n}"

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

```java Freeform (contact inside the 24-hour window)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/whatsapp/send")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"message\": \"Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?\"\n}")
  .asString();
```

```php Freeform (contact inside the 24-hour window)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/whatsapp/send', [
  'body' => '{
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "message": "Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Freeform (contact inside the 24-hour window)
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/whatsapp/send");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"message\": \"Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Freeform (contact inside the 24-hour window)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "message": "Hola María, ya tenemos lista tu cotización. ¿Te la envío por aquí?"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/whatsapp/send")! 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()
```

### Approved template (any time)

**Request**

```json
{
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": [
    "María",
    "10:30"
  ]
}
```

**Response**

```json
{
  "data": {
    "messageSid": "SM0123456789abcdef0123456789abcdef",
    "status": "queued"
  }
}
```

**SDK Code**

```python Approved template (any time)
import requests

url = "https://api.jelliu.co/api/whatsapp/send"

payload = {
    "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
    "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
    "templateVariables": ["María", "10:30"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Approved template (any time)
const url = 'https://api.jelliu.co/api/whatsapp/send';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"contactId":"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d","templateId":"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d","templateVariables":["María","10:30"]}'
};

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

```go Approved template (any time)
package main

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

func main() {

	url := "https://api.jelliu.co/api/whatsapp/send"

	payload := strings.NewReader("{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"10:30\"\n  ]\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Approved template (any time)
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/whatsapp/send")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"10:30\"\n  ]\n}"

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

```java Approved template (any time)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/whatsapp/send")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"10:30\"\n  ]\n}")
  .asString();
```

```php Approved template (any time)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/whatsapp/send', [
  'body' => '{
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": [
    "María",
    "10:30"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Approved template (any time)
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/whatsapp/send");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"10:30\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Approved template (any time)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": ["María", "10:30"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/whatsapp/send")! 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()
```

### Approved template with keyed variables

**Request**

```json
{
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": {
    "1": "María",
    "2": "10:30"
  }
}
```

**Response**

```json
{
  "data": {
    "messageSid": "SM0123456789abcdef0123456789abcdef",
    "status": "queued"
  }
}
```

**SDK Code**

```python Approved template with keyed variables
import requests

url = "https://api.jelliu.co/api/whatsapp/send"

payload = {
    "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
    "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
    "templateVariables": {
        "1": "María",
        "2": "10:30"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Approved template with keyed variables
const url = 'https://api.jelliu.co/api/whatsapp/send';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"contactId":"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d","templateId":"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d","templateVariables":{"1":"María","2":"10:30"}}'
};

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

```go Approved template with keyed variables
package main

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

func main() {

	url := "https://api.jelliu.co/api/whatsapp/send"

	payload := strings.NewReader("{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": {\n    \"1\": \"María\",\n    \"2\": \"10:30\"\n  }\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Approved template with keyed variables
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/whatsapp/send")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": {\n    \"1\": \"María\",\n    \"2\": \"10:30\"\n  }\n}"

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

```java Approved template with keyed variables
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/whatsapp/send")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": {\n    \"1\": \"María\",\n    \"2\": \"10:30\"\n  }\n}")
  .asString();
```

```php Approved template with keyed variables
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/whatsapp/send', [
  'body' => '{
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": {
    "1": "María",
    "2": "10:30"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Approved template with keyed variables
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/whatsapp/send");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"contactId\": \"7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": {\n    \"1\": \"María\",\n    \"2\": \"10:30\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Approved template with keyed variables
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": [
    "1": "María",
    "2": "10:30"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/whatsapp/send")! 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()
```