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

# Start a conversation

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

Sends a first message to a phone number on WhatsApp or to an email address, and records it
as a conversation so the recipient's reply threads into it. This is the endpoint behind
the dashboard's "New message" composer. Use it when you have an address but not
necessarily a contact. If you already have a `contactId` and do not need the message in a
thread, `POST /api/whatsapp/send` and `POST /api/email/send` are the lower-level sends.

**How it works.**

1. The recipient is validated: E.164 for `whatsapp`, a valid address for `email`.
2. The contact is looked up anywhere in the workspace. Email matching ignores case; WhatsApp
   matches `whatsapp_number` exactly. An unknown recipient is created in the workspace's
   "Manual Conversations" campaign. A contact already enrolled elsewhere is **not** moved.
3. The message is delivered through the channel's provider, with every guard of the
   lower-level send applied (compliance, opt-out, 24-hour window, daily cap).
4. Only after delivery succeeds is the conversation found, reopened or created, using the
   same thread key inbound messages use, and the message stored with
   `metadata.manual = true`.

On WhatsApp, pass `templateId` to reach a contact outside WhatsApp's 24-hour window. `message` is
then optional, and the thread records `[template] <templateId>` as the content. On email,
`subject` is required. `webchat`, `instagram` and `messenger` cannot be started from here.

**Side effects.** Sends a real WhatsApp message or a real email from the
workspace's connected mailbox. Consumes one unit of the channel's daily send cap. The unit
is refunded if the provider rejects the send. It does **not** draw on the AI-message
allowance. The AI reply to the contact's answer does. May create a contact, and the "Manual
Conversations" campaign on first use. Broadcasts a realtime update to the dashboard and
writes an audit entry.

**Idempotency.** Not idempotent. A retry after a timeout delivers the message a second time.
The conversation row is reused, so both copies land in the same thread. Check
`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–600 requests/min per workspace by plan) **and** the configuration-mutations limiter — 10 requests/min per workspace, a budget shared with other configuration mutations. See [Rate limits](/rate-limits).
* **Plan:** Available on every plan. The workspace needs at least one agent, a WhatsApp sender that is `ONLINE` for WhatsApp, and a connected mailbox for email.

Reference: https://developer.jelliu.co/api-reference/conversations/post-conversations

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

- `recipient` (string, required) — Who to write to. An E.164 phone number (`+` and country code) for `whatsapp`; an email address for `email`. An invalid value returns 400 with `Phone number must be E.164 format (e.g. +14155551234)` or `Invalid email address`.
- `channel` (enum, required) — Channel to start the conversation on. - `whatsapp`: sent from the workspace's WhatsApp sender. - `email`: sent from the workspace's connected Gmail, Outlook or Zoho Mail mailbox.
  - Allowed values: `whatsapp`, `email`
- `message` (string, optional) — Text of the message, sent exactly as written. Required unless a WhatsApp `templateId` is sent. On WhatsApp freeform text is only accepted inside the 24-hour window.
- `subject` (string, optional) — Email subject. Required when `channel` is `email`; ignored on WhatsApp.
- `templateId` (string, optional) — WhatsApp only. Id of one of the workspace's WhatsApp templates. It must be `approved`, or the call fails with `422 TEMPLATE_NOT_APPROVED`. Templates can be sent regardless of the 24-hour window.
- `templateVariables` (list of string or map from string to string, optional) — Values for the template placeholders. Either an ordered list, where the first item fills `{{1}}`, or an object keyed by placeholder number. Ignored without `templateId`.

## Response

### 201

Message delivered and recorded in the conversation.

- `data` (object, required)
  - `conversationId` (string, required) — The conversation the message was recorded in (new, reused or reopened).
  - `contactId` (string, required) — The existing or newly created contact.
  - `channel` (enum, required) — Channel the message went out on.
    - Allowed values: `whatsapp`, `email`
  - `externalMessageId` (string, required, nullable) — Carrier message id for WhatsApp. Always `null` for email.

## Errors

### 400 Bad Request Error

The body failed validation (`Invalid request body`, field map in `details`), the recipient is malformed, or WhatsApp refused the recipient (`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. WhatsApp opt-outs use `CONTACT_OPTED_OUT`. Email refusals from the provider layer use `EMAIL_SEND_FAILED` with the email service's 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).

### 404 Not Found Error

