Delay
The Delay endpoint calculates the optimal send time for a template variant. Use it to implement send-time optimization — scheduling messages to arrive when each user is most likely to engage.
Endpoint
Section titled “Endpoint”GET https://worker.justwords.ai/api/delay/:org_slugAuthentication
Section titled “Authentication”This endpoint requires authentication via an API key. Include your key in the X-Api-Key header or as a Bearer token in the Authorization header.
See the Quickstart for details on creating and managing API keys.
Request
Section titled “Request”Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
org_slug | string | Yes | Your organization identifier (e.g., your-company-name). |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
delay_id | string | Yes | The variant ID to calculate a delay for (typically from a prior Generate response). |
user_id | string | No | Unique identifier for the end user (used for per-user optimization). |
email | string | No | Email address of the end user (alternative to user_id). |
Examples
Section titled “Examples”Basic Request
Section titled “Basic Request”curl "https://worker.justwords.ai/api/delay/your-org?delay_id=variant_abc123&user_id=user_123" \ -H "X-Api-Key: your_api_key"const params = new URLSearchParams({ delay_id: 'variant_abc123', user_id: 'user_123',});
const response = await fetch( `https://worker.justwords.ai/api/delay/your-org?${params}`, { headers: { 'X-Api-Key': 'your_api_key', }, });
const data = await response.json();console.log(data.just_words);import requests
url = "https://worker.justwords.ai/api/delay/your-org"headers = { "X-Api-Key": "your_api_key"}params = { "delay_id": "variant_abc123", "user_id": "user_123"}
response = requests.get(url, headers=headers, params=params)data = response.json()print(data["just_words"])Typical Workflow
Section titled “Typical Workflow”- Call the Generate endpoint to select a variant.
- Pass the returned
copy.idas thedelay_idto this endpoint. - Schedule your message to send at the returned
delay_time.
Response
Section titled “Response”Success Response (200 OK)
Section titled “Success Response (200 OK)”{ "just_words": { "delay_id": "variant_abc123", "delay_time": "2024-01-15T14:30:00.000Z" }}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
just_words.delay_id | string | The variant ID that was evaluated. |
just_words.delay_time | string | ISO-8601 timestamp indicating when the message should be sent. |