Check the Conversation Window
Automate this endpoint with an AI agent using the 2chat-whatsapp-waba skill:
npx skills add 2ChatCo/agent-skills -s 2chat-whatsapp-waba
Check whether the WhatsApp 24-hour customer service window is open between one of your WABA numbers and a contact.
The window opens when the contact sends you a message, and stays open for 24 hours from that last inbound message. While it is open you can send free-form messages; once it closes, only approved templates are deliverable. Call this endpoint before a send to decide whether to use a free-form message or a template.
Requires a WhatsApp Business API (WABA) channel connected to your 2Chat account. See How to connect WABA to 2Chat.
Endpoint
GET https://api.p.2chat.io/open/waba/conversation-window/{from_number}/{to_number}
Authentication
Send your API key in the X-User-API-Key header. See Authentication.
Path parameters
| Parameter | Description | Example |
|---|---|---|
from_number | Your WABA number, in E.164 format. The leading + is optional — both +15550001111 and 15550001111 are accepted. Required. | +15550001111 |
to_number | The contact's phone number, in E.164 format. The leading + is optional. Required. | +15552223333 |
Invocation
- cURL
- Python
- JavaScript
- PHP
curl --request GET \
--url 'https://api.p.2chat.io/open/waba/conversation-window/+15550001111/+15552223333' \
--header 'X-User-API-Key: your_api_key_here'
import requests
from_number = "+15550001111"
to_number = "+15552223333"
url = f"https://api.p.2chat.io/open/waba/conversation-window/{from_number}/{to_number}"
headers = {
"X-User-API-Key": "your_api_key_here"
}
response = requests.get(url, headers=headers)
window = response.json()
if window.get("window_open"):
print("Free-form messages allowed for", window["seconds_left"], "more seconds")
else:
print("Window closed — send an approved template instead")
const axios = require('axios');
const fromNumber = '+15550001111';
const toNumber = '+15552223333';
axios.get(`https://api.p.2chat.io/open/waba/conversation-window/${fromNumber}/${toNumber}`, {
headers: {
'X-User-API-Key': 'your_api_key_here'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
<?php
$fromNumber = '+15550001111';
$toNumber = '+15552223333';
$ch = curl_init("https://api.p.2chat.io/open/waba/conversation-window/{$fromNumber}/{$toNumber}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-User-API-Key: your_api_key_here'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Response
Window open — the contact wrote to you within the last 24 hours:
{
"success": true,
"window_open": true,
"last_inbound_message_at": "2026-08-05T14:12:33Z",
"expires_at": "2026-08-06T14:12:33Z",
"seconds_left": 61234,
"allowed_message_types": ["free_form", "template"]
}
Window closed — the contact has never written to you, or the last inbound message is older than 24 hours:
{
"success": true,
"window_open": false,
"last_inbound_message_at": null,
"expires_at": null,
"seconds_left": 0,
"allowed_message_types": ["template"]
}
| Field | Description |
|---|---|
success | true when the request succeeded |
window_open | true when free-form messages can currently be delivered to this contact |
last_inbound_message_at | UTC timestamp (ISO 8601) of the contact's last inbound message, or null when the contact has never messaged this number |
expires_at | UTC timestamp (ISO 8601) when the window closes — always last_inbound_message_at + 24 hours. null when there is no inbound message |
seconds_left | Seconds remaining before the window closes. 0 once closed |
allowed_message_types | Message types deliverable right now: ["free_form", "template"] while open, ["template"] once closed |
The window is driven exclusively by messages the contact sends you. Sending a template or a free-form message from your side does not extend it. If last_inbound_message_at is null, the contact has never replied on this number and only templates can be sent.
Error responses
Errors return a 4xx status and a JSON body in the shape:
{
"error": true,
"error_message": "Payload is invalid: from_number does not exist on your account"
}
| Status | error_message | When |
|---|---|---|
400 | Payload is invalid: from_number does not exist on your account | from_number is not a WABA number on your account |
400 | Payload is invalid: ... | One of the phone numbers is not a valid E.164 number |
404 | Resource Not Found: from_number does not exist on your account | The WABA channel is marked for deletion |
410 | Source number is not connected to 2Chat. | The WABA channel exists but is not in a connected state |
Typical flow
- Call this endpoint with your WABA number and the contact's number.
- If
window_openistrue, send a free-form message with Send WABA Message usingtext. - If it is
false, pick an approved template with Get WABA Templates, fetch its variables with Get WABA Template by UUID, and send it withtemplate_uuid+params.