`TEMPLATE_NOT_FOUND`: 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 sending identity is not usable yet. On WhatsApp the sender is still being approved or is offline (`SENDER_NOT_REGISTERED`). On email the workspace has no mailbox of its own (`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 workspace has no agent to own the thread, or WhatsApp refused the send: `OUTSIDE_24H_WINDOW` (freeform outside the window), `TEMPLATE_NOT_APPROVED`, or `SENDER_NOT_REGISTERED` (no WhatsApp sender set up).

- `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. Allowed hours apply to WhatsApp only. The code is `COMPLIANCE_BLOCKED` on WhatsApp and `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 (`RATE_LIMIT_EXCEEDED`), the daily send cap for the channel is used up (`DAILY_CAP_REACHED` on WhatsApp, `EMAIL_SEND_FAILED` on email), or the provider 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

**Request**

```json
undefined
```

**Response**

```json
{
  "data": {
    "conversationId": "3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b",
    "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
    "channel": "whatsapp",
    "externalMessageId": "SM0123456789abcdef0123456789abcdef"
  }
}
```

**SDK Code**

```python WhatsApp
import requests

url = "https://api.jelliu.co/api/conversations"

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

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

print(response.json())
```

```javascript WhatsApp
const url = 'https://api.jelliu.co/api/conversations';
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
package main

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

func main() {

	url := "https://api.jelliu.co/api/conversations"

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

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

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

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

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

$client = new \GuzzleHttp\Client();

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

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

```csharp WhatsApp
using RestSharp;

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

```swift WhatsApp
import Foundation

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

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

### Email

**Request**

```json
{
  "recipient": "maria.rojas@correo.co",
  "channel": "email",
  "message": "Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.",
  "subject": "Cotización solicitada"
}
```

**Response**

```json
{
  "data": {
    "conversationId": "8e2d4c6b-1a3f-4e5d-9c7b-2a4e6f8d0c1b",
    "contactId": "b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e",
    "channel": "email",
    "externalMessageId": null
  }
}
```

**SDK Code**

```python Email
import requests

url = "https://api.jelliu.co/api/conversations"

payload = {
    "recipient": "maria.rojas@correo.co",
    "channel": "email",
    "message": "Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.",
    "subject": "Cotización solicitada"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Email
const url = 'https://api.jelliu.co/api/conversations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"recipient":"maria.rojas@correo.co","channel":"email","message":"Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.","subject":"Cotización solicitada"}'
};

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

```go Email
package main

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

func main() {

	url := "https://api.jelliu.co/api/conversations"

	payload := strings.NewReader("{\n  \"recipient\": \"maria.rojas@correo.co\",\n  \"channel\": \"email\",\n  \"message\": \"Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.\",\n  \"subject\": \"Cotización solicitada\"\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 Email
require 'uri'
require 'net/http'

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

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  \"recipient\": \"maria.rojas@correo.co\",\n  \"channel\": \"email\",\n  \"message\": \"Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.\",\n  \"subject\": \"Cotización solicitada\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/conversations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"recipient\": \"maria.rojas@correo.co\",\n  \"channel\": \"email\",\n  \"message\": \"Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.\",\n  \"subject\": \"Cotización solicitada\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/conversations', [
  'body' => '{
  "recipient": "maria.rojas@correo.co",
  "channel": "email",
  "message": "Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.",
  "subject": "Cotización solicitada"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Email
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/conversations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"recipient\": \"maria.rojas@correo.co\",\n  \"channel\": \"email\",\n  \"message\": \"Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.\",\n  \"subject\": \"Cotización solicitada\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Email
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "recipient": "maria.rojas@correo.co",
  "channel": "email",
  "message": "Hola María, te comparto el detalle de la cotización para 40 unidades que conversamos por teléfono.",
  "subject": "Cotización solicitada"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/conversations")! 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 freeform (contact inside the 24-hour window)

**Request**

```json
{
  "recipient": "+573001234567",
  "channel": "whatsapp",
  "message": "Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30."
}
```

**Response**

```json
{
  "data": {
    "conversationId": "3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b",
    "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
    "channel": "whatsapp",
    "externalMessageId": "SM0123456789abcdef0123456789abcdef"
  }
}
```

**SDK Code**

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

url = "https://api.jelliu.co/api/conversations"

payload = {
    "recipient": "+573001234567",
    "channel": "whatsapp",
    "message": "Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30."
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript WhatsApp freeform (contact inside the 24-hour window)
const url = 'https://api.jelliu.co/api/conversations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"recipient":"+573001234567","channel":"whatsapp","message":"Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30."}'
};

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

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

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

func main() {

	url := "https://api.jelliu.co/api/conversations"

	payload := strings.NewReader("{\n  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\n  \"message\": \"Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30.\"\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 freeform (contact inside the 24-hour window)
require 'uri'
require 'net/http'

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

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  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\n  \"message\": \"Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30.\"\n}"

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

```java WhatsApp 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/conversations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\n  \"message\": \"Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30.\"\n}")
  .asString();
```

```php WhatsApp 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/conversations', [
  'body' => '{
  "recipient": "+573001234567",
  "channel": "whatsapp",
  "message": "Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30."
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

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

var client = new RestClient("https://api.jelliu.co/api/conversations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\n  \"message\": \"Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

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

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "recipient": "+573001234567",
  "channel": "whatsapp",
  "message": "Hola María, te escribimos de Clínica Dental Sonrisa para confirmar tu cita de mañana a las 10:30."
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/conversations")! 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 approved template (outside the window)

**Request**

```json
{
  "recipient": "+573001234567",
  "channel": "whatsapp",
  "templateId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "templateVariables": [
    "María",
    "10:30"
  ]
}
```

**Response**

```json
{
  "data": {
    "conversationId": "3f1c2a9e-5b7d-4e8f-9a01-2c3d4e5f6a7b",
    "contactId": "7d6c5b4a-3f2e-4d1c-8b9a-0e1f2a3b4c5d",
    "channel": "whatsapp",
    "externalMessageId": "SM0123456789abcdef0123456789abcdef"
  }
}
```

**SDK Code**

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

url = "https://api.jelliu.co/api/conversations"

payload = {
    "recipient": "+573001234567",
    "channel": "whatsapp",
    "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 WhatsApp approved template (outside the window)
const url = 'https://api.jelliu.co/api/conversations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"recipient":"+573001234567","channel":"whatsapp","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 WhatsApp approved template (outside the window)
package main

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

func main() {

	url := "https://api.jelliu.co/api/conversations"

	payload := strings.NewReader("{\n  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\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 WhatsApp approved template (outside the window)
require 'uri'
require 'net/http'

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

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  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\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 WhatsApp approved template (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")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\n  \"templateId\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n  \"templateVariables\": [\n    \"María\",\n    \"10:30\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

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

var client = new RestClient("https://api.jelliu.co/api/conversations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"recipient\": \"+573001234567\",\n  \"channel\": \"whatsapp\",\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 WhatsApp approved template (outside the window)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "recipient": "+573001234567",
  "channel": "whatsapp",
  "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/conversations")! 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()
```