Date: Thu, 28 Mar 2024 22:15:12 +0000 (UTC) Message-ID: <1660955656.31.1711664112586@d6e4db8463e1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_30_1241282097.1711664112585" ------=_Part_30_1241282097.1711664112585 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
See the different possibilities that our API offers you to integrate uCo= ntact with external systems.
In order to use the API you need:
Authenticate and get a token for the session.
Use the token in the Authorization Header.
Log out.
It is recommended to create a user that is exclusively to use wi= th the uContact API.
Foremost, we need to get APIkey. For this, we use the <= strong>getUserToken service with a valid SuperUser username and password.
https://dom= inio.ucontactcloud.com/Integra/resources/auth/getUserToken Method: POST content-type:application/x-www-form-urlencoded; charset=3DUTF-8 Parameters: user password Answer: JSON
At the end of the list
[ ... "QWRtaW46OTgzNWM1MjUtMzU2Ny00YjgyLWEwYWYtY2NkMjNlMDhjNzA3" ] If it is Error Answer 0
$.ajax({ type: 'POST', url: 'https://domain.ucontactcloud.com/Integra/resources/auth/getUse= rToken', contentType: 'application/x-www-form-urlencoded; charset=3DUTF-= 8', dataType: 'text', data: { user: 'ExampleUsername', password: 'ExamplePassword' }, success: (resp) =3D> {}, error: (resp) =3D> {} });
Once you have your login token, let's move on to how to use it in A
jQuery can be configured to use the token on every request.
If not, it can be specified in the headers in each request that is made.=
$.ajaxSetup= ({ headers: { 'Authorization': "Basic " + APIKey } });
$.ajax({ type: 'POST', url: 'https://dominio.ucontactcloud.com/Integra/resources/any/request', contentType: 'application/x-www-form-urlencoded; charset=3DUTF-8', dataType: 'text', headers:{ 'Authorization': 'Basic <APIKey>' }, data: { param1: 'exampleParam1', param2: 'exampleParam2' }, success: (resp) =3D> {}, error: (resp) =3D> {} });
After using the API, it is necessary to end the session= . In this way, we will avoid security problems by disabling the token gener= ated at the start login.
https://dom= inio.ucontactcloud.com/Integra/resources/auth/EndSession Method: POST content-type:application/x-www-form-urlencoded; charset=3DUTF-8 Params: user =09 token Result: 1 OK 0 ERROR
$.ajax({ type: 'POST', url: 'https://domain.ucontactcloud.com/Integra/resources/auth/EndSessio= n', contentType: 'application/x-www-form-urlencoded; charset=3DUTF-8', dataType: 'text', headers:{ 'Authorization': 'Basic <APIKey>' }, data: { user: 'ExampleUser', token: '<token>' }, success: (resp) =3D> {}, error: (resp) =3D> {} });
All WebServices are REST type.
uContact uses https by default (http2).
With the Windows proxy, we can handle events of an iframe inserted in a = form, to be able to do dispositions, hang up the call, close the form, or w= hatever you want, for example. To do this, no plugin is needed.
In the form you must put:
window.addEve= ntListener('message', event =3D> { if (event.data.action =3D=3D=3D 'CLOSE_TAB') { =09=09parent.closeActiveTab();=20 =09} else if (event.data.action =3D=3D=3D 'DISPOSITION_CALL') { =09=09let dataDisp =3D event.data.disposition; =09=09UC_DispositionCall(dataDisp.campaign, dataDisp.callerid, dataDisp.gui= d, dataDisp.l1, dataDisp.l2, dataDisp.l3, dataDisp.d1, dataDisp.d2, dataDis= p.comment, dataDisp.schedule, callbackDiposition, errorDiposition); =09} =20 });
event.data can be used to identify what type the action is.
And the disposition attribute is used as an object to send more informat= ion.
How to invoke it?
The way to invoke it is:
let dataDisp = =3D { =09 campaign: 'Campa=C3=B1aTest', =09 callerid: '123456Test', =09 guid:'3123-3123-3123-312-3123', =09 l1:'nivel1', =09 l2:'nivel2', =09 l3:'nivel3', =09 d1:'data1', =09 d2:'data2', =09 comment:'ComentarioTest', =09 schedule:'2019-05-04 15:55:55' }; window.parent.postMessage({ action: 'DISPOSITION_CALL', disposition:dataDis= p}, '*');
Users with "SuperUser" role in uContact have the functionality to create= tokens for use outside of the application. To create a token, follow these= steps:
Access the user menu.
Select the "API tokens" option in the dropdown menu and a modal will ope= n for its creation.
Enter the name that you want to use to identify the token and click the = "Save" button to create a new token.
Once a token has been created in uContact, "SuperUsers" have the ability= to share it with other users. To do so, simply click on the clip icon. Thi= s will automatically copy the token to the clipboard and it can then be sen= t to anyone with whom you wish to share it.