IVR API DOC

Index

Sukam Apps hierarchy

  • Vendor
    • Subscriber
      • Apps
        • AgentGroups
          • Agents (links to Users under subscriber)
      • Users

1) Objects

				
					{'page': {
   'endIndex': 1,
   'last': 'http://localhost/api/v1/app/list?apikey=89e801bcc21f430aa1ff6edb5421af31&pg=1',
   'first': 'http://localhost/api/v1/app/list?apikey=89e801bcc21f430aa1ff6edb5421af31&pg=1',
   'startIndex': 1,
   'totalItems': 1,
   'cur': 'http://localhost/api/v1/app/list?apikey=89e801bcc21f430aa1ff6edb5421af31',
   'totalPages': 1
 },
 'data': [
   {
     'guid': '4e11fe2082b044b4a3b55718c79c29d5',
     'number.virtual': '33047316',
     'number.physical': '33047316',
     'name': 'test'
   }
 ]
}
				
			

1.1) App object

  • guid (string:- 32)
  • name (string:- 32)
  • number.virtual (string:- 32)
  • number.physical (string:- 32) [DID]

Apps are identified using their respective guid. You need to store the guid in your app database table to be able to be identified during a call event. List of apps can be retrieved using app list API (see topic 2.1)

1.2) AgentGroup object

  • name (string:- 32)
  • display_name (string:- 64)
  • sticky (boolean)
  • sticky_days (integer)
  • ringtime integer [in seconds 10-20]
  • recording [‘enabled’, ‘disabled’]
  • distribution [‘RR’, ‘PR’]

Agent groups are identified using their names

1.3) Agent object

    • name (string:- 32)
    • priority (integer)
    • guid (string:- 32) [associated user guid, could be null in case there is no associated user)
    • number (string:- 32) [ the phone number ]
    • type (string 12) [USER in case there”s an associated user, NUMBER if there”s not)

2) APIs

All API responses are JSON encoded, http code 200 indicates success, other codes should be considered as errors.

2.1) App list

  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/list
  • input parameters:
  • input headers:
  • Pagination: Yes, max 100 items are listed in a page

eg. response:

2.2) list Agent groups in an app

  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/ag/list
  • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 2.1)
  • input parameters:
  • input headers:
  • Pagination: no

eg. response:

				
					{   'data': [
     {
       'name': 'default',
       'display_name': 'default'
     }
   ]
}
				
			
2.3.1) Get agent group
  • Scope: Vendor, Subscriber
  • Method: GET
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/ag/$name
    • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 21) and $name with group name retrieved using Agent group list (ref:topic 2.2)
  • input parameters:
  • input headers:
  • Pagination: no

eg. response:

				
					{ 'sticky': false,
 'name': 'default',
 'ringtime': 15,
 'recording': 'enabled',
 'distribution': 'RR',
 'sticky_days': 30
}
				
			
2.3.2) Edit agent group
  • Scope: Vendor, Subscriber
  • Method: POST
  • Content-type: application/x-www-form-urlencoded (default content type for html form submit)
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/ag/$name
    • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 21) and $name with group name retrieved using Agent group list (ref:topic 2.2)
  • input parameters:
    • apikey (optional) (notetopic 3.1)
    • distribution: either “PR” or “RR” (Priority based routing or round robin based routing of calls)”
    • sticky: 0 or 1
    • sticky_days: how long to stick agent for
    • recording: “enabled” or “disabled”
    • ringtime: value between 10 and 30 seconds
  • input headers:
  • Response: updated values

eg. response:

				
					{ 'sticky': false,
 'name': 'default',
 'ringtime': 15,
 'recording': 'enabled',
 'distribution': 'RR',
 'sticky_days': 30
}
				
			

group lists the group parameters for object def ref:

 

2.4) Get agents list from a group

  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/ag/$name/agents
    • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 21) and $name with group name retrieved using Agent group list (ref:topic 2.2)
  • input parameters:
  • input headers:
  • Pagination: no

 

eg. response:

				
					{ 'maxPriority': 1,
 'agents': [
   {
     'type': 'USER',
     'number': '971670XXXX',
     'priority': 1,
     'guid': '21c50d57625040419a7bef92ea4c6c6c',
     'name': 'Anil Gupta'
   }
 ]
}
				
			

maxPriorityis the highest priority entry in the group, useful for new agent entries

