IVR API DOC

Index

Sukam Apps hierarchy

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

1) Objects

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 (seetopic 2.1)

1.2) AgentGroup object

  • name (string 32)
  • display_name (string 64)
  • sticky (boolean)
  • sticky_days (integer)
  • ringtime integer [in seconds 10-30]
  • 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:

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

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 event

 
Raised when a call arrives on any application.
Parameters:
  • app – guid of the app as described intopic 1.1
  • event – set to value IN
  • uniqueid – Uniqueid of the call
  • cli – the caller id number as received
  • time – the incoming call time (notetopic 4.1)

 

4.2.2) Transfer attempt event

Raised when the IVR attempts to connect to an agent.
Parameters:
  • app – guid of the app as described in topic 1.1
  • event – set to value TA
  • uniqueid – Uniqueid of the call
  • cli – the caller id number as received
  • attemptid – Uniqueid of the transfer attempt
  • time – transfer attempt time (notetopic 4.1)
  • to – the agent number

4.2.3) Transfer connect event

Raised when the call is answered by the agent.
Parameters:
  • app – guid of the app as described intopic 1.1
  • event – set to value TC
  • uniqueid – Uniqueid of the call
  • cli – the caller id number as received
  • attemptid – Uniqueid of the transfer attempt
  • time – connected time (notetopic 4.1)
  • to – the agent number

 

4.2.4) Transfer end event

Raised when the call attempt is finished.
Parameters:
  • app – guid of the app as described intopic 1.1
  • event – set to value TE
  • uniqueid – Uniqueid of the call
  • cli – the caller id number as received
  • attemptid – Uniqueid of the transfer attempt
  • to – the agent number
  • duration – transfer duration in seconds
  • result – [answered, busy, congestion, noanswer]

 

4.2.5) Hangup event

Raised when the call is hangup.
Parameters:
  • app – guid of the app as described intopic 1.1
  • event – set to value H
  • uniqueid – Uniqueid of the call
  • cli – the caller id number as received
  • duration – call duration in seconds