Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  get wrap-up code from historical conversation

    Posted 03-21-2023 16:51

    Dears

    I hope you are doing well,

    I'm trying to invoke Genesys API inside Genesys, but I failed, as I followed the below steps:

    1- create client ID auth
    2- Install genesys integration and insert the secret with its ID
    3- call Data action

    after all of this its didn't work as its show me the following error "Response from web service: {"message":"This request requires a user context. Client credentials cannot be used for requests to this resource.","code":"not.a.user","status":400,"contextId":"591ebe54-fb12-477e-86e4-c6f55d942aed","details":[],"errors":[]} [d34c4ed1-82d7-47a3-b425-7df4923d6839]"

    However I'm trying to invoke "/api/v2/analytics/conversations/{conversationId}/details" to bring up the wrap-up code ID, could anyone give me a hand in this and show me a clear steps as this first time for me trying to do this


    #Reporting/Analytics

    ------------------------------
    Mohannad haddad
    Fourth Dimension Systems LLC
    ------------------------------


  • 2.  RE: get wrap-up code from historical conversation

    Posted 03-22-2023 16:31

    Hi,

    Is it failing when you test Data Action or its failing when you call the Data Action within Architect flow? Can you share screenshot of DA config (remove any sensitive info)

    Cheers



    ------------------------------
    Muhammad Zubair Awan
    ------------------------------



  • 3.  RE: get wrap-up code from historical conversation

    Posted 03-24-2023 06:19

    Dear @Muhammad Zubair 

    thank you for your response, Kindly note that I'm struggling to get the "participants.wrapup.code" as I designed datat action to retrieve it with no use

    Kindly find the configuration that I did

     



    ------------------------------
    Mohannad haddad
    Fourth Dimension Systems LLC
    ------------------------------



  • 4.  RE: get wrap-up code from historical conversation

    Posted 03-24-2023 09:35

    Mohannad,

    I'm curious as to your use-case? Data Actions (in my experience!) are usually used when an interaction is in progress (either from Architect or a Script) and since a Wrap-Up code isn't specified until the interaction ends, I'm curious as to why / when you would need to do this?

    I'm not defending Genesys's decision to make this endpoint require a User Context, but is we have a bit more of the background, we may be able to offer an alternate solution.



    ------------------------------
    Paul Simpson
    Eventus Solutions Group
    ------------------------------



  • 5.  RE: get wrap-up code from historical conversation

    Posted 03-24-2023 17:10
    Edited by Muhammad Zubair Awan 03-24-2023 17:22

    Hi Mohannad

    To help test your data action against a completed interaction (as per subject of your post), here is what I suggest.

    First use /api/v2/conversations/calls/{conversationId} instead of /api/v2/analytics/conversations/{conversationId}/details api to extract the wrapup to simplify your data action. 

    Second, execute /api/v2/conversations/calls/{conversationId} in API Explorer against a sample Interaction ID and make sure wrapup code is assigned against a participant, usually the agent. 

    Now that you are using "id" as input contract in your data action, under Configuration > Request URL Template use /api/v2/conversations/calls/${input.id} and leave the response configuration to default. 

    Under Output Contract, switch to JSON and copy below code

    {
      "type": "object",
      "properties": {
        "participants": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "wrapup": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    }

    Now test your data action against same Interaction ID you used earlier in API Explorer. 

    Design Considerations:

    • As there are multiple participants involved in an interaction, expect to receive some empty elements in the response array.
    • You might as well get more than one wrapup codes if there are multiple agents involved.

    I hope this helps.

    Cheers
    Zubair



    ------------------------------
    Muhammad Zubair Awan
    ------------------------------



  • 6.  RE: get wrap-up code from historical conversation

    Posted 03-23-2023 11:58

    Unfortunately, not all API endpoints can be accessed from a Client Credentials oAuth session. Some require you to be making the request as a user (which Data Actions cannot do.)

    For example, obtaining a list of "My Interactions" requires the system to know who "you" are!

    The error you are receiving is because you are attempting to access one of those endpoints.

    I recommend posting over on the Developer forums, explain what you are trying to achieve and they should be able to help.



    ------------------------------
    Paul Simpson
    Eventus Solutions Group
    ------------------------------



  • 7.  RE: get wrap-up code from historical conversation

    Posted 03-23-2023 16:05

    While I agree client credentials cannot be used for some APIs, curious to understand why this API /api/v2/analytics/conversations/{conversationId}/details is expecting user context. it works for me both in DA as well as in Postman so there might be an element of user error.

    Cheers



    ------------------------------
    Muhammad Zubair Awan
    ------------------------------



  • 8.  RE: get wrap-up code from historical conversation

    Posted 03-23-2023 18:22

    I cannot comment as to the exact reason this endpoint requires a user context, but should point out that when using the Developer Tools, or Postman, you are typically accessing with an Implicit Grant oAuth, which is a User context.

    I strongly recommend heading over to the Developer forums. There are a number of experienced developers (many of whom work for Genesys) who frequent them and who will probably be able to answer your question as well as provide a possible work around.

    HTH



    ------------------------------
    Paul Simpson
    Eventus Solutions Group
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources