> 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 an operator reply

POST https://api.jelliu.co/api/conversations/{conversationId}/messages
Content-Type: application/json

Adds a reply written by a person to an existing conversation. This is the human takeover
path. The AI agent is **not** invoked for this reply and does not answer on top of it. The
agent still answers the contact's next inbound message as usual.

**Delivery depends on the thread's channel.**

* **WhatsApp:** delivered **before** anything is stored. If WhatsApp refuses
  (24-hour window, opt-out, compliance, cap), nothing is written and the refusal is returned.
  Pass `templateId` instead of `message` when the contact is outside the 24-hour window.
* **Email:** sent from the workspace's connected mailbox, then stored. The subject is taken
  from the thread (latest recorded subject, prefixed `Re:` once), falling back to
  `Re: su conversación`.
* **Webchat:** stored and pushed to the visitor's open widget in real time. A visitor
  without an open widget sees it the next time the history loads.
* **Instagram / Messenger:** refused with 422. Dashboard replies are not available there yet.

The stored message has `role: agent` and `metadata.manual = true` (plus
`provider_message_id` and `template_id` when applicable). Template replies are recorded as
`[template] <templateId>`.

**Side effects.** Sends a real WhatsApp message or email to the customer. Provider-backed
sends consume one unit of the channel's daily cap. Replies written by people never draw on
the AI-message allowance. Broadcasts realtime updates to the dashboard and the visitor's
widget, clears the conversation caches, and writes an audit entry.

**Idempotency.** Not idempotent. A retry after a timeout sends and stores the reply twice.
Re-read the thread with `GET /api/conversations/{conversationId}` before retrying.

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

**Access**

* **Required scope:** `write`.
* **Rate limit:** General API — 120 requests/min per workspace (Starter), 200 (Growth), 300 (Business), 600 (Enterprise). See [Rate limits](/rate-limits).
* **Plan:** Available on every plan.

Reference: https://developer.jelliu.co/api-reference/conversations/post-conversations-by-conversation-id-messages

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

### Path parameters

- `conversationId` (string, required) — Id of the conversation to reply on. A value that is not a UUID returns 400.

### Body (application/json)

This endpoint expects an object.

- `message` (string, optional) — Reply text, trimmed and sent as written. Required unless `templateId` is sent. Email threads always need `message`.
- `templateId` (string, optional) — WhatsApp conversations only. Id of an approved template of the workspace, for contacts outside the 24-hour window. On any other channel the call returns 400 `templateId is only supported on WhatsApp conversations`.
- `templateVariables` (list of string or map from string to string, optional) — Values for the template placeholders, as an ordered list (`{{1}}` first) or an object keyed by placeholder number. Ignored without `templateId`.

## Response

### 201

Reply delivered (for WhatsApp and email) and stored.

- `data` (object, required)
  - `messageId` (string, required) — Id of the stored message.
  - `conversationId` (string, required) — The conversation replied on.

## Errors

### 400 Bad Request Error

Invalid path id, invalid body (`Invalid request body`, field map in `details`), a template on a non-WhatsApp thread, or a WhatsApp recipient refusal (`NO_WHATSAPP_NUMBER`, `INVALID_RECIPIENT`).

- `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 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 conversation does not exist in this workspace, or the WhatsApp `templateId` does not.

- `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 sending identity is not usable: WhatsApp sender pending/offline (`SENDER_NOT_REGISTERED`) or no connected mailbox for email (`EMAIL_SEND_FAILED`).

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

The thread has no contact to deliver to, the channel has no dashboard replies (Instagram, Messenger), or WhatsApp refused the send (`OUTSIDE_24H_WINDOW`, `TEMPLATE_NOT_APPROVED`, `SENDER_NOT_REGISTERED`).

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

Blocked by compliance rules (do-not-contact list, blocked prefix, or allowed hours on WhatsApp). `COMPLIANCE_BLOCKED` on WhatsApp, `EMAIL_SEND_FAILED` on email.

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

Too many requests this minute, the channel's daily send cap is used up, or the provider is throttling.

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

### Conversations_postConversationsByConversationIdMessages_example

**Request**

```json
undefined
```

**Response**

```json
{
  "data": {
    "messageId": "c3d4e5f6-a7b8-4c9d-8e0f-2a3b4c5d6e7f",
    "conversationId": "3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b"
  }
}
```

**SDK Code**

```python Conversations_postConversationsByConversationIdMessages_example
import requests

url = "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages"

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

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

print(response.json())
```

```javascript Conversations_postConversationsByConversationIdMessages_example
const url = 'https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages';
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 Conversations_postConversationsByConversationIdMessages_example
package main

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

func main() {

	url := "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages"

	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 Conversations_postConversationsByConversationIdMessages_example
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages")

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 Conversations_postConversationsByConversationIdMessages_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Conversations_postConversationsByConversationIdMessages_example
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Conversations_postConversationsByConversationIdMessages_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages")! 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 reply

**Request**

```json
{
  "message": "Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades."
}
```

**Response**

```json
{
  "data": {
    "messageId": "c3d4e5f6-a7b8-4c9d-8e0f-2a3b4c5d6e7f",
    "conversationId": "3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b"
  }
}
```

**SDK Code**

```python Freeform reply
import requests

url = "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages"

payload = { "message": "Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades." }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Freeform reply
const url = 'https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"message":"Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades."}'
};

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

```go Freeform reply
package main

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

func main() {

	url := "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages"

	payload := strings.NewReader("{\n  \"message\": \"Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades.\"\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 reply
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages")

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  \"message\": \"Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades.\"\n}"

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

```java Freeform reply
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"message\": \"Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades.\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages', [
  'body' => '{
  "message": "Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades."
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Freeform reply
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"message\": \"Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Freeform reply
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["message": "Hola María, soy Laura del equipo comercial. Te puedo ofrecer un 8 % de descuento por las 40 unidades."] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/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()
```

### WhatsApp template reply (outside the window)

**Request**

```json
{
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": [
    "María",
    "8 %"
  ]
}
```

**Response**

```json
{
  "data": {
    "messageId": "c3d4e5f6-a7b8-4c9d-8e0f-2a3b4c5d6e7f",
    "conversationId": "3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b"
  }
}
```

**SDK Code**

```python WhatsApp template reply (outside the window)
import requests

url = "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages"

payload = {
    "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
    "templateVariables": ["María", "8 %"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript WhatsApp template reply (outside the window)
const url = 'https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"templateId":"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d","templateVariables":["María","8 %"]}'
};

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

```go WhatsApp template reply (outside the window)
package main

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

func main() {

	url := "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages"

	payload := strings.NewReader("{\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"8 %\"\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 WhatsApp template reply (outside the window)
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages")

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  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"8 %\"\n  ]\n}"

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

```java WhatsApp template reply (outside the window)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"8 %\"\n  ]\n}")
  .asString();
```

```php WhatsApp template reply (outside the window)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages', [
  'body' => '{
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": [
    "María",
    "8 %"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp WhatsApp template reply (outside the window)
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"8 %\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift WhatsApp template reply (outside the window)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": ["María", "8 %"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/conversations/3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b/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()
```