Get single user conversations


List all conversations for a specific user with information containing sender name & email, agent and messages count.

GET

/api/public/users/:client_user_id/conversations/

Parameters
Type
Description
client_user_id
integer
Unique ID provided in clientuser model

Optionally, you can set status parameter to the request URL to narrow the results. This will show only open conversations.

Request URL would look like this:

https://<your_app_subdomain>.user.com/api/public/users/:client_user_id/conversations/?status=true
curl -X GET -H "Authorization: Token <your_64_char_api_key>" "https://<your_app_subdomain>.user.com/api/public/users/:client_user_id/conversations/"

Response

{
    "count": 4,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 6,
            "user": {
                "name": "user@email.com",
                "key": "I8REkrrhPWes",
                "id": 2039,
                "email": "user@email.com"
            },
            "active": false,
            "agent": null,
            "messages": 1
        },
        {
            "id": 5,
            "user": {
                "name": "user@email.com",
                "key": "I8REkrrhPWes",
                "id": 2039,
                "email": "user@email.com"
            },
            "active": false,
            "agent": null,
            "messages": 1
        },
        {
            "id": 4,
            "user": {
                "name": "user@email.com",
                "key": "I8REkrrhPWes",
                "id": 2039,
                "email": "user@email.com"
            },
            "active": false,
            "agent": null,
            "messages": 1
        },
        {
            "id": 3,
            "user": {
                "name": "user@email.com",
                "key": "I8REkrrhPWes",
                "id": 2039,
                "email": "user@email.com"
            },
            "active": false,
            "agent": null,
            "messages": 1
        }
    ]
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://<your_app_subdomain>.user.com/api/public/users/:client_user_id/conversations/",
  "method": "GET",
  "headers": {
    "authorization": "Token <your_64_char_api_key>"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://<your_app_subdomain>.user.com/api/public/users/:client_user_id/conversations/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");

xhr.send(data);
var request = require("request");

var options = { method: 'GET',
  url: 'https://<your_app_subdomain>.user.com/api/public/users/:client_user_id/conversations/',
  headers: { authorization: 'Token <your_64_char_api_key>' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
<?php

$request = new HttpRequest();
$request->setUrl('https://<your_app_subdomain>.user.com/api/public/users/:client_user_id/conversations/');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'authorization' => 'Token <your_64_char_api_key>'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
import requests

url = "https://<your_app_subdomain>.user.com/api/public/users/:client_user_id/conversations/"

headers = {'authorization': 'Token <your_64_char_api_key>'}

response = requests.request("GET", url, headers=headers)

print(response.text)
import http.client

conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")

headers = { 'authorization': "Token <your_64_char_api_key>" }

conn.request("GET", "/api/public/users/:client_user_id/conversations/", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))