Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Open Messaging - Best way to get the Agent Name

    Posted 03-17-2025 15:21
    Edited by Matt Lawson 03-24-2025 14:06

    Welcome to the new Home all.

    I'm going to use this opportunity to ask a question and I'm looking for possible solutions with the least amount of API calls required to achieve the goal.

    The Issue at hand. The customer built an Open Messaging Middleware application, everything is perfect, the only setback currently is not having the Agent name available to the Middleware via Open Messaging events/responses etc. See: ideas/OTB-I-578

    Now the question part. What would be the simplest API call "cost" effective way using Trigger/Workflow/Data Action to on "event answer".

    The Best event to trigger on seems to be, v2.detail.events.conversation.{id}.acd.end, since user.start did not seem to trigger. (EDIT: Based on below solution, its because I did not have Flow.userId mapped as input variable, no workflow start)
    I then created a Data action to get the participant Ids for the Purpose=Agent participants.
    In the workflow I can then isolate the current agent on the conversation as the last in array participant Id returned, then I can use that on Get Participant Data and define the Participant Id Data to return.

    And this is where I am stuck now.

    How do I access the said Participant Id Data in Architect (Feels like a i cant believe i missed that question)
    Then, if anyone has dealt with this use case before, any insight suggestions or solutions is currently welcome :)

    Thank you, and Wishing this new chapter a health collaborative future.


    #Integrations

    ------------------------------
    Dewald Smit
    Systems Consultant (CX Engineer)
    ------------------------------



  • 2.  RE: Open Messaging - Best way to get the Agent Name

    Posted 03-17-2025 16:17

    Not sure about the best way to do it,

    But from the purpose=agent participant get the userId instead of the Participant Id, or the session.selectedAgentId.

    From there you should be away, in architect you can find agent by id, with the action or expression, and once you have the agent object you can access the name id or username, eg State.UserExample.id State.UserExample.name State.UserExample.username



    ------------------------------
    Anton Vroon
    ------------------------------



  • 3.  RE: Open Messaging - Best way to get the Agent Name
    Best Answer

    Posted 03-17-2025 17:45

    Thanks Anton, I have just found, i think the best way.
    Trigger: 


    Then on the workflow I added Flow.userId as Input. This then passed the userId into the flow and I could user Find User by ID to get the name.
    Then Split the name on "space" to get only the first name as array item 0.
    And this solution did not require any extra Genesys API. :) 

    The final part of the solution is to have a custom data action that sends a post request to the Middle layer Web hook, as an "event"/text message.

    We used the same workflow trick to send an agent disconnect event to the middleware, just did not need the userId for that trigger :/

    Hope this helps someone else.


    ------------------------------
    Dewald Smit
    Systems Consultant (CX Engineer)
    ------------------------------



  • 4.  RE: Open Messaging - Best way to get the Agent Name

    Posted 03-18-2025 09:34

    Hi Dewalt.  That is exactly the way to do it.  In fact if you setup a trigger on user.start and user.end then you can call your webhook to notify when the agent joins the interaction and when they leave.  Those messages won't be logged in the messaging transcript, but the customer will at least receive those notifications.



    ------------------------------
    Jim Crespino
    Senior Director, Developer Evangelism
    Genesys
    https://developer.genesys.com
    ------------------------------