When creating Web Service Data Actions (and their dependent flows) in Genesys I spent a lot of time debugging problems around these Data Actions - the main culprit being input values that resulted in unexpected responses from a downstream API, breaking contracts/mappings. The following is how I sped up diagnosing problems by spying on the interaction between my Web Service Data Actions and downstream APIs.
WARNING: The tool used below should never be used to spy on Data Actions that are used by real customers. It terminates after a fixed period of time, has limited bandwidth and may leak secrets.
We will intercept a Data Action’s requests by configuring the Data Action to point at a tunnel created by a tool called ngrok. This tunnel will forward requests to the Data Action’s original URL, and importantly will allow us to inspect any request that passes through it.
Creating the tunnel will require ngrok to be installed locally by following the steps:
- Follow the official instructions to install ngrok
- Sign up for a free account. You’ll need this to be able to configure the proxy
- Configure ngrok with an auth token from the account you setup above
Creating a tunnel
Create the tunnel by running the following command, configured with the host from the Data Action’s URL
ngrok http -host-header=<host> <host>:<port>
-host-header=<host>- Set the host-header switch to the host of the Data Action’s current URL
<host>:<port>- Set this to the host and port of the Data Action’s current URL
If the data Data Action’s URL is
Then the command will be:
ngrok http -host-header=example.com example.com:443
Port 443 = HTTPS
Configuring the Data Action
When you run the ngrok command in the previous step you’ll be presented with the output below. Contained within this output is the randomly generated forwarding address. We will configure our Data Action to use this URL.
ngrok by @inconshreveable (Ctrl+C to quit) Session Status online Account firstname.lastname@example.org (Plan: Free) Version 2.3.35 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding https://12abc-12abc-12abc.ngrok.io -> https://example.com:443 Connections ttl opn rt1 rt5 p50 p90 0 0 0.00 0.00 0.00 0.00
Update the Data Action’s URL
- Take the forwarding address from output, which in the example above is:
2. Update the Request URL Template in the Data Action to use the forwarding address:
Now ngrok is running and your Data Action is pointing at ngroks’ forwarding address (aka tunnel) you can inspect HTTP(S) traffic going through it.
Navigate to http://127.0.0.1:4040/inspect/http to see the traffic, or follow the official guide.
When you close ngrok it will also close the tunnel (which is unique each time), so you’ll have to revert your Data Action’s URL after inspecting the traffic.
This article on troubleshooting Genesys Web Service Data Actions was originally written for my personal blog, where I'll be writing more articles of this nature. If you have any suggestions on how I can improve it, or my writing then please let me know @SketchingDev, or leave a comment.