02-22-2016 07:27 AM
I need to create a workflow to consume a REST resource. JSON specifically as the body. My REST service requires a static authentication header in normal base64 encoding, however, I don't see the availability to add to the header in the Finesse workflow configuration. Is this possible? If so how?
Solved! Go to Solution.
03-07-2016 02:43 PM
Hi,
If the "Location" is set to "Other" as you have shown your previous post, an authentication modal will appear when the workflow gets triggered:
The user will have to enter the authentication. If the authentication is correct, the HTTP request will be executed. If the authentication is not correct, the authentication modal will reappear, giving the user another chance to enter the correct credentials (an infinite amount of times). If the "Cancel" button is pushed, the HTTP request will not be executed.
Just for information, if the "Location" is set to "Finesse", the logged in Finesse user's credentials will be used for authentication.
Thanx,
Denise
02-22-2016 11:41 AM
The first question, is are you calling your service from a Finesse custom gadget?
Because of issues with CORS and cross site scripting security issues, you should use
gadgets.io.makeRequest
02-22-2016 11:56 AM
I was just doing a HTTP Request from the Finesse Workflow administrator. Not a gadget.
I need the authenticationType header described here https://developer.cisco.com/media/finesseDevGuide2/CFIN_RF_W47F8918_00_workflowaction-api-parameters.html
02-24-2016 08:27 AM
The type is Basic.
Here is an example of setting up a screen pop workflow...
03-07-2016 07:48 AM
I understand and want BASIC, however even if I turn on the authorization field (UCCX). I get no Authorization header in the request.
03-07-2016 02:43 PM
Hi,
If the "Location" is set to "Other" as you have shown your previous post, an authentication modal will appear when the workflow gets triggered:
The user will have to enter the authentication. If the authentication is correct, the HTTP request will be executed. If the authentication is not correct, the authentication modal will reappear, giving the user another chance to enter the correct credentials (an infinite amount of times). If the "Cancel" button is pushed, the HTTP request will not be executed.
Just for information, if the "Location" is set to "Finesse", the logged in Finesse user's credentials will be used for authentication.
Thanx,
Denise
06-25-2019 07:14 AM
I have got the location set to "other" but do not get the Authentication Modal screen. I'm using Finesse 11.5 with UCCE.
TBH this is no use to my customer as I need the authentication to happen in the background. Has anybody created a custom gadget where I can hard code the authentication credentials?
06-25-2019 09:12 AM
06-25-2019 11:38 AM
Hi Boyd,
Gerry is correct that it was a bug.
If you are looking for a sample on how to do a REST request with Authentication, the closest will be the ExternalRestApiSampleGadget:https://github.com/CiscoDevNet/finesse-sample-code/tree/master/ExternalRestApiSampleGadget
It doesn't actually have it done, but you can easily modify the code:
params[gadgets.io.RequestParameters.HEADERS].Authorization = options.authorization;
Another sample gadget to look at is the WorkflowScreenPopSampleGadget: https://github.com/CiscoDevNet/finesse-sample-code/tree/master/WorkflowScreenPopSampleGadget which allows you to change the workflow to "handle by: Other" and have the gadget handle it for you. This way you can still utilize the ease of the workflow, but be able to execute it with the custom gadget.
Thanx,
Denise
06-26-2019 06:48 AM
Thanks Denise and Gerry,
I will have a look at the sample code and see if I can work out what to do.
Best Regards
Boyd
06-27-2019 12:12 PM
Hi Denise,
Can you please tell me how I would access the User Object from within handleNewDialog = function(dialog) function.
I need the User.loginName for the contentBody as that is one of the values I want to POST to our API.
Best Regards
Boyd
06-27-2019 12:46 PM
Hi,
If you used one of the sample gadgets, you should have the user object that was created in the init function. But, loginName isn't a method that was exposed via the JavaScript API. You can get the agentId via user.getId. If you want the login name, you have to get it from the data itself. So you have to do user.getData, then parse the object for the loginName.
init : function () {
...
user = new finesse.restservices.User({
id: cfg.id,
onLoad : handleUserLoad,
onChange : handleUserChange
});
}
Thanx,
Denise
06-28-2019 08:53 AM
06-28-2019 11:29 AM
Hi,
I don't have a working system to test that right now, but if I said it in another post, I'm going to guess that I had tested it at that time. That looks right though.
Thanx,
Denise
07-02-2019 06:08 AM
Hi Denise,
I managed to test it today and the code to get the agent's loginName works perfectly. Thanks for your help.
Unfortunately I don't appear to be able to connect to the our API server as shown below.
ExternalRESTAPISampleGadget : handleResponse(): The response status code is: 500
I think that this may be due to an invalid certificate as I had the same problem with Postman until I copied the certificate to my Trusted Root Certification Authorities. I have uploaded the certificate to Finesse but will need to start Tomcat OOHs.
As time is of the essence Is there anyway that I can tell the 3rd party gadget to ignore the certificate like we can do in Call Studio. Also are there any other attributes in the response object below that will give us a text description of the error 500
handleResponse = function(handlers) {
return function (response) {
clientLogs.log("handleResponse(): The response status code is: " + response.rc);
FYI
When I call the same API from a Workflow I get
<div id=\"content-header\">HTTP Status 500 - javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated </div> <p> <b> type: </b> Status report </p> <p> <b>message: </b> javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated </p> <p> <b>description: </b> The server encountered an internal error that prevented it from fulfilling this request.
Best Regards
Boyd
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide