List of available domains

The list of available domains on which NGChat can operate can be accessed using the API method [GET] domains/list.
Sample query

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

Sample server response

{
 "status": 1,
 "content": {
 "1": {
 "address": "www.yousuperdomain.pl",
 "agents": 9,
 "uuid": "4SawvXPwgxhbhimrzYiNkrxR8CpBCm",
 "token": "kwCOT",
 "active": "1",
 "chatclient_id": "1",
 "active_inactive": "1",
 "visibility": "0",
 "shops": null
 },
 "2": {
 "address": "192.168.1.56",
 "agents": 8,
 "uuid": "gAaTVytTUY7nvHoK1H0aHIpuGljVhw",
 "token": "aipBR",
 "active": "1",
 "chatclient_id": "1",
 "active_inactive": "1",
 "visibility": "1",
 "shops": null
 },
 "3": {
 "address": "wp.sabiocoders.com",
 "agents": 6,
 "uuid": "kqMlN0M0se5JDFl6qENu8J7d7z2p8w",
 "token": "exENY",
 "active": "1",
 "chatclient_id": "1",
 "active_inactive": "1",
 "visibility": "1",
 "shops": "2"
 },
 "4": {
 "address": "presta.sabiocoders.com",
 "agents": 4,
 "uuid": "kILADvjQsYN7Yue1jBSwMXild07pA3",
 "token": "nPRS7",
 "active": "1",
 "chatclient_id": "54",
 "active_inactive": "1",
 "visibility": "1",
 "shops": "4"
 },
 "5": {
 "address": "www.sklepsunspa.pl",
 "agents": 3,
 "uuid": "eJ6N9q8qgDUaxFB3mLlZYHjUwSOOZq",
 "token": "jst57",
 "active": "1",
 "chatclient_id": "1",
 "active_inactive": "1",
 "visibility": "0",
 "shops": "1"
 }
 }
}

Adding a new domain

Adding a new domain will later enable the generation of installation scripts required to install the NGChat plug-in on a website. A new domain can be added using the API method [POST] chat/registerdomain.
Parameters:

  • domain – website address
  • shop – e-commerce system type—default value: 0

Parameter types: shop

  • 0 – Other
  • 1 – Magento
  • 2 – WooCommerce
  • 3 – Shopify
  • 4 – PrestaShop

Sample query

 curl  -i https://app.ngchat.com/api/chat/registerdomain

Sample server response

 {"status":2,"content":"The domain was added successfully","token":"nrGQ0","shop":0,"address":"invmaind1.com"}

Domain removal

A domain can be removed using the API method [POST] domain/delete/:id.

Attention!
If you remove a domain, you also permanently remove the token handling the plug-in on the website. Adding the same domain again will generate a new token for the plug-in.

Parameters:

  • id – domain ID

Sample query

 curl

Sample server response

 {"status":1,"content":"The row has been deleted."}

Adding an agent to a domain

If an agent is added to a domain, the agent can talk to clients of that particular domain. An agent can be added to a domain using the API method [POST] domains/adduser.
Parameters:

  • user – Agent ID
  • domain – domain ID

Sample server response

 {"status":1,"content":"User has been assigned to the domain"}

Removing an agent from a domain

An agent can be removed from the domain using the API method [POST] domains/removeagent.
Parameters:

  • uid – Agent ID
  • id – domain ID

Sample server response

 {"status":1,"content":"Error - user already exist."}

Downloading a token for the website plug-in

The token enables proper communication between the plug-in installed on the website and the NGChat system. Every domain in the system has its own unique token, which is automatically generated the moment a domain is added to the NGChat system.
A token generated for a domain can be downloaded using the API method [GET] domains/gettoken/:id.

Parameters:

  • id – domain ID

Sample server response

 { "status" : 0 }