agentsarray lists all agents in a group for object def ref:topic 1.3

2.5) Adding agents

Adding agents is a 2 step process. All agent numbers are to be verified before they could be placed in the system. A number needs to be verified only once for a given subscriber.

Every time you need to add an agent into a group you must call Number verification API first (see below) with a preferred method. The API will respond with either ‘passed’ or ‘pending’. ‘pending’ indicates that this is the first time this number is being added, you must call the verification API again along with the `key` parameter before proceeding to add agent. See examples below.

2.5.1) Number verification
  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/verifyagent
  • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 2.1)
  • Parameters:
    • number: the number to be verified
    • method: (optional) verification method, either “sms” or “call”. Defaults to “sms”.
    • key: verification key, only required in the second step
  • Examples:
    • Check if number 971670XXXX is verified, if not verify it

      Request:

      POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/verifyagent

      Header: X-APIKey=xxxxxxxxxxxxxx

      POST Data: number=971670XXXX&method=sms

Response

				
					{ 'verification': 'pending'
}
				
			

Number is not verified, let”s verify it using the key received.

Request:

POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/verifyagent

Header: X-APIKey=xxxxxxxxxxxxxx

POST Data: number=971670XXXX&key=0805

Response

				
					{ 'verification': 'passed'
}
				
			

Number is now verified, we can add it to a group now using add agent API in the next section.

2.5.2) Adding an agent to a group
  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/ag/$name/addAgent
  • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 2.1) and $name with group name retrieved using Agent group list (ref:topic 2.2)
  • Parameters:
    • number: the verified(ref :topic 2.5.2) agent number
    • name: agent name for display
    • priority (int): suggested priority
  • Examples:
    • Add 971670XXXX to group default in an app

      Request:

      POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/ag/default/addAgent

      Header: X-APIKey=xxxxxxxxxxxxxx

      POST Data: number=971670XXXX&name=testagent

      Response

				
					{ 'result': 'success'
}
				
			
2.5.3) Removing an agent from the group
  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/ag/$name/remAgent
  • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 2.1) and $name with group name retrieved using Agent group list (ref:topic 2.2)
  • Parameters:
  • Examples:
    • Remove 971670XXXX from group default in an app

      Request:

      POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/ag/default/remAgent

      Header: X-APIKey=xxxxxxxxxxxxxx

      POST Data: number=971670XXXX

      Response

				
					{ 'result': 'success'
}
				
			

2.6) Call logs

  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/calls
  • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 2.1)
  • input parameters:
    • `apikey` [optional] (notetopic 3.1)
    • `since` [datetime, optional] (notetopic 3.1)
    • `items` [interger, optional, default=100] max items to fetch in a query. Range between 1 – 500
  • input headers:
  • Pagination: Yes

 

eg. response:

				
					{ 'page': {
   'totalItems': 1,
   'last': 'http://mycalls.sukamapps.com/api/v1/app/1a11fe2082b044b4a3b55718c79c29d5/calls?pg=1',
   'pageItems': 1,
   'pageNumber': 1,
   'cur': 'http://mycalls.sukamapps.com/api/v1/app/1a11fe2082b044b4a3b55718c79c29d5/calls',
   'endIndex': 1,
   'startIndex': 1,
   'totalPages': 1,
   'first': 'http://mycalls.sukamapps.com/api/v1/app/1a11fe2082b044b4a3b55718c79c29d5/calls?pg=1'
 },
 'data': [
   {
     'log': [
       {
         'desc': 'TRANSFER SOON',
         'id': 'TRANSFER_INIT'
       }
     ],
     'hot': 0,
     'cli': '9716700271',
     'uid': '1498110438.13',
     'time': '2017-06-22T11:17:18+05:30',
     'active': false,
     'duration': '19',
     'transfer': [
       {
         'attemptId': '1498110438.13.2',
         'du': '3',
         'name': 'Anil Gupta',
         'seq': '7',
         'time': '2017-06-22T11:17:36+05:30',
         'to': '971670XXXX',
         'group': 'default',
         'disposition': 'answered'
       },
       {
         'attemptId': '1498110438.13.1',
         'du': '0',
         'name': 'Anil Gupta',
         'seq': '5',
         'time': '2017-06-22T11:17:20+05:30',
         'to': '971670XXXX',
         'group': 'default',
         'disposition': 'noanswer'
       }
     ]
   }
 ]
}
				
			
2.6.1) Incremental call logs

