API Reference - Chat Threads
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108083
← Back to API Reference | Getting Started
Chat Threads
Chat Threads represent live chat conversations on your directory website. Each thread groups together one or more Chat Messages between a visitor and a site administrator. Threads track the participants, status, and origin of each conversation.
Model name in URL:
chat_message_threads — DB table: chat_message_threadsThe Chat Thread Object
| Field | Type | Description |
|---|---|---|
thread_id | integer | Unique thread ID (primary key, read-only) |
thread_status | integer | Thread status: 1 active/open, 0 closed |
thread_token | string | Unique token identifying this thread (referenced by chat messages) |
thread_owner | string | Token or identifier of the conversation initiator (visitor) |
created_at | string | Date and time the thread was created (format: YYYYMMDDHHmmss) |
updated_at | string | Date and time the thread was last updated (format: YYYYMMDDHHmmss) |
thread_responders | string | Token or identifier of the admin or responder in this thread |
deleted_at | string | Date and time the thread was soft-deleted (empty if not deleted) |
origin_ip | string | IP address of the visitor who initiated the thread |
request_uri | string | Page URL where the chat was initiated |
List Chat Threads
GET /api/v2/chat_message_threads/get
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/chat_message_threads/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"thread_id": "1",
"thread_status": "1",
"thread_token": "395878c8a5f3ae1802c359ec7ac85619",
"thread_owner": "0986d338d31285f7578138137f8a7c87",
"created_at": "20240301120000",
"updated_at": "20240301120000",
"thread_responders": "eed4fb943e7170dffe8ed9d96650140a",
"deleted_at": "",
"origin_ip": "203.0.113.42",
"request_uri": "/contact"
}
],
"total": "4",
"current_page": 1,
"total_pages": 1
}Retrieve a Chat Thread
GET /api/v2/chat_message_threads/get/{thread_id}
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/chat_message_threads/get/1" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"thread_id": "1",
"thread_status": "1",
"thread_token": "395878c8a5f3ae1802c359ec7ac85619",
"thread_owner": "0986d338d31285f7578138137f8a7c87",
"created_at": "20240301120000",
"updated_at": "20240301120000",
"thread_responders": "eed4fb943e7170dffe8ed9d96650140a",
"deleted_at": "",
"origin_ip": "203.0.113.42",
"request_uri": "/contact"
}
],
"total": "4",
"current_page": 1,
"total_pages": 1
}Create a Chat Thread
POST /api/v2/chat_message_threads/create
Example Request
Copy
curl -X POST "https://www.yourdomain.com/api/v2/chat_message_threads/create" \ -H "X-Api-Key: your-api-key-here" \ -d "thread_status=1" \ -d "thread_token=395878c8a5f3ae1802c359ec7ac85619" \ -d "thread_owner=0986d338d31285f7578138137f8a7c87" \ -d "created_at=20240301120000" \ -d "updated_at=20240301120000" \ -d "thread_responders=eed4fb943e7170dffe8ed9d96650140a" \ -d "origin_ip=203.0.113.42" \ -d "request_uri=%2Fcontact"
Example Response
Copy
{
"status": "success",
"message": {
"thread_id": "5",
"thread_status": "1",
"thread_token": "395878c8a5f3ae1802c359ec7ac85619",
"thread_owner": "0986d338d31285f7578138137f8a7c87",
"created_at": "20240301120000",
"updated_at": "20240301120000",
"thread_responders": "eed4fb943e7170dffe8ed9d96650140a",
"deleted_at": "",
"origin_ip": "203.0.113.42",
"request_uri": "/contact"
}
}Update a Chat Thread
PUT /api/v2/chat_message_threads/update
Example Request
Copy
curl -X PUT "https://www.yourdomain.com/api/v2/chat_message_threads/update" \ -H "X-Api-Key: your-api-key-here" \ -d "thread_id=5" \ -d "thread_status=0"
Example Response
Copy
{
"status": "success",
"message": {
"thread_id": "5",
"thread_status": "0",
"thread_token": "395878c8a5f3ae1802c359ec7ac85619",
"thread_owner": "0986d338d31285f7578138137f8a7c87",
"created_at": "20240301120000",
"updated_at": "20240301120000",
"thread_responders": "eed4fb943e7170dffe8ed9d96650140a",
"deleted_at": "",
"origin_ip": "203.0.113.42",
"request_uri": "/contact"
}
}Delete a Chat Thread
DELETE /api/v2/chat_message_threads/delete
Example Request
Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/chat_message_threads/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "thread_id=5"
Example Response
Copy
{
"status": "success",
"message": "chat_message_threads record was deleted"
}