API Reference - Messages
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108081
← Back to API Reference | Getting Started
Messages
Messages are internal communications between site visitors or administrators. They can be associated with a member account or a lead, and support threading via the parent_id field. Messages are used by contact forms, inquiry systems, and direct admin messaging.
Model name in URL:
messages — DB table: messagesThe Message Object
| Field | Type | Description |
|---|---|---|
id | integer | Unique message ID (primary key, read-only) |
user_id | integer | ID of the member associated with this message |
name | string | Display name of the message sender |
subject | text | Message subject line |
date | string | Date the message was sent (format: YYYYMMDDHHmmss) |
body | text | Full message body content |
status | integer | Read status: 1 unread, 0 read |
type | string | Message type identifier (EG contact, inquiry) |
lead_id | integer | Associated lead ID (0 if not linked to a lead) |
recipient | string | Recipient type: member or admin |
token | string | Unique message token for reference |
parent_id | integer | ID of parent message for threaded replies (0 for top-level) |
List Messages
GET /api/v2/messages/get
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/messages/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"id": "1",
"user_id": "42",
"name": "John Smith",
"subject": "Inquiry about membership",
"date": "20240301120000",
"body": "Hello, I would like more information about your services.",
"status": "1",
"type": "contact",
"lead_id": "0",
"recipient": "admin",
"token": "abc123def456",
"parent_id": "0"
}
],
"total": "1",
"current_page": 1,
"total_pages": 1
}Retrieve a Message
GET /api/v2/messages/get/{id}
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/messages/get/1" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"id": "1",
"user_id": "42",
"name": "John Smith",
"subject": "Inquiry about membership",
"date": "20240301120000",
"body": "Hello, I would like more information about your services.",
"status": "1",
"type": "contact",
"lead_id": "0",
"recipient": "admin",
"token": "abc123def456",
"parent_id": "0"
}
],
"total": "1",
"current_page": 1,
"total_pages": 1
}Create a Message
POST /api/v2/messages/create
Example Request
Copy
curl -X POST "https://www.yourdomain.com/api/v2/messages/create" \ -H "X-Api-Key: your-api-key-here" \ -d "user_id=42" \ -d "name=John+Smith" \ -d "subject=Inquiry+about+membership" \ -d "date=20240301120000" \ -d "body=Hello%2C+I+would+like+more+information+about+your+services." \ -d "status=1" \ -d "type=contact" \ -d "recipient=admin" \ -d "token=abc123def456" \ -d "lead_id=0" \ -d "parent_id=0"
Example Response
Copy
{
"status": "success",
"message": {
"id": "2",
"user_id": "42",
"name": "John Smith",
"subject": "Inquiry about membership",
"date": "20240301120000",
"body": "Hello, I would like more information about your services.",
"status": "1",
"type": "contact",
"lead_id": "0",
"recipient": "admin",
"token": "abc123def456",
"parent_id": "0"
}
}Update a Message
PUT /api/v2/messages/update
Example Request
Copy
curl -X PUT "https://www.yourdomain.com/api/v2/messages/update" \ -H "X-Api-Key: your-api-key-here" \ -d "id=2" \ -d "status=0"
Example Response
Copy
{
"status": "success",
"message": {
"id": "2",
"user_id": "42",
"name": "John Smith",
"subject": "Inquiry about membership",
"date": "20240301120000",
"body": "Hello, I would like more information about your services.",
"status": "0",
"type": "contact",
"lead_id": "0",
"recipient": "admin",
"token": "abc123def456",
"parent_id": "0"
}
}Delete a Message
DELETE /api/v2/messages/delete
Example Request
Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/messages/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "id=2"
Example Response
Copy
{
"status": "success",
"message": "messages record was deleted"
}