SmartMEX platform API

API Endpoint

SmartMEX API provides integration capabilities of SmartMEX platform towards other information systems, which require access to historic and real-time data about mobile voice communication of the company.

Accesing API

JSON POST

JSON POST API can be accessed through any library which allows forming of HTTP POST requests and passing application/json as a request payload. Every request must be identified with an authorization token:

{
  "token": "jwep640q4QX7nYpWZOSe"
}

where token is a unique access key generated from SmartMEX self-care service under: API/API KEYS. JSON POST API endpoints allow API consumer to access platform user data, access calls, voicemails and call recordings and request new WSS session authorization keys

Webhook callbacks

Users may specify their own https:// callback urls, which SmartMEX backend service will invoke on specific telephony events. The callbacks are invoked as POST requests towards URL specified by the user. Event data is carried as application/json payload in POST request. Available SmartMEX callback events are available at Webhook Events section of this document. New callback URL can be added through SmartMEX self-care under API/WEBHOOKS.

WebSocket Event flow

SmartMEX Websocket event flow allows to receive real-time stream of the same events as Webhook callbacks. Websocket connection can be established by opening a wss connection to: wss://zvanuparvaldnieks.lmt.lv/api/ws Websocket connection should then be authorized with first message sent to the Websocket endpoint:

socket.send(JSON.stringify({type: "AuthRequest", wss_token: "utniTJ4A9ploDVDL"}));

Where wss_token - a one-time-use token obtainer through WSS Session Tokens JSON API. After WSS session has been interupted or destroyed, API user, must request new one-time WSS session token.

Notes

String encoding

If not specified otherwise, the API uses and expects UTF-8 as encoding for all String elements within the API.

Dates and times

If not specified otherwise, the API uses UTC date values returned from all of the calls and events. Users may specify filter values for their own specific time zone by using UTC offset field in the value as per RFC 3339. Returned data, however, will still be normalized according to and returned as UTC.

Datetime deltas (durations) are supplied as numbers, indicating amount of seconds, the event has lasted.

Call statuses

  • 1 - Call proceeding, bridge not created

  • 3 - Bridge created

  • 4 - Call ended, without bridge

  • 5 - Call ended, with bridge

Employees JSON API

Get Employee records

POST /api/contacts
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "token": "jwep640q4QX7nYpWZOSe",
  "contact_id": 212
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token generated from SmartMEX selfcare"
    },
    "contact_id": {
      "type": "number",
      "description": "ID of specific contact to request through API. If no contact ID is specified all employee records of the company are returned"
    }
  },
  "required": [
    "token"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "status": "ok",
  "statusCode": 200,
  "message": "OK",
  "version": "1.21",
  "data": [
    {
      "current_callerid": "22222222",
      "archived": 1,
      "firstname": "Andris",
      "lastname": "Berzins",
      "created": "2017-01-01T00:00:00+0000",
      "number": "22222222",
      "contactID": 212,
      "group_membership": [
        {
          "created": "2017-01-01T00:00:00+0000",
          "groupID": 20,
          "type": 1,
          "name": "Tehn.Atbalsts",
          "members": [
            {
              "contactID": 212
            }
          ]
        }
      ],
      "avatar": "https://zvanuparvaldnieks.lmt.lv/files/dm0vNzI349857345dfvjdfTYUTDfdHIYEWDUIDY5MDQwMy8yMDE3LzEwNC5tcDM="
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Status of the request"
    },
    "statusCode": {
      "type": "number",
      "description": "Status code. Mapping to HTTP response code meaning"
    },
    "message": {
      "type": "string",
      "description": "Additional request status message"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "array",
      "description": "Container of requested fields about employee"
    }
  },
  "required": [
    "status",
    "statusCode",
    "message",
    "version"
  ]
}

Get Employee records
POST/api/contacts

Retreive employee data by contact_id or list all employees, if no contact_id value is supplied with the request.

Returned response contains a list of Employee records; Every Employee record has following fields:

  • current_callerid - The outgoing callerid currently set for the Employee

  • archived - 0 or 1 to indicate archive status of Employee record,

  • firstname - Given name of the Employee,

  • lastname - Family name of the Employee,

  • created - Creation date of the Employee record,

  • number - Phone number of the Employee,

  • contactID - Unique ID of the Employee,

  • group_membership - List of Employee group field values of a group this Employee is a member of,

  • avatar - An URL with user profile picture.

Avatar image can be retreived from the server by making a GET request towards a supplied URL and providing customer HTTP request header field:

GET /files/dm0vNzI349857345dfvjdfTYUTDfdHIYEWDUIDY5MDQwMy8yMDE3LzEwNC5tcDM= HTTP/1.1
Host: zvanuparvaldnieks.lmt.lv
X-Smartmex-Token: jwep640q4QX7nYpWZOSe

where token is the same token, as the one used for JSON API access.


Employee Groups

POST /api/groups
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "token": "jwep640q4QX7nYpWZOSe",
  "group_id": 20,
  "filter": {
    "contact_id": 212
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token generated from SmartMEX selfcare"
    },
    "group_id": {
      "type": "number",
      "description": "ID of specific group to request through API. If no group ID is specified all group records of the company are returned"
    },
    "filter": {
      "type": "object",
      "properties": {
        "contact_id": {
          "type": "number",
          "description": "Filter only groups which have Employees with specified contact_id in them."
        }
      },
      "description": "Returned record filter"
    }
  },
  "required": [
    "token"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "status": "OK",
  "statusCode": "200",
  "message": "OK",
  "version": "1.21",
  "data": [
    {
      "created": "2017-01-01T00:00:00+0000",
      "groupID": 20,
      "type": 1,
      "name": "Tehn.Atbalsts",
      "members": [
        {
          "contactID": 212
        }
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Status of the request"
    },
    "statusCode": {
      "type": "string",
      "description": "Status code. Mapping to HTTP response code meaning"
    },
    "message": {
      "type": "string",
      "description": "Additional request status message"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "array",
      "description": "Container of requested fields about a group of which requested member is a member of"
    }
  },
  "required": [
    "status",
    "statusCode",
    "message",
    "version"
  ]
}

Get Employee Groups
POST/api/groups

Retreive Employee groups data, return either a single group record or multiple groups if no group_id is provided. Additionaly API consumer may filter the returned records based on filter.contact_id, to limit the result to only those groups, which have particular Employee as a member.

Returned response contains a list of Group records; Every Group record has following fields:

  • created - Creation date of the group,

  • groupID - Unique ID of the group,

  • type - Group type - currently not used (default value - 1),

  • name - User specified name for the group,

  • members - A list of contactID values for the Employees who are part of the group.


Calls JSON API

Voicemails

POST /api/voicemails
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "token": "jwep640q4QX7nYpWZOSe",
  "limit": 100,
  "offset": 0,
  "voicemail_id": 31,
  "filter": {
    "contact_id": 201,
    "source": "26666666",
    "box_id": 30,
    "date_range": {
      "from": "2017-01-01T00:00:00+0000",
      "to": "2017-02-01T00:00:00+0000"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token generated from SmartMEX selfcare"
    },
    "limit": {
      "type": "number",
      "description": "Limit of voicemail messages returned"
    },
    "offset": {
      "type": "number",
      "description": "offset of voicemail messages"
    },
    "voicemail_id": {
      "type": "number",
      "description": "ID of specific voicemail record to request through API."
    },
    "filter": {
      "type": "object",
      "properties": {
        "contact_id": {
          "type": "number",
          "description": "Filter only those voicemail messages that can be accessed by Employees with requested contact_id in them."
        },
        "source": {
          "type": "string",
          "description": "Source phone number which left the voicemail message"
        },
        "box_id": {
          "type": "number",
          "description": "Voicemail box ID"
        },
        "date_range": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "description": "Start of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            },
            "to": {
              "type": "string",
              "description": "End of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            }
          },
          "description": "Date range filter"
        }
      },
      "description": "A dictionary containing filter fields for the voicemail request"
    }
  },
  "required": [
    "token"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "status": "OK",
  "statusCode": 200,
  "message": "OK",
  "version": "1.21",
  "data": [
    {
      "sender": "26666666",
      "voicemailID": 31,
      "length": 15,
      "callStarted": "2017-01-01T08:30:11+0000",
      "voicemailBoxID": 30,
      "voicemailBoxName": "User voicemail Box",
      "messageURL": "https://zvanuparvaldnieks.lmt.lv/files/dm0vNzI349857345dfvjdfTYUTDfdHIYEWDUIDY5MDQwMy8yMDE3LzEwNC5tcDM="
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Status of the request"
    },
    "statusCode": {
      "type": "number",
      "description": "Status code. Mapping to HTTP response code meaning"
    },
    "message": {
      "type": "string",
      "description": "Additional request status message"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "array",
      "description": "Container of requested fields"
    }
  },
  "required": [
    "status",
    "statusCode",
    "message",
    "version"
  ]
}

Get voicemail messages
POST/api/voicemails

Retreive Voicemail messages, return either a single voicemail message or multiple messages if no voicemail_id is provided. Additionaly API consumer may filter the returned records based on filter.contact_id, filter.source, filter.box_id or filter.date_range to limit the result to only those messages that are left for specific employee, voicemail box, from specific number or in requested date range.

Returned response contains a list of Voicemail messages; Every message has following fields:

  • sender - The number which left the voicemail message

  • voicemailID - ID of the voicemail message

  • length - Voicemail message length in seconds

  • callStarted - Start time of the call, format: ā€œYYYY-MM-DDTH24:mm:SS+UTC_OFFSETā€¯

  • voicemailBoxID - ID of the voicemail box

  • voicemailBoxName - Name of voicemail box

  • messageURL - An URL to an audio file

An Audio file of the message can be retreived from the server by making a GET request towards a supplied URL and providing customer HTTP request header field:

GET /files/dm0vNzI349857345dfvjdfTYUTDfdHIYEWDUIDY5MDQwMy8yMDE3LzEwNC5tcDM= HTTP/1.1
Host: zvanuparvaldnieks.lmt.lv
X-Smartmex-Token: jwep640q4QX7nYpWZOSe

where token is the same token, as the one used for JSON API access.


Call history

POST /api/call_history
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "token": "jwep640q4QX7nYpWZOSe",
  "limit": 100,
  "offset": 0,
  "call_id": 150818921852,
  "filter": {
    "destination": "29999999",
    "source": "67765521",
    "direction": "in",
    "contact_id": 201,
    "date_range": {
      "from": "2017-01-01T00:00:00+0000",
      "to": "2017-02-01T00:00:00+0000"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token generated from SmartMEX selfcare"
    },
    "limit": {
      "type": "number",
      "description": "Limit of records returned"
    },
    "offset": {
      "type": "number",
      "description": "Offset of records returned"
    },
    "call_id": {
      "type": "number",
      "description": "Unique ID of specific call to query"
    },
    "filter": {
      "type": "object",
      "properties": {
        "destination": {
          "type": "string",
          "description": "Filter for dialed destination number"
        },
        "source": {
          "type": "string",
          "description": "Filter for originating number of the call"
        },
        "direction": {
          "type": "string",
          "description": "Filter only specific direction of the call; Either - \"in\" for incoming or \"out\" for outgoing"
        },
        "contact_id": {
          "type": "number",
          "description": "Filter only call history records where employee with the specified contact_id is involved"
        },
        "date_range": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "description": "Start of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            },
            "to": {
              "type": "string",
              "description": "End of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            }
          },
          "description": "Date range filter"
        }
      },
      "description": "A dictionary containing Call History filter fields for the request"
    }
  },
  "required": [
    "token"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "status": "OK",
  "statusCode": "200",
  "message": "OK",
  "version": "1.21",
  "data": [
    {
      "callID": 150818921852,
      "caller": "22222222",
      "destination": "26666666",
      "direction": "in",
      "status": 1,
      "callStarted": "2017-01-01T08:30:11+0000",
      "callConnected": "2017-01-01T08:30:23+0000",
      "callEnded": "2017-01-01T08:31:11+0000",
      "connectionTime": 48,
      "contactID": 201,
      "recordingID": 301
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Status of the request"
    },
    "statusCode": {
      "type": "string",
      "description": "Status code. Mapping to HTTP response code meaning"
    },
    "message": {
      "type": "string",
      "description": "Additional request status message"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "array",
      "description": "Container of Call history fields for requested call"
    }
  },
  "required": [
    "status",
    "statusCode",
    "message",
    "version"
  ]
}

Get call hisotry log
POST/api/call_history

Retreive Call history entries, return either a single call history entry or multiple entries if no call_id is provided. Additionaly API consumer may filter the returned records based on specific number or employee involved in the call (filter.source, filter.destination or filter.contactID), as well as filter.direction to filter out only incoming or outgoing calls or only calls made in specified date range (filter.date_range).

Returned response contains a list of Call history records; Every Call history record has following fields:

  • callID - Unique ID for the call

  • caller - The number of calling party

  • destination - The number which call was placed to

  • direction - ā€œinā€¯ or ā€œoutā€¯ to indicate if the call was incoming or outgoing

  • status - Status of the call

  • callStarted - Start time of the call

  • callConnected - Answer time of the call

  • callEnded - End time of the call

  • connectionTime - Duration of the entire call

  • contactID - contact_id of Employee involved in the call

  • recordingID - recording_id of call recording for the specified call


