Genesys Cloud (formerly PureCloud)

Discussion Thread View

Handle errors/404 responses in Data Action triggered from Scripts?

  • 1.  Handle errors/404 responses in Data Action triggered from Scripts?

    Posted 11 days ago
    Edited by Joel Hellman 10 days ago
    I'm having issues calling a data action on page load inside a Screen Pop (/Script) using a Custom Action triggered by the Script's Page Load Action.

    The data action I'm using is a call back to the Genesys Cloud Rest API  that looks up a row in a data table based on the current agent's User ID /api/v2/flows/datatables/${input.dataTableId}/rows/${input.userEmail}?showbrief=false

    Issue one: Page Load Action trigger cannot be delayed until agent has accepted the interaciton
    When the data action returns a valid REST response (200 range etc) there are just minor issues:
    • 1 The Page Load Action is fired when the interaction is being alerted. For agents without Auto-Answer, that makes no sense for my operation, which should trigger after the agent has Accepted the interaction. Now the Custom Action is triggered as soon as interaction is alerted for these agents without Auto-Answer. 

    Issue two: No error handling in Scripts (Custom Actions), and
    issue three: repeated requests on 404 errors and spammy toaster popups

    But if webservice response in with the REST status code error ranges (i.e. a 404 when no row entry matched the id), there are big issues:
    • 2 The data action (or perhaps just the API request) triggers 6 times (seen from the dev. console logs) always returning 404 (correct response). Disregarding repeating requests, it makes no sense to retry on 404 as far as I can see. 
    • 3 This error propates to the agent as 6 separate toast pop ups with this format <Custom Action Name> : unknown error which spams the agent a totalt of around 25 seconds. 
    • 4 Nr 3 combines with nr 1, which makes it really messy when an interaction is alerted but not picked up. 

    Issue four: Agents needs to be granted the permissions integrations:action:view + integrations:action:execute
    This is an issue as these permissions also give agent the Admin interface and Integration link.
    • While they cannot access Integrations (assuming they don't have other roles), it doesn't make any sense they should get access to Admin and this link, to execute actions built into a Script that was created an administrator.
    • (I don't know if granting all agents these permissions have other internal security implications.)

    My main concerns are issue 2 and 3. I'd like to have some very basic error handling i Data Actions in Script, so I can prevent the spammy toasters from spamming my agents when it's not relevant. Atm, I cannot figure out how to use Data Action on Page load, it doesn't seem like a working design apart. I suppose we could build our own a REST based web service that always return responses within the error-free status code range to work around it but its not cheap for the simple use case of calling a data action.

    EDIT: I now realize the multiple-toaster issue relates to running Genesys Cloud session in multiple tabs (if you do and handle interactions, each tab acts independently, i.e. weird stuff happens). I also tested running a Data Action from Page Load Action instead of a Custom Action with a Data Action, but I still cannot handle the error or prevent the toast message.

    Not sure if these are bugs, per-design or what. Are any of you guys populating Script areas conditionally based on result of some API request - if so, how did you go about it?

    Joel Hellman