husseinco | 2019-12-22 14:20:25 UTC | #1
Hi All,
I have a webhook end point that only accept POST method and whenever I try to pop up from script to open new tab in the browser I keep getting error, so is there any workaround to overcome this obstacle!
Thank you
Hussein
crespino | 2019-12-23 15:58:56 UTC | #2
Hussein,
Do you have a button in the script that is designed to open your URL in a new browser tab or window? To my knowledge, browsers only open URLs using an HTTP GET. If you want to use an HTTP POST then you'll most likely need some intermediate service in place that accepts the GET and redirects to the POST operation.
husseinco | 2019-12-23 17:16:07 UTC | #3
@crespino
There is no button as the popup is triggered once an interaction arrives to agent screen.
Is there any way to trigger a URL within the script in the background during an interaction?
Regards,
Hussein
crespino | 2019-12-23 20:06:26 UTC | #4
What is the use case you have around making the HTTP POST request? Are you actually trying to "pop" a page into a browser tab, or are you just trying to submit data to a web service?
If you are just trying to call a web service via HTTP POST then you can do so via a Data Action described here: https://help.mypurecloud.com/articles/available-script-actions/
husseinco | 2019-12-23 20:27:29 UTC | #5
@crespino
To be precise I'm trying to do both in same request in the sense, the the client wants to trigger a POST request once an interaction arrives to an agent and pass the email address for that particular agent in the request URL along with callerID, and as you know I can get the agent's email and callerID from within the built-in variables in scripter and append them into the request, but my issue now the end point only support POST method and I didn't find any workaround to overcome it.
Regards,
Hussein
crespino | 2019-12-23 22:43:33 UTC | #6
You should be able to define a Data Action in PureCloud Administration and then in the script you can invoke that Data Action to perform the HTTP POST with the variables that you need. Data Actions run in the background of a script, so you won't see any visual response from making the HTTP POST.
If you want to pop a web page, you would use the Open URL action within a script, but that will perform an HTTP GET the same as typing a URL into the address bar of a browser.
If you intention is to both call a post and pop a URL in the same action, then you'll most likely have to create some intermediate web site where you can use the Open URL action and pass the variables you need a query parameters. Within that web site you can use Javascript to either use AJAX to perform the HTTP POST, or fill out a hidden form and submit it. In the end you will end up with the POST being performed and a web site displayed.
I hope that helps.
Jason_Mathison | 2019-12-27 16:34:00 UTC | #7
Is it possible to do a data action to perform the POST, and then have the results of the POST be used to drive a GET in your script?
crespino | 2019-12-27 16:51:56 UTC | #8
Only if the POST returns a JSON object that contains a URL, then the data action could make that URL available to the script is a variable. You could then use that variable as the source for the Open URL request.
If your POST is the more traditional POST used during an HTML form submit, then I doubt you'd be able to get that to work because the POST wouldn't return data that is parsable by the Data Action.
Jason_Mathison | 2019-12-27 21:05:09 UTC | #9
True, the response would have to be in JSON format. If it was, you could slice and dice it to make a URL. If the response is HTML then you are absolutely correct, Data Actions aren't going to be able to help solve this.
system | 2020-01-27 21:05:10 UTC | #10
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 6793