Lost calls

POST /api/lost_calls
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "token": "jwep640q4QX7nYpWZOSe",
  "limit": 100,
  "offset": 0,
  "filter": {
    "destination": "26666666",
    "date_range": {
      "from": "2017-01-01T00:00:00+0000",
      "to": "2017-02-01T00:00:00+0000"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token generated from SmartMEX selfcare"
    },
    "limit": {
      "type": "number",
      "description": "Limit of records returned"
    },
    "offset": {
      "type": "number",
      "description": "Offset of the records returned"
    },
    "filter": {
      "type": "object",
      "properties": {
        "destination": {
          "type": "string",
          "description": "Filter for dialed destination"
        },
        "date_range": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "description": "Start of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            },
            "to": {
              "type": "string",
              "description": "End of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            }
          },
          "description": "Date range filter"
        }
      },
      "description": "A dictionary containing Lost calls filter fields for the request"
    }
  },
  "required": [
    "token"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "status": "OK",
  "statusCode": 200,
  "message": "OK",
  "version": "1.21",
  "data": [
    {
      "contact_name": "Andris Berzins",
      "destination": "26666666",
      "attempts": 2,
      "callerid": "22222222",
      "last_contact": "2017-01-01T08:30:11+0000"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Status of the request"
    },
    "statusCode": {
      "type": "number",
      "description": "Status code. Mapping to HTTP response code meaning"
    },
    "message": {
      "type": "string",
      "description": "Additional request status message"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "array",
      "description": "Container of fields about requested lost calls"
    }
  },
  "required": [
    "status",
    "statusCode",
    "message",
    "version"
  ]
}

Get lost call data
POST/api/lost_calls

Retreive Lost call data, return all lost call records from call history that have not been answered, have been called back or caller has not reached the employee in repeated attempt within the same day. Additionaly API consumer may filter the returned records based on destination number (filter.destination) or filter.date_range to show only lost call entries missed on specified date range.

Returned response contains a list of Lost call records; Every Lost call record has following fields:

  • contact_name - Employee name, this phone number is assigned to

  • destination - The dialed destination

  • attempts - Number of unsuccessful call attempts

  • callerid - The number of calling party

  • last_contact - Time when the last unsuccessful call attempt was made from caller. Format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET


Call recordings

POST /api/call_recordings
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "token": "jwep640q4QX7nYpWZOSe",
  "limit": 100,
  "offset": 0,
  "record_id": 1626225551,
  "filter": {
    "destination": "29999999",
    "source": "67765521",
    "direction": "in",
    "contact_id": 201,
    "date_range": {
      "from": "2017-01-01T00:00:00+0000",
      "to": "2017-02-01T00:00:00+0000"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token generated from SmartMEX selfcare"
    },
    "limit": {
      "type": "number",
      "description": "Limit of records returned"
    },
    "offset": {
      "type": "number",
      "description": "Offset of records returned"
    },
    "record_id": {
      "type": "number",
      "description": "ID of specific call recording to request through API."
    },
    "filter": {
      "type": "object",
      "properties": {
        "destination": {
          "type": "string",
          "description": "Filter for dialed destination number"
        },
        "source": {
          "type": "string",
          "description": "Filter for originating number of the call"
        },
        "direction": {
          "type": "string",
          "description": "Filter only specific direction of the call; Either - \"in\" for incoming or \"out\" for outgoing"
        },
        "contact_id": {
          "type": "number",
          "description": "Filter only call history records where employee with the specified contact_id is involved"
        },
        "date_range": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "description": "Start of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            },
            "to": {
              "type": "string",
              "description": "End of date range, format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET"
            }
          },
          "description": "Date range filter"
        }
      },
      "description": "A dictionary containing Call History filter fields for recordings request"
    }
  },
  "required": [
    "token"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "status": "OK",
  "statusCode": 200,
  "message": "OK",
  "version": "1.21",
  "data": [
    {
      "recordingID": 1626225551,
      "callID": 150818921852,
      "caller": "29999999",
      "destination": "26666666",
      "direction": "in",
      "status": 1,
      "callStarted": "2017-01-01T08:30:11+0000",
      "callConnected": "2017-01-01T08:30:23+0000",
      "callEnded": "2017-01-01T08:31:11+0000",
      "contactID": 201,
      "recordingURL": "https://zvanuparvaldnieks.lmt.lv/files/dm0vNzI349857345dfvjdfTYUTDfdHIYEWDUIDY5MDQwMy8yMDE3LzEwNC5tcDM="
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Status of the request"
    },
    "statusCode": {
      "type": "number",
      "description": "Status code. Mapping to HTTP response code meaning"
    },
    "message": {
      "type": "string",
      "description": "Additional request status message"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "array",
      "description": "Container of requested fields about recording"
    }
  },
  "required": [
    "status",
    "statusCode",
    "message",
    "version"
  ]
}

