POST

Chat.CustomerMessages

Return one customer chat timeline. Default source is Mongo messenger using the same filter as the dashboard: contactus_id + owner (WhatsApp, Biz1 inboard, notes, email timeline, custom channels). Pass source=client_message to list MySQL client_message emails/notes instead.

Permissions

  • User must be logged in with a valid bearer token.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Runs the Chat.CustomerMessages function and returns JSON.

Push Service

No push is sent because this function only reads data or returns helper information.

Automation

No automation is run for this function.

Special Instructions

  • Send the bearer token on protected calls with Authorization: Bearer YOUR TOKEN.
  • Send parameters as POST body fields exactly as documented.

Required Parameters

NameTypeSampleExplanation
customer_id
post
int108545Customer id (contactus id). You may also send contactus_id or cust_id. Same as dashboard POST id.

Optional Parameters

NameTypeSampleWhat it gives
source
post
stringmessengermessenger (default, dashboard Mongo chat) or client_message / email (MySQL emails and App notes).
type
post
stringwhatsappOptional Mongo channel filter: whatsapp, biz1, notes, email, or a custom channel type.
page
post
int1Page number (1-based). Ignored when start/offset is sent.
limit
post
int25Maximum messages to return. Values above 25 are capped to 25.
start
post
int0Optional row offset. When set, overrides page-based skip.
sort
post
stringdate_descSort hint for the UI. Backend sorts newest first.

Authentication

Send the bearer token returned by Login in the request header.

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Chat.CustomerMessages",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "customer_id": "108545",
        "limit": "25"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Chat.CustomerMessages",
    "url_domain": "https:\/\/{domain}\/app\/Chat.CustomerMessages"
}

Endpoint

POST /app/Chat.CustomerMessages
POST https://{user}.bull36.com/app/Chat.CustomerMessages
POST https://{domain}/app/Chat.CustomerMessages

Sample Output

{
    "success": 1,
    "customer_id": 108545,
    "contactus_id": 108545,
    "owner": 14,
    "messenger_meta_id": "69dbd3053541bea1809e658d",
    "source": "mongo.messenger",
    "where": {
        "contactus_id": 108545,
        "owner": 14
    },
    "count": 25,
    "total": 80,
    "data": [
        {
            "id": "69e8b2f63541bea180a1c201",
            "type": "whatsapp",
            "message": "Hello how are you",
            "time": "24.07.2026 11:42:10",
            "direction": 0,
            "user_id": 14,
            "user_name": "User"
        }
    ]
}

Count Only

Use the matching count route with the same filters when the UI only needs total rows for paging.

{
    "url": "\/app\/Chat.CustomerMessages",
    "url_user": "https:\/\/{user}.bull36.com\/app\/Chat.CustomerMessages",
    "url_domain": "https:\/\/{domain}\/app\/Chat.CustomerMessages",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "customer_id": "108545"
    },
    "sample_output": {
        "success": 1,
        "count": 123
    },
    "notes": {
        "total": "Total matching messages for the customer.",
        "count": "Messages returned in this page.",
        "max_limit": 25
    }
}

Count JavaScript

const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('customer_id', '108545');

const res = await fetch('https://{domain}/app/Chat.CustomerMessages', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
  body
});
const data = await res.json();
console.log(data.count);

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('customer_id', '108545');
body.set('limit', '25');
const res = await fetch('/app/Chat.CustomerMessages', { method: 'POST', headers: { Authorization: 'Bearer ' + token }, body });
const data = await res.json();
console.log(data);

Error Example

{
    "success": 0,
    "message": "Missing required parameter: customer_id"
}