Agents list

A full list of agents can be downloaded using the API method [GET] users/lists.
Sample query

curl -H 'x-user-token=1234567890' -i https://api.ngchat.com/api/users/list

Sample server response

 {
 "users": {
 "itTuKIAoXZqKzW9vyG1Z1xFyVLcpry": {
 "name": "Admin",
 "role": "admin",
 "pid": "263",
 "email": "admin@domain.com",
 "photo": "http://app.ngchat.com/dashboards/img/default.svg",
 "uuid": "itTuKIAoXZqKzW9vyG1Z1xFyVLcpry",
 "domains": 5,
 "subscription": true
 },
 "kmgEXPWteV7Fxa9avouF9S8dEXty66": {
 "name": "Tomasz",
 "role": "agent",
 "pid": "263",
 "email": "tomasz@domain.com",
 "photo": "http://app.ngchat.com/dashboards/img/default.svg",
 "uuid": "kmgEXPWteV7Fxa9avouF9S8dEXty66",
 "domains": 2,
 "subscription": false
 },
 "NHHXO7imkJNqpCSThEooXx7gcxf0U1": {
 "name": "Maciek",
 "role": "agent",
 "pid": "263",
 "email": "maciej@domain.com",
 "photo": "img/default.svg",
 "uuid": "NHHXO7imkJNqpCSThEooXx7gcxf0U1",
 "domains": 3,
 "subscription": true
 },
 "status": 1,
 "maxUsersSub": "10",
 "currentUsersSub": 7
}

Information about the agent

Detailed information about an agent can be obtained using the API method [GET] user/:uid. The :uid parameter assumes the agent’s ID value.

Sample query

 curl -H 'x-user-token=1234567890' -i https://app.ngchat.com/api/users/getuser/NHHXO7imkJNqpCSThEooXx7gcxf0U1

Sample server response

{"media": {
 "address": "http://app.ngchat.com/dashboards/files/media/263/ngc_666146646.jpeg"
},
"status": 1,
"content": {
 "user": {
 "name": "Admin",
 "email": "admin54@domain.com",
 "role": "admin",
 "status": "0",
 "chats": "5",
 "conversationblocks": "",
 "uuid": "itTuKIAoXZqKzW9vyG1Z1xFyVLcpry",
 "job_title": "Manager",
 "domains": [{
 "address": "www.yoursuperdomain.pl",
 "uuid": "4SawvXPwgxhbhimrzYiNkrxR8CpBCm",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "0",
 "shops": null
 }, {
 "address": "domain1.com",
 "uuid": "gAaTVytTUY7nvHoK1H0aHIpuGljVhw",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "1",
 "shops": null
 }, {
 "address": "domain2.com",
 "uuid": "kqMlN0M0se5JDFl6qENu8J7d7z2p8w",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "1",
 "shops": "2"
 }, {
 "address": "ecommerce.domain.com",
 "uuid": "kILADvjQsYN7Yue1jBSwMXild07pA3",
 "active_inactive": "1",
 "chatclient_id": "54",
 "visability": "1",
 "shops": "4"
 }, {
 "address": "shop.domain.com",
 "uuid": "eJ6N9q8qgDUaxFB3mLlZYHjUwSOOZq",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "0",
 "shops": "1"
 }]
 }
}
}

Adding a new agent

A new agent can be added using the API method [POST] users/add.
Parameters:

  • login – new user’s e-mail address
  • name—user’s name and surname
  • job_title—position—empty by default
  • password – user’s password
  • chat – number of active conversations
  • status – default user status (online/away/offline)

Sample server response

 {"status":1,"content":"User has been added"}

Updating agent’s details

Agent’s details can be updated using the API method [POST] user/edit.
Parameters:

  • name – user’s name and surname
  • job_title – position—empty by default
  • password – user’s password
  • chat – number of active conversations
  • status – default user status (online/away/offline)

Sample server response

 {"status":1,"content":"The account has been updated."}

Agent removal

An agent can be removed using the API method [POST] user/delete.
Parameters:

  • uid – Agent ID

Sample query

 curl -H 'x-user-token=1234567890' -i https://app.ngchat.com/api/users/delete/6yfGoV5ZVI8YMQteUrrKxNXBVLhj0x347

Sample server response

 {"status":2,"content":"The account has been deleted"}

History of agent’s sign ins to the system

Every agent’s sign in to the system dashboard is registered in the sign in log. The history of sign ins can be accessed using the API method [GET] user/logginghistory/:uid/:page.
Parameters:

  • uid – Agent ID
  • page – the log page No.—1 is set by default

Sample query

 curl -H 'x-user-token=1234567890' -i https://app.ngchat.com/api/users/logginghistory/itTuKIAoXZqKzW9vyG1Z1xFyVLcpry/1

Sample server response

 {
 "status": 1,
 "content": {
 "items": [{
 "date": "1441631133",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "45.0.2454.",
 "platfrom": "Mac"
 }, {
 "date": "1441627582",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "45.0.2454.",
 "platfrom": "Mac"
 }, {
 "date": "1441625009",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "39.0.2171.",
 "platfrom": "Linux"
 }, {
 "date": "1441618196",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "39.0.2171.",
 "platfrom": "Linux"
 }, {
 "date": "1441612528",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "45.0.2454.",
 "platfrom": "Mac"
 }, {
 "date": "1441607928",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "39.0.2171.",
 "platfrom": "Linux"
 }, {
 "date": "1441549237",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "45.0.2454.",
 "platfrom": "Mac"
 }, {
 "date": "1441544057",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "45.0.2454.",
 "platfrom": "Mac"
 }, {
 "date": "1441464790",
 "ip": "10.0.3.8",
 "browser": null,
 "browser_version": null,
 "platfrom": "Mac"
 }, {
 "date": "1441447416",
 "ip": "10.0.3.8",
 "browser": "Google Chrome",
 "browser_version": "45.0.2454.",
 "platfrom": "Mac"
 }],
 "next": 2,
 "first": 1,
 "before": 1,
 "current": 1,
 "last": 91,
 "total_pages": 91,
 "total_items": 903
 },
 "user": "itTuKIAoXZqKzW9vyG1Z1xFyVLcpry",
 "name": "Admin"
}

List of domains available for an agent

Every agent has a domain assigned, through which the agent can talk to clients. The list of agent’s domains can be accessed using the API method [GET] user/getuserdomains/:uid.
Parameters:

  • uid – Agent ID

Sample query

 curl -H 'x-user-token=1234567890' -i https://app.ngchat.com/api/users/getuserdomains/itTuKIAoXZqKzW9vyG1Z1xFyVLcpry

Sample server response

 "status": 1,
"content": {
 "domains": [{
 "address": "domain.com",
 "token": "kwCOT",
 "uuid": "4SawvXPwgxhbhimrzYiNkrxR8CpBCm",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "0",
 "shops": null
 }, {
 "address": "192.168.1.56",
 "token": "aipBR",
 "uuid": "gAaTVytTUY7nvHoK1H0aHIpuGljVhw",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "1",
 "shops": null
 }, {
 "address": "domain1.com",
 "token": "exENY",
 "uuid": "kqMlN0M0se5JDFl6qENu8J7d7z2p8w",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "1",
 "shops": "2"
 }, {
 "address": "ecommerce.domain.com",
 "token": "nPRS7",
 "uuid": "kILADvjQsYN7Yue1jBSwMXild07pA3",
 "active_inactive": "1",
 "chatclient_id": "54",
 "visability": "1",
 "shops": "4"
 }, {
 "address": "shop.domain.com",
 "token": "jst57",
 "uuid": "eJ6N9q8qgDUaxFB3mLlZYHjUwSOOZq",
 "active_inactive": "1",
 "chatclient_id": "1",
 "visability": "0",
 "shops": "1"
 }]
}
}