Get call recordings
POST/api/call_recordings

Retreive Call recordings, return either a single call recording or multiple recordings if no record_id is provided. Additionaly API consumer may filter the returned records based on specific number or employee involved in the call (filter.source, filter.destination or filter.contactID), as well as filter.direction to filter out only incoming or outgoing calls or only calls made in specified date range (filter.date_range).

Returned response contains a list of Call recordings; Every Call recording has following fields:

  • callID - Unique ID for the call

  • caller - The number of calling party

  • destination - The number which call was placed to

  • direction - ā€œinā€¯ or ā€œoutā€¯ to indicate if the call was incoming or outgoing

  • status - Status of the call

  • callStarted - Start time of the call

  • callConnected - Answer time of the call

  • callEnded - End time of the call

  • connectionTime - Duration of the entire call

  • contactID - contact_id of Employee involved in the call

  • recordingID - recording_id of call recording for the specified call


WSS Session token JSON API

WSS session tokens

POST /api/session_keys/create
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "token": "jwep640q4QX7nYpWZOSe",
  "scope": "employee",
  "contact_id": 201,
  "subscribe": [
    "[CallStarted",
    "CallConnected",
    "CallCompleted]"
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token generated from SmartMEX selfcare"
    },
    "scope": {
      "type": "string",
      "description": "Scope of subscription: ā€œcompanyā€¯ or ā€œemployeeā€¯"
    },
    "contact_id": {
      "type": "number",
      "description": "In the case of scope ā€œemployeeā€¯, contact_id of employee to receive these events about"
    },
    "subscribe": {
      "type": "array",
      "description": "Array of event names which this websocket will be subscribed to"
    }
  },
  "required": [
    "token",
    "scope"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "status": "OK",
  "statusCode": 200,
  "message": "OK",
  "version": "1.21",
  "data": [
    {
      "wss_token": "utniTJ4A9ploDVDL"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Status of the request"
    },
    "statusCode": {
      "type": "number",
      "description": "Status code. Mapping to HTTP response code meaning"
    },
    "message": {
      "type": "string",
      "description": "Additional request status message"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "array",
      "description": "Container of requested fields"
    }
  },
  "required": [
    "status",
    "statusCode",
    "message",
    "version"
  ]
}

Request new WSS session token
POST/api/session_keys/create

Request new WSS connection token

Returned response contains a WSS Token value:

  • wss_token - WSS token value

Webhook Events

CallStarted

POST /yoururl_for_CallStarted
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "CallStarted",
  "version": "v1",
  "data": {
    "callID": 150818921852,
    "caller": "22222222",
    "destination": "23333333",
    "direction": "in",
    "status": 1,
    "callStarted": "2017-10-16T21:26:59+0000",
    "contactID": 224
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (CallStarted)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "callID": {
          "type": "number",
          "description": "Unique ID for the call"
        },
        "caller": {
          "type": "string",
          "description": "The number of calling party"
        },
        "destination": {
          "type": "string",
          "description": "The number which call was placed to"
        },
        "direction": {
          "type": "string",
          "description": "\"in\" or \"out\" to indicate if the call was incoming or outgoing"
        },
        "status": {
          "type": "number",
          "description": "Status of the call"
        },
        "callStarted": {
          "type": "string",
          "description": "Start time of the call"
        },
        "contactID": {
          "type": "number",
          "description": "`contact_id` of Employee involved in the call"
        }
      },
      "required": [
        "callID",
        "caller",
        "destination",
        "direction",
        "status",
        "callStarted",
        "contactID"
      ],
      "description": "Object containing event (CallStarted) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

CallStarted webhook callback
POST/yoururl_for_CallStarted

Provides event with data payload about the call when event CallstartedEvent is received during the start of the call.

