Triggers enable automatic calling of the NGChat window in a client’s browser. The time after which a trigger is to be called and the time after which the message is supposed to appear in the NGChat window can both be defined.

Downloading a list of triggers

All triggers can be downloaded using the API method [GET] triggers/list.

Sample query

 curl -i https://app.ngchat.com/api/triggers/list

Sample server response

 {
 "status": 1,
 "content": [{
 "id": "10",
 "name": "test",
 "url": "http:\/\/domain.com\/lakiery-hybrydowe-shellac.html",
 "message": "witam na naszej stronie",
 "display_time": "5",
 "status": "0",
 "domains": {
 "address": "domain.com",
 "token": "eglwK",
 "uuid": "zvLkgOQRtw7qSGKgGuXTdtBUktx1Rf",
 "active_inactive": "1",
 "chatclient_id": "73",
 "visability": "1",
 "shops": null
 }
 }, {
 "id": "11",
 "name": "Tomasz",
 "url": "http:\/\/domain.com\/wyposazenie-salonow.html",
 "message": "Dzie\u0144 dobry!",
 "display_time": "5",
 "status": "1",
 "domains": {
 "address": "domain.com",
 "token": "eglwK",
 "uuid": "zvLkgOQRtw7qSGKgGuXTdtBUktx1Rf",
 "active_inactive": "1",
 "chatclient_id": "73",
 "visability": "1",
 "shops": null
 }
 }]
}

Downloading the trigger

A single trigger can be downloaded using the API method [GET] triggers/:id.

Parameters:

  • id – trigger ID

Sample query

 curl -i https://app.ngchat.com/api/triggers/gettrigger/10

Sample server response

 { "status": 1,
 "trigger": {
 "id": "10",
 "name": "test",
 "url": "http:\/\/domain.com\/lakiery-hybrydowe-shellac.html",
 "message": "witam na naszej stronie",
 "display_time": "5",
 "status": "0",
 "domains": {
 "address": "domain.com",
 "token": "eglwK",
 "uuid": "zvLkgOQRtw7qSGKgGuXTdtBUktx1Rf",
 "active_inactive": "1",
 "chatclient_id": "73",
 "visability": "1",
 "shops": null,
 "domainsusers": {}
 }
 }
}

Adding a trigger

A trigger can be added using the API method [POST] triggers/addtriggers. After the trigger is correctly added the system automatically sets its status to active.

Parameters:

  • id – trigger ID
  • name – trigger name
  • url – the URL, on which the trigger is to be activated
  • msg – the message which is supposed to appear in the NGChat window
  • time – the time after which the trigger is to be launched (in seconds)
  • domainid – the ID of the domain on which the trigger is meant to operate

Sample query

 curl -i ttps://app.ngchat.com/api/triggers/addtrigger

Sample server response

{"status":2,"content":"The trigger has been added."}

Editing the trigger

A trigger can be edited using the API method [POST] triggers/edittriggers.

Parameters:

  • triggerId – trigger ID
  • name – trigger name
  • url – the URL, on which the trigger is to be activated
  • msg – the message which is supposed to appear in the NGChat window
  • time – the time after which the trigger is to be launched (in seconds)
  • domainid – the ID of the domain on which the trigger is meant to operate

Sample query

 curl

Sample server response

{"status":2,"content":"The trigger has been updated."}

Trigger activation/deactivation

A trigger can be activated or deactivated using the API method [POST] triggers/changetriggerstatus.

Parameters:

  • id – trigger ID
  • status – 0—trigger deactivated/1—trigger activated

Sample query

 curl -i https://app.ngchat.com/api/triggers/changetriggerstatus

Sample server response

{"status":1,"content":"The trigger's status has been changed."}

Trigger removal

A trigger can be removed using the API method [GET] triggers/delatetrigger/:id.

Parameters:

  • id – trigger ID

Sample query

 curl -i https://app.ngchat.com/api/triggers/deletetrigger/16

Sample server response

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