API Documentation

Chattabai & Credit System API reference

Status
POST

Get the status of a user

Returns the status of a user.

Field Type Description Example
authenticationHash String The authentication hash to make a request. ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069
ref String or Int The reference of the user. 000038

Example

POST https://chattabai.nme.mobi/wp-json/ctb/v1/json/getStatusByRef
Content-Type: application/json
{
    "authenticationHash": "ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069",
    "ref": "000038"
}

Success response

{
  "status": 1,
  "message": "ref is valid",
  "code": 202,
  "user": {
    "userId": 194,
    "ref": "000038",
    "status": "online",
    "statusVisual": "Beschikbaar",
    "outboundNumber": "31612345678",
    "dialTimeOut": "30"
    "lineSharing": "true"
  }
} 

Failed responses

{
    "status": 0,
    "message": "request data is invalid",
    "code": 10
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
{
  "status": 0,
  "message": "ref not found",
  "code": 200
}
POST

Change the status of a user

Change the status of a user.

Field Type Description Example
authenticationHash String The authentication hash to make a request. ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069
ref String or Int The reference of the user. 000038
status String The status of a user. This can be online, inConversation, pause or offline online

Example

POST https://chattabai.nme.mobi/wp-json/ctb/v1/json/updateStatusByRef
Content-Type: application/json

{
  "ref": 000038,
  "authenticationHash": "ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069",
  "status": "online"
}

Success response

{
  "status": 1,
  "message": "success",
  "code": 20,
  "user": {
    "userId": 194,
    "ref": "000038",
    "status": "online",
    "statusVisual": "Beschikbaar"
  }
} 

Failed responses

{
    "status": 0,
    "message": "request data is invalid",
    "code": 10
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
{
  "status": 0,
  "message": "ref not found",
  "code": 200
}
{
  "status": 0,
  "message": "status is invalid",
  "code": 218
} 
POST

Change the status of a user for line sharing

Change the status of a user.

Field Type Description Example
authenticationHash String The authentication hash to make a request. ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069
outboundnumber String or Int The outbound number of the user. 31612345678
status String The status of a user. This can be online, inConversation, pause or offline online

Example

POST https://chattabai.nme.mobi/wp-json/ctb/v1/json/updateStatusByLineSharing
Content-Type: application/json

{
  "outboundNumber": "31612345678",
  "authenticationHash": "ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069",
  "status": "online"
}

Success response

{
  "status": 1,
  "message": "success",
  "code": 20,
  "user": {
    "userId": 194,
    "ref": "000038",
    "status": "online",
    "statusVisual": "Beschikbaar"
  }
} 

Failed responses

{
    "status": 0,
    "message": "request data is invalid",
    "code": 10
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
{
  "status": 0,
  "message": "outbound number not found",
  "code": 221
}
{
  "status": 0,
  "message": "status is invalid",
  "code": 218
}
{
  "status": 0,
  "message": "line sharing not enabled",
  "code": 222
}
POST

Get the status change log of a user

Get the status change log of a user.

Field Type Description Example
authenticationHash String The authentication hash to make a request. ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069
ref String or Int The reference of the user. 000038

Example

POST https://chattabai.nme.mobi/wp-json/ctb/v1/json/getStatusLog
Content-Type: application/json

{
  "ref": "000038",
  "authenticationHash": "ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069"
}

Success response

{
  "status": 1,
  "message": "success",
  "code": 20,
    "data": [
    {
      "id": "499",
      "userId": "968",
      "ref": "000968",
      "creationDate": "2024-05-25 22:55:03",
      "status": "online",
      "handler": "RouteControllerUpdateUserStatus",
      "ip": "127.0.0.1"
    }]
} 

Failed responses

{
    "status": 0,
    "message": "request data is invalid",
    "code": 10
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
{
  "status": 0,
  "message": "ref not found",
  "code": 200
}
{
  "status": 0,
  "message": "status is invalid",
  "code": 218
} 
Sessions
POST

Create a callsession

Creates a call session.

Field Type Description Example
authenticationHash String The authentication hash to make a request. ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069
ref String or Int The reference of the user. 000038
startTime String The start time of the session. 2024-01-01 14:00:00
endTime String The end time of the session. 2024-01-01 15:00:00
inboundNumber Int The number of the caller. 31612345678
dialedNumber Int The dialed number. 31612345678
outboundNumber Int The number of the callee. 31612345678
duration String or Int The duration of the call in seconds. 600
dialStatus String The dial status in capital letters. This can be ANSWER, BUSY, NOANSWER, CANCEL, CONGESTION, CHANUNAVAIL, DONTCALL, TORTURE, INVALIDARGS online

Example

POST https://chattabai.nme.mobi/wp-json/ctb/v1/session/call/create/byRef
Content-type: application/json

{
  "authenticationHash" : "ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069",
  "ref": "000038",
  "startTime" : "2042-01-01 12:00:01",
  "endTime" : "2042-01-01 13:00:01",
  "inboundNumber" : "31612345678",
  "dialedNumber" : "31612345678",
  "outboundNumber" : "31612345678",
  "duration" : "60",
  "dialStatus" : "ANSWER"
}

Success response

{
  "status": 1,
  "message": "call session created",
  "code": 403,
  "callSession": {
    "id": "33",
    "sessionId": "33",
    "dialedNumber": "31612345678",
    "inboundNumber": "31612345678",
    "outboundNumber": "31612345678",
    "type": "outbound",
    "dialStatus": "answer",
    "channelId": "0",
    "duration": "60",
    "context": "ctbcallend",
    "userId": "194",
    "startTime": "2024-01-13 02:26:14",
    "updateTime": "2024-01-13 02:26:14",
    "endTime": "2024-01-13 02:27:14",
    "tpm": "90"
  }
}

Failed responses

{
    "status": 0,
    "message": "request data is invalid",
    "code": 10
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
{
  "status": 0,
  "message": "ref not found",
  "code": 200
}
{
  "status": 0,
  "message": "dialed number does not exist",
  "code": 307
}
{
  "status": 0,
  "message": "invalid dial status",
  "code": 311
} 
Profile
POST

Get profile data

Returns all profile data for all users.

Field Type Description Example
authenticationHash String The authentication hash to make a request. ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069

Example

POST https://chattabai.nme.mobi/wp-json/ctb/v1/json/getProfileData
Content-Type: application/json

{
  "authenticationHash": "ff36f129745a122e591722d3fda495416fe05aa9586e12238ec4dad37895e069"
}

Success response

[
  {
    "_ctbUserId": "129",
    "_ctbStatus": "offline",
    "_ctbLastStatusChange": "2024-01-13 19:59:15",
    "_ctbRef": "02",
    "_ctbThumbnail": "https:\/\/chattabai.nme.mobi\/wp-content\/uploads\/2023\/10\/Agent01.jpeg",
    "_ctbThumbnailMedium": "",
    "_ctbThumbnailLarge": "",
    "_ctbThumbnailFull": "",
    "_ctbShortText": "Helderwetend en heldervoelend, sterk in tijdsaanduiding, liefde.\r\n ",
    "_ctbLongText": "Dag lief mens, welkom op mijn profiel, ik ben Agent01.",
    "_ctbNickname": "Agent01",
    "_ctbLanguages": "",
    "_ctbKeywords": "",
    "_ctbChatEnabled": "false",
    "_ctbChatSessionTpm": "100",
    "_ctbChatEnableCam": "false",
    "_ctbMessenger": "false",
    "_ctbMessengerTokensPerMessage": "1000",
    "_ctbCallSessionTpm": "90",
    "_ctbEndpointEnabled": "true",
    "_ctbWhatsappMessenger": "false",
    "_ctbWhatsAppStatus": "offline",
    "_ctbWhatsAppLastStatusChange": "2024-01-11 22:38:31",
    "_ctbAppointmentsEnabled": "true",
    "_ctbPhotoReadingEnabled": "true",
    "_ctbProfileLink": "https:\/\/chattabai.nme.mobi\/profile\/agent01",
    "_ctbMessengerModalLink": "",
    "_ctbStatusVisual": "Offline",
    "_ctbOutboundNumber": "31612345678"
    "_ctbCallRecordingEnabled": "false",
    "_ctbAsteriskPrompt": "https://chattabai.nme.mobi/wp-content/uploads/2024/01/sample-15s-1.mp3",
  }
]

Failed responses

{
    "status": 0,
    "message": "request data is invalid",
    "code": 10
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
Wallet
POST

Get a wallet by dialed number and pin

Returns the wallet of a user.

Field Type Description Example
authenticationHash String The authentication hash to make a request. a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572
dialedNumber String or Int The dialed number by the user. 14620905014
pin String or Int The wallet pin entered by the user. 695334

Example

POST https://dev.creditsysteem.com/wp-json/credsys/v1/json/getWalletByDialedNumberAndPin
Content-Type: application/json
{
  "authenticationHash": "a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572",
  "dialedNumber": "14620905014",
  "pin": "695334"
}

Success response

{
  "status": 1,
  "message": "success",
  "code": 20,
  "wallet": {
    "applicationId": "1288",
    "companyName": "_credSysCompanyName1288",
    "walletId": "6254",
    "pin": "695334",
    "tokens": "1971",
    "dialedNumber": "14620905014"
  }
}

Failed responses

{
  "status": 0,
  "message": "request data is invalid",
  "code": 10
}
{
  "status": 0,
  "message": "failed",
  "code": 30
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
POST

Get a wallet by dialed number and inbound number

Field Type Description Example
authenticationHash String The authentication hash to make a request. a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572
dialedNumber String or Int The dialed number by the user. 14620905014
inboundNumber String or Int The inbound number of a user 31688006395

Example

POST https://dev.creditsysteem.com/wp-json/credsys/v1/json/getWalletByDialedNumberAndInboundNumber
Content-Type: application/json
{
  "authenticationHash": "a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572",
  "dialedNumber": "14620905014",
  "inboundNumber": "31688006395"
}

Success response

{
  "status": 1,
  "message": "success",
  "code": 20,
  "wallet": {
    "applicationId": "1288",
    "companyName": "_credSysCompanyName1288",
    "walletId": "6254",
    "pin": "695334",
    "tokens": "2271",
    "email": "a1@a12.com",
    "dialedNumber": "14620905014"
    "phoneNumber": "31688006395",
  }
}

Failed responses

{
  "status": 0,
  "message": "request data is invalid",
  "code": 10
}
{
  "status": 0,
  "message": "failed",
  "code": 30
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
POST

Subtract tokens from a wallet

Returns the wallet of a user with the new amount of tokens after the amount is subtracted by the request.

Field Type Description Example
authenticationHash String The authentication hash to make a request. a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572
dialedNumber String or Int The dialed number by the user. 14620905014
pin String or Int The wallet pin entered by the user. 695334
tokens String or Int The amount of tokens to subtract. 100

Example

POST https://dev.creditsysteem.com/wp-json/credsys/v1/json/subtractTokensFromWallet
Accept: application/json
Content-Type: application/json
                {
  "authenticationHash": "a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572",
  "dialedNumber": "14620905014",
  "pin": "695334",
  "tokens": "100"
}

Success response

{
  "status": 1,
  "message": "success",
  "code": 20,
  "wallet": {
    "applicationId": "1288",
    "companyName": "_credSysCompanyName1288",
    "walletId": "6254",
    "pin": "695334",
    "tokens": "1771",
    "dialedNumber": "14620905014"
  }
}

Failed responses

{
  "status": 0,
  "message": "request data is invalid",
  "code": 10
}
{
  "status": 0,
  "message": "failed",
  "code": 30
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}
POST

Add tokens to a wallet

Returns the wallet of a user with the new amount of tokens after the amount is added by the request.

Field Type Description Example
authenticationHash String The authentication hash to make a request. a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572
dialedNumber String or Int The dialed number by the user. 14620905014
pin String or Int The wallet pin entered by the user. 695334
tokens String or Int The amount of tokens to add. 100

Example

POST https://dev.creditsysteem.com/wp-json/credsys/v1/json/addTokensToWallet
Accept: application/json
Content-Type: application/json
{
  "authenticationHash": "a27be8c537581a512c1ea651f727a0af3a19eaf6915de9b983a55dc1ea8a8572",
  "dialedNumber": "14620905014",
  "pin": "695334",
  "tokens": "100"
}

Success response

{
  "status": 1,
  "message": "success",
  "code": 20,
  "wallet": {
    "applicationId": "1288",
    "companyName": "_credSysCompanyName1288",
    "walletId": "6254",
    "pin": "695334",
    "tokens": "2271",
    "dialedNumber": "14620905014"
  }
}

Failed responses

{
  "status": 0,
  "message": "request data is invalid",
  "code": 10
}
{
  "status": 0,
  "message": "failed",
  "code": 30
}
{
  "status": 0,
  "message": "unauthorized",
  "code": 40
}