Received event contains fields with data about a call that was started; Every Callstarted event has following fields:

  • callID - Unique ID for the call

  • caller - The number of calling party

  • destination - The number which call was placed to

  • direction - ā€œinā€¯ or ā€œoutā€¯ to indicate if the call was incoming or outgoing

  • status - Status of the call

  • callStarted - Start time of the call

  • contactID - contact_id of Employee involved in the call


CallConnected

POST /yoururl_for_CallConnected
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "CallConnected",
  "version": "v1",
  "data": {
    "callID": 150818921852,
    "caller": "22222222",
    "destination": "23333333",
    "direction": "in",
    "status": 1,
    "callStarted": "2017-10-16T21:26:59+0000",
    "callConnected": "2017-10-16T21:26:59+0000",
    "contactID": 224
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (CallConnected)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "callID": {
          "type": "number",
          "description": "Unique ID for the call"
        },
        "caller": {
          "type": "string",
          "description": "The number of calling party"
        },
        "destination": {
          "type": "string",
          "description": "The number which call was placed to"
        },
        "direction": {
          "type": "string",
          "description": "\"in\" or \"out\" to indicate if the call was incoming or outgoing"
        },
        "status": {
          "type": "number",
          "description": "Status of the call"
        },
        "callStarted": {
          "type": "string",
          "description": "Start time of the call"
        },
        "callConnected": {
          "type": "string",
          "description": "Answer time of the call"
        },
        "contactID": {
          "type": "number",
          "description": "`contact_id` of Employee involved in the call"
        }
      },
      "required": [
        "callID",
        "caller",
        "destination",
        "direction",
        "status",
        "callStarted",
        "callConnected",
        "contactID"
      ],
      "description": "Object containing event (CallConnected) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

CallConnected webhook callback
POST/yoururl_for_CallConnected

Provides event with data payload about the call when event CallConnectedEvent is received during a moment when call is answered.

Received event contains fields with data about a call that was answered; Every CallConnected event has following fields:

  • callID - Unique ID for the call

  • caller - The number of calling party

  • destination - The number which call was placed to

  • direction - ā€œinā€¯ or ā€œoutā€¯ to indicate if the call was incoming or outgoing

  • status - Status of the call

  • callStarted - Start time of the call

  • callConnected - Answer time of the call

  • contactID - contact_id of Employee involved in the call


CallCompleted

POST /yoururl_for_CallCompleted
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "CallCompleted",
  "version": "v1",
  "data": {
    "callID": 150818921852,
    "caller": "22222222",
    "destination": "23333333",
    "direction": "in",
    "status": 1,
    "callStarted": "2017-10-16T21:26:59+0000",
    "callConnected": "2017-10-16T21:26:59+0000",
    "connectionTime": 112,
    "contactID": 224,
    "previous_contactID: 221(required,number) - `contact_id` of Employee who initiated the transfer": "Hello, world!"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (CallCompleted)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "callID": {
          "type": "number",
          "description": "Unique ID for the call"
        },
        "caller": {
          "type": "string",
          "description": "The number of calling party"
        },
        "destination": {
          "type": "string",
          "description": "The number which call was placed to"
        },
        "direction": {
          "type": "string",
          "description": "\"in\" or \"out\" to indicate if the call was incoming or outgoing"
        },
        "status": {
          "type": "number",
          "description": "Status of the call"
        },
        "callStarted": {
          "type": "string",
          "description": "Start time of the call"
        },
        "callConnected": {
          "type": "string",
          "description": "Answer time of the call"
        },
        "connectionTime": {
          "type": "number",
          "description": "Duration of the entire call"
        },
        "contactID": {
          "type": "number",
          "description": "`contact_id` of Employee involved in the call"
        },
        "previous_contactID: 221(required,number) - `contact_id` of Employee who initiated the transfer": {
          "type": "string"
        }
      },
      "required": [
        "callID",
        "caller",
        "destination",
        "direction",
        "status",
        "callStarted",
        "callConnected",
        "connectionTime",
        "contactID"
      ],
      "description": "Object containing event (CallCompleted) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

CallCompleted webhook callback
POST/yoururl_for_CallCompleted

Provides event with data payload about the call when event CallCompletedEvent is received during a moment when call has ended.

Received event contains fields with data about a call that was ended; Every CallCompleted event has following fields:

  • callID - Unique ID for the call

  • caller - The number of calling party

  • destination - The number which call was placed to

  • direction - ā€œinā€¯ or ā€œoutā€¯ to indicate if the call was incoming or outgoing

  • status - Status of the call

  • callStarted - Start time of the call

  • callConnected - Answer time of the call

  • connectionTime - Duration of the entire call

  • contactID - contact_id of Employee involved in the call

  • previous_contactID - contact_id of Employee who initiated the transfer


