Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

With our API you can integrate uContact with other systems.

Info

To use the API you need

  1. Authenticate and get a token for the session

  2. Use the token in the Header Authorization

  3. End session

Tip

It is recommended to create a user that is exclusively for use with the uContact API.


API Omnichannel

API Telephony

API Other Actions

API Gamification

DataBases

Examples


Image RemovedImage Added

Prior to making any of the queries to the web services it is necessary to obtain the APIkey through the Login.

To do this, we will use the UserLogin service and enter a valid username and super user password.

Expand
titleClick here to expand UserLogin Service

User

Code Block
Relative URL: Integra/resources/auth/UserLogin
Method: POST
content-type:application/x-www-form-urlencoded; charset=UTF-8
Params: user
        password
Result: JSON

Code Block
Where Md5secret is the APIKey or if it has no phone will have it on the 3rd item of the List
If error Response is 0

Supervisor con teléfono

Md5secret es la APIKey

Code Block
[ ...
    {
        ....
        "md5secret": "Q2FyaW5hOjI3YzdjNWM5LTkzYzQtNDYyMi1iYzg2LTlkMmNkMGVjNWEzMA==", 
        ....        
    }
]

Supervisor sin teléfono

Al final de la lista

Code Block
[ ...
    "QWRtaW46OTgzNWM1MjUtMzU2Ny00YjgyLWEwYWYtY2NkMjNlMDhjNzA3"
]

Si es Error Respuesta 0
Expand
titleClick here to expand jQuery example code
Code Block
$.ajax({
  type: 'POST', 
  url: 'https://<ucontactinstance>.ucontactcloud.com/Integra/resources/auth/UserLogin',
  contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  dataType: 'text',
  data: {
    user: 'ExampleUsername',
    password: 'ExamplePassword'
  },
  success: (resp) => {},
  error: (resp) => {}
});

Image Removed
Image Added

Once you have your login token we will see how to use it in API queries:

  • JQuery can be configured to use the token in each request.

  • If not, it can be specified in the headers in each request made.

Expand
titleClick here to expand example configuration in jQuery
Code Block
$.ajaxSetup({
  headers: {
    'Authorization': "Basic " + APIKey
  }
});
Expand
titleClick here to expand example of token in authorization header

Code Block
$.ajax({
    type: 'POST',
    url: 'https://<ucontactinstance>.ucontactcloud.com/Integra/resources/any/request',
    contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
    dataType: 'text',
    headers:{
        'Authorization': 'Basic <APIKey>'
    },
    data: {
        param1: 'exampleParam1',
        param2: 'exampleParam2'
    },
    success: (resp) => {},
    error: (resp) => {}
});

Image Removed
Image Added

After using the API it is necessary to end the session.

This way we will avoid security problems by disabling the token generated in the login of the startup.

Expand
titleClick here to expand and see the method

Code Block
Relative URL: Integra/resources/auth/EndSession
Method: POST
content-type:application/x-www-form-urlencoded; charset=UTF-8
Params: user
	    token
Result: 1 OK  0 ERROR 

Expand
titleClick here to expand example for jQuery code

Code Block
$.ajax({
    type: 'POST',
    url: 'https://&lt;ucontactinstance>.ucontactcloud.com/Integra/resources/auth/EndSession',
    contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
    dataType: 'text',
    headers:{
        'Authorization': 'Basic <APIKey>'
    },
    data: {
        user: 'ExampleUser',
        token: '<token>'
    },
    success: (resp) => {},
    error: (resp) => {}
});


Aditional Iinformation

Note
  • All WebServices are REST

  • Only https (http2) is used for security, a valid certificate *.ucontactcloud.com is provided

CrossDomain Connection

With the proxy window we can handle events of an iframe inserted in a form to be able, for example, to make dispositions, hang up the call, close the form or whatever is desired.
To do this you don't need any plugin.


Expand
titlePrevious Steps

In the form you must put this

Code Block
window.addEventListener('message', event => {
    if (event.data.action === 'CLOSE_TAB') {
		parent.closeActiveTab(); 
	} else if (event.data.action === 'DISPOSITION_CALL') {
		let dataDisp = event.data.disposition;
		UC_DispositionCall(dataDisp.campaign, dataDisp.callerid, dataDisp.guid, dataDisp.l1, dataDisp.l2, dataDisp.l3, dataDisp.d1, dataDisp.d2, dataDisp.comment, dataDisp.schedule, callbackDiposition, errorDiposition);
	}   
});

event.data can be used to identify the type of action.

And the disposition attribute is used as an object to send more information.

Expand
titleHow to invoke the event

The way to invoke the event would be the following:

Code Block
let dataDisp = {
	 campaign: 'CampanaTest',
	 callerid: '123456Test',
	 guid:'3123-3123-3123-312-3123',
	 l1:'nivel1',
	 l2:'nivel2',
	 l3:'nivel3',
	 d1:'data1',
	 d2:'data2',
	 comment:'ComentarioTest',
	 schedule:'2019-05-04 15:55:55'
};

window.parent.postMessage({ action: 'DISPOSITION_CALL', disposition:dataDisp}, '*');

You may also be interested ...


Upload dialer base


Webcallback

Postman collection for the Login and Logoff.

View file
nameAPI Security.postman_collection.json