API Reference - Website Notifications

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108118

← Back to API Reference | Getting Started

Website Notifications

Website Notifications are the internal activity log that drives the admin notification center. Each record captures an event that occurred on the site (EG a new member joining, a post being saved, a lead being submitted), the record it relates to, and who triggered it. Notifications can be filtered by category, viewed status, and related table to build activity feeds or audit trails.

Model name in URL: website_notifications — DB table: website_notifications

The Website Notification Object

FieldTypeDescription
notification_idintegerUnique notification ID (primary key, read-only)
notification_statusintegerStatus code for this notification (EG 1 active, 4 archived) required on create
notification_titlestringShort title or subject line for this notification; max 255 characters required on create
notification_messagetextFull message body describing the event (EG "user@example.com saved a post") required on create
notification_categoryintegerTop-level category code grouping this notification type
notification_sub_categoryintegerSub-category code providing more granular classification within the category
notification_viewintegerWhether this notification has been viewed: 1 viewed, 0 unread
notification_tablestringName of the database table containing the record this notification relates to (EG user, users_portfolio_groups); max 255 characters
notification_table_indexstringPrimary key column name of the related table (EG user_id, group_id); max 255 characters
notification_table_index_valuestringPrimary key value of the specific record this notification relates to; max 255 characters
notification_datestringDate and time the event occurred, stored as a 12-character string (format YYYYMMDDHHMM); max 255 characters
notification_tokenstringUnique token associated with this notification for deduplication or linking; max 255 characters
interactorstringThe actor type that triggered this event (EG member, admin, visitor); max 255 characters
interactor_indexstringThe ID of the interacting actor (EG the member's user ID); max 255 characters
interactor_ipstringIP address of the interactor at the time of the event; max 255 characters

List Website Notifications

GET /api/v2/website_notifications/get

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/website_notifications/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "notification_id": "1",
      "notification_status": "4",
      "notification_title": "na",
      "notification_message": "member@example.com saved a post - Example Post Title",
      "notification_category": "0",
      "notification_sub_category": "38",
      "notification_view": "0",
      "notification_table": "users_portfolio_groups",
      "notification_table_index": "group_id",
      "notification_table_index_value": "4032",
      "notification_date": "202205050704",
      "notification_token": "717c047f106e6e20fb6199d8fec51b3b",
      "interactor": "member",
      "interactor_index": "175",
      "interactor_ip": "203.0.113.45"
    }
  ],
  "total": "12100",
  "current_page": 1,
  "total_pages": 484,
  "next_page": "MipfKjI1"
}

Retrieve a Website Notification

GET /api/v2/website_notifications/get/{notification_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/website_notifications/get/1" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "notification_id": "1",
      "notification_status": "4",
      "notification_title": "na",
      "notification_message": "member@example.com saved a post - Example Post Title",
      "notification_category": "0",
      "notification_sub_category": "38",
      "notification_view": "0",
      "notification_table": "users_portfolio_groups",
      "notification_table_index": "group_id",
      "notification_table_index_value": "4032",
      "notification_date": "202205050704",
      "notification_token": "717c047f106e6e20fb6199d8fec51b3b",
      "interactor": "member",
      "interactor_index": "175",
      "interactor_ip": "203.0.113.45"
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Create a Website Notification

POST /api/v2/website_notifications/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/website_notifications/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "notification_status=1" \
  -d "notification_title=New+Member+Signup" \
  -d "notification_message=member@example.com+joined+as+a+new+member." \
  -d "notification_category=0" \
  -d "notification_sub_category=0" \
  -d "notification_view=0" \
  -d "notification_table=user" \
  -d "notification_table_index=user_id" \
  -d "notification_table_index_value=42" \
  -d "notification_date=202604030900" \
  -d "interactor=member" \
  -d "interactor_index=42"

Example Response

Copy
{
  "status": "success",
  "message": {
    "notification_id": "12109",
    "notification_status": "1",
    "notification_title": "New Member Signup",
    "notification_message": "member@example.com joined as a new member.",
    "notification_category": "0",
    "notification_sub_category": "0",
    "notification_view": "0",
    "notification_table": "user",
    "notification_table_index": "user_id",
    "notification_table_index_value": "42",
    "notification_date": "202604030900",
    "notification_token": null,
    "interactor": "member",
    "interactor_index": "42",
    "interactor_ip": null
  }
}

Update a Website Notification

PUT /api/v2/website_notifications/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/website_notifications/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "notification_id=12109" \
  -d "notification_view=1"

Example Response

Copy
{
  "status": "success",
  "message": {
    "notification_id": "12109",
    "notification_status": "1",
    "notification_title": "New Member Signup",
    "notification_message": "member@example.com joined as a new member.",
    "notification_category": "0",
    "notification_sub_category": "0",
    "notification_view": "1",
    "notification_table": "user",
    "notification_table_index": "user_id",
    "notification_table_index_value": "42",
    "notification_date": "202604030900",
    "notification_token": "",
    "interactor": "member",
    "interactor_index": "42",
    "interactor_ip": ""
  }
}

Delete a Website Notification

DELETE /api/v2/website_notifications/delete

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/website_notifications/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "notification_id=12109"

Example Response

Copy
{
  "status": "success",
  "message": "website_notifications record was deleted"
}