VoicemailCreated

POST /yoururl_for_VoicemailCreated
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "VoicemailCreated",
  "version": "v1",
  "data": {
    "sender": "23332222",
    "voicemailID": 171118926552,
    "length": 45,
    "callStarted": "2017-10-16T21:26:59+0000",
    "voicemailBoxID": 223,
    "voicemailBoxName": "User voicemail box",
    "messageURL": "https://zvanuparvaldnieks.lmt.lv/files/dm0vNzI349857345dfvjdfTYUTDfdHIYEWDUIDY5MDQwMy8yMDE3LzEwNC5tcDM="
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (VoicemailCreated)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "sender": {
          "type": "string",
          "description": "The Number which left the voicemail message"
        },
        "voicemailID": {
          "type": "number",
          "description": "ID of the voicemail message"
        },
        "length": {
          "type": "number",
          "description": "Voicemail message length in seconds"
        },
        "callStarted": {
          "type": "string",
          "description": "Start time of the call"
        },
        "voicemailBoxID": {
          "type": "number",
          "description": "ID of the voicemail box"
        },
        "voicemailBoxName": {
          "type": "string",
          "description": "Name of the voicemail box"
        },
        "messageURL": {
          "type": "string",
          "description": "An URL to an audio file"
        }
      },
      "required": [
        "sender",
        "voicemailID",
        "length",
        "callStarted",
        "voicemailBoxID",
        "voicemailBoxName",
        "messageURL"
      ],
      "description": "Object containing event (VoicemailCreated) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

VoicemailCreated webhook callback
POST/yoururl_for_VoicemailCreated

Provides event with data payload about the voicemail when event VoicemailMessageCreatedEvent is received during a moment when caller has left a voicemail.

Received event contains fields with data about a voicemail that was created by a caller leaving a message; Every VoicemailMessageCreated event has following fields:

  • sender - The Number which left the voicemail message

  • voicemailID - ID of the voicemail message

  • length - Voicemail message length in seconds

  • callStarted - Start time of the call

  • voicemailBoxID - ID of the voicemail box

  • voicemailBoxName - Name of the voicemail box

  • messageURL - An URL to an audio file

An Audio file of the message can be retreived from the server by making a GET request towards a supplied URL and providing customer HTTP request header field:

GET /files/dm0vNzI349857345dfvjdfTYUTDfdHIYEWDUIDY5MDQwMy8yMDE3LzEwNC5tcDM= HTTP/1.1
Host: zvanuparvaldnieks.lmt.lv
X-Smartmex-Token: jwep640q4QX7nYpWZOSe

where token is the same token, as the one used for JSON API access.


VoicemailDeleted

POST /yoururl_for_VoicemailDeleted
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "VoicemailDeleted",
  "version": "v1",
  "data": {
    "sender": "23332222",
    "voicemailID": 171118926552
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (VoicemailDeleted)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "sender": {
          "type": "string",
          "description": "The Number which left the voicemail message"
        },
        "voicemailID": {
          "type": "number",
          "description": "ID of the voicemail message"
        }
      },
      "required": [
        "sender",
        "voicemailID"
      ],
      "description": "Object containing event (VoicemailDeleted) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

VoicemailDeleted webhook callback
POST/yoururl_for_VoicemailDeleted

Provides event with data payload about the voicemail when event VoicemailMessageDeletedEvent is received during a moment when user has deleted a voicemail message.

Received event contains fields with data about a voicemail that was deleted by a user; Every VoicemailMessageDeleted event has following fields:

  • sender - The Number which left the voicemail message

  • voicemailID - ID of the voicemail message


LostCallerAdded

POST /yoururl_for_LostCallerAdded
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "LostCallerAdded",
  "version": "v1",
  "data": {
    "contact_name": "Andris Berzins",
    "destination": "23332222",
    "attempts": 3,
    "callerid 22222222": "Hello, world!",
    "last_contact `2018-01-16T11:26:59+0000`(required,string) -  Time when the last unsuccessful call attempt was made from caller. Format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET": "Hello, world!"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (LostCallerAdded)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "contact_name": {
          "type": "string",
          "description": "Employee name, this phone number is assigned to"
        },
        "destination": {
          "type": "string",
          "description": "The dialed destination"
        },
        "attempts": {
          "type": "number",
          "description": "Number of unsuccesful call attempts"
        },
        "callerid 22222222": {
          "type": "string",
          "description": "The number of calling party"
        },
        "last_contact `2018-01-16T11:26:59+0000`(required,string) -  Time when the last unsuccessful call attempt was made from caller. Format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET": {
          "type": "string"
        }
      },
      "required": [
        "contact_name",
        "destination",
        "attempts",
        "callerid 22222222"
      ],
      "description": "Object containing event (LostCallerAdded) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