For incremental call log pass `since` parameter to the call log api.

2.6.2) Retreiving single call log
  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/call
  • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 2.1)
  • input parameters:
    • `apikey` [optional] (notetopic 3.1)
    • `uid` [mandatory], uid of the call
    •  

2.7) Call recordings

  • Scope: Vendor, Subscriber
  • url: https://mycalls.sukamapps.com/api/v1/app/$guid/callRU
  • Replace $guid in the url with an app guid retrieved using App list API (ref:topic 2.1)
  • input parameters:
  • input headers:

eg. response:

				
					{
url: "someurl/s.745726.wav"
}
				
			

3) API Key and authentication

3.1 API Key

Your API key is listed on your profile page https://mycalls.sukamapps.com/profile

3.2 Authentication

API key can be used in 2 different ways,

a) by appending it to the url as apikey parameter. eg. https://mycalls.sukamapps.com/api/v1/acc/list?apikey=yourlongapikey

b) by using X-APIKey header in the request
method a) only works for get requests like getting a list of apps or subscribers and will not work for post requests like adding an operator, hence it is advisable to use method b

4) Sukam Apps Event hook API specification

  • A single API is required at your application end to receive call events. Sukam Apps will make a post request to this API URL with content-type: application/x-www-form-urlencoded, which is the default content type during post requests. The API should respond with plain text OK along with http code 200(default).
  • The API is configured vendor wide/subscriber wide, meaning all application data is channeled through a single API endpoint. Visit profile section at https://mycalls.sukamapps.com/profile after logging in, to configure your API hook.

4.1) Datetime format

  • All datetime values would be passed in ISO 8601 format i.e. YYYY-MM-DDTHH:MM:SS+HH:MM

4.2.1 Incoming Call Event

This event is triggered when an incoming call is received by any application.
Parameters:

  • app: The unique GUID of the application handling the incoming call (see Topic 1.1 for details).

  • event: Set to "IN" to signify that this is an incoming call.

  • uniqueid: A unique identifier for the call.

  • cli: The caller’s ID number, as it was received.

  • time: The timestamp when the incoming call was logged (see Topic 4.1 for timing details).


4.2.2 Transfer Attempt Event

This event occurs when the IVR system tries to transfer the call to an agent.
Parameters:

  • app: The unique GUID of the application responsible for the transfer attempt (see Topic 1.1).

  • event: Set to "TA" to indicate a transfer attempt.

  • uniqueid: A unique identifier for the original call.

  • cli: The caller’s ID number as received.

  • attemptid: A unique identifier for this specific transfer attempt.

  • time: The time when the transfer attempt was made (see Topic 4.1 for timing details).

  • to: The identifier of the agent to whom the call is being transferred.


4.2.3 Transfer Connected Event

This event is triggered when the call is successfully answered by the agent.
Parameters:

  • app: The GUID of the application managing the call (see Topic 1.1).

  • event: Set to "TC" to indicate that the transfer has been successfully connected.

  • uniqueid: The unique identifier of the original call.

  • cli: The caller’s ID number.

  • attemptid: A unique identifier for the transfer attempt.

  • time: The timestamp when the agent answers the call (see Topic 4.1).

  • to: The agent’s number who answered the call.


4.2.4 Transfer Ended Event

This event occurs when the transfer process ends, either successfully or unsuccessfully.
Parameters:

  • app: The GUID of the application handling the call (see Topic 1.1).

  • event: Set to "TE" to indicate the transfer has ended.

  • uniqueid: A unique identifier for the original call.

  • cli: The caller’s ID number.

  • attemptid: A unique identifier for the transfer attempt.

  • to: The agent’s number to whom the call was transferred.

  • duration: The length of time the transfer lasted, in seconds.

  • result: The outcome of the transfer, which can be one of the following:

    • answered: The call was answered by the agent.

    • busy: The agent was unavailable.

    • congestion: A network issue or congestion occurred.

    • noanswer: The agent did not answer the call.


4.2.5 Call Hangup Event

This event is triggered when the call is hung up, either by the caller or the agent.
Parameters:

  • app: The GUID of the application managing the call (see Topic 1.1).

  • event: Set to "H" to indicate that the call has been hung up.

  • uniqueid: The unique identifier for the call.

  • cli: The caller’s ID number.

  • duration: The total duration of the call in seconds.