Skip to main content

Check the Conversation Window

Agent Skill

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.

info

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

ParameterDescriptionExample
from_numberYour WABA number, in E.164 format. The leading + is optional — both +15550001111 and 15550001111 are accepted. Required.+15550001111
to_numberThe contact's phone number, in E.164 format. The leading + is optional. Required.+15552223333

Invocation

curl --request GET \
--url 'https://api.p.2chat.io/open/waba/conversation-window/+15550001111/+15552223333' \
--header 'X-User-API-Key: your_api_key_here'

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"]
}
FieldDescription
successtrue when the request succeeded
window_opentrue when free-form messages can currently be delivered to this contact
last_inbound_message_atUTC timestamp (ISO 8601) of the contact's last inbound message, or null when the contact has never messaged this number
expires_atUTC timestamp (ISO 8601) when the window closes — always last_inbound_message_at + 24 hours. null when there is no inbound message
seconds_leftSeconds remaining before the window closes. 0 once closed
allowed_message_typesMessage types deliverable right now: ["free_form", "template"] while open, ["template"] once closed
Only inbound messages reopen the window

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"
}
Statuserror_messageWhen
400Payload is invalid: from_number does not exist on your accountfrom_number is not a WABA number on your account
400Payload is invalid: ...One of the phone numbers is not a valid E.164 number
404Resource Not Found: from_number does not exist on your accountThe WABA channel is marked for deletion
410Source number is not connected to 2Chat.The WABA channel exists but is not in a connected state

Typical flow

  1. Call this endpoint with your WABA number and the contact's number.
  2. If window_open is true, send a free-form message with Send WABA Message using text.
  3. If it is false, pick an approved template with Get WABA Templates, fetch its variables with Get WABA Template by UUID, and send it with template_uuid + params.