LostCallerAdded webhook callback
POST/yoururl_for_LostCallerAdded

Provides event with data payload data about the call when event LostCallerCreatedEvent is received during a moment when call does not get answered and gets registered as lost.

Received event contains fields with data about a lost call record that was created after not being answered by employee; Every LostCallerCreated event has following fields:

  • contact_name - Employee name, this phone number is assigned to

  • destination - The dialed destination

  • attempts - Number of unsuccesful call attempts

  • callerid - The number of calling party

  • last_contact - Time when the last unsuccessful call attempt was made from caller. Format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET


LostCallerUpdated

POST /yoururl_for_LostCallerUpdated
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "VoicemailCreated",
  "version": "v1",
  "data": {
    "contact_name": "Andris Berzins",
    "destination": "23332222",
    "attempts": 3,
    "callerid 22222222": "Hello, world!",
    "last_contact `2018-01-16T11:26:59+0000`(required,string) -  Time when the last unsuccessful call attempt was made from caller. Format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET": "Hello, world!"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (VoicemailCreated)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "contact_name": {
          "type": "string",
          "description": "Employee name, this phone number is assigned to"
        },
        "destination": {
          "type": "string",
          "description": "The dialed destination"
        },
        "attempts": {
          "type": "number",
          "description": "Number of unsuccesful call attempts"
        },
        "callerid 22222222": {
          "type": "string",
          "description": "The number of calling party"
        },
        "last_contact `2018-01-16T11:26:59+0000`(required,string) -  Time when the last unsuccessful call attempt was made from caller. Format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET": {
          "type": "string"
        }
      },
      "required": [
        "contact_name",
        "destination",
        "attempts",
        "callerid 22222222"
      ],
      "description": "Object containing event (VoicemailCreated) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

LostCallerUpdated webhook callback
POST/yoururl_for_LostCallerUpdated

Provides event with data payload data about the call when event LostCallerUpdatedEvent is received during a moment when another unsuccesful call attempt is received from the same number, so lost call record attempts and last_contact fields get updated with new number and timestamp.

Received event contains fields with data about a lost call record that was updated after not being answered by employee repeatedly; Every LostCallerUpdated event has following fields:

  • contact_name - Employee name, this phone number is assigned to

  • destination - The dialed destination

  • attempts - Number of unsuccesful call attempts

  • callerid - The number of calling party

  • last_contact - Time when the last unsuccessful call attempt was made from caller. Format: YYYY-MM-DDTH24:mm:SS+UTC_OFFSET


LostCallerRemoved

POST /yoururl_for_LostCallerRemoved
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "type": "Event",
  "eventType": "LostCallerRemoved",
  "version": "v1",
  "data": {
    "destination": "23332222",
    "callerid 22222222": "Hello, world!"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "eventType": {
      "type": "string",
      "description": "Type of the event (LostCallerRemoved)"
    },
    "version": {
      "type": "string",
      "description": "Unique API version identifier"
    },
    "data": {
      "type": "object",
      "properties": {
        "destination": {
          "type": "string",
          "description": "The dialed destination"
        },
        "callerid 22222222": {
          "type": "string",
          "description": "The number of calling party"
        }
      },
      "required": [
        "destination",
        "callerid 22222222"
      ],
      "description": "Object containing event (LostCallerRemoved) data"
    }
  },
  "required": [
    "type",
    "eventType",
    "version"
  ]
}
Responses200
Headers
Content-Type: application/json

LostCallerRemoved webhook callback
POST/yoururl_for_LostCallerRemoved

Provides event with data payload about the call when event LostCallerDeletedEvent is received during a moment when lost call gets called back from employee or gets answered later in repeated call from the same caller.

Received event contains fields with data about a lost call record that was deleted after caller eventually being reached by employee; Every LostCallerDeleted event has following fields:

  • destination - The dialed destination

  • callerid - The number of calling party


Generated by aglio on 11 May 2018