Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

Trying to send custom Attributes into Architect flow using WebSocket connection to a Web Messaging Deploymeny, but failing

  • 1.  Trying to send custom Attributes into Architect flow using WebSocket connection to a Web Messaging Deploymeny, but failing

    Posted 06-23-2025 09:49
      |   view attached

    I am using a Python Script which sets up a WebSocket connection to our Genesys Chat deployment (ID 9088096f-90e4-44e9-a9ee-73d7702bd18c, NAME = HelpDesk MS Team Copilot integration) using curl commands. I am trying to send a name attribute from the script into a Genesys Architect Inbound Message Flow so we can set the name of the participant to the Genesys Agent who answers the call. I have tried multiple methods, but none seem to be working (Mainly a "Database.set" action). 

    I will include the script (within app.zip) that I am using for this, and here are the commands that I use to run it with how I am testing (using Windows):
    To start application:
    Set USE_REDIS=0
    python app.py
     
    In a seperate window:
    • To start a chat: curl -X POST "http://localhost:8000/chat/start" -H "Content-Type: application/json" -d "{\"userName\":\"John Doe\",\"userEmail\":\"john@example.com\",\"conversationId\":\"test123\"}"
    • To send a message: curl -X POST "http://localhost:8000/chat/message" -H "Content-Type: application/json" -d "{\"conversationId\":\"test123\",\"message\":\"Hello, world!\"}"
    But when I run, I keep getting an error 400 code with message "Request with action Database.set is invalid" and "Request with action subscribe is invalid." when I try to subscribe to the plugin based off of this site here which describes the Database plugin, but it only shows how to do it in JavaScript so I am adapting it to Python: https://developer.genesys.cloud/commdigital/digital/webmessaging/messengersdk/SDKCommandsEvents/databasePlugin?

    This is how I am trying to send the payload for Database.set. Is there an actual Python method to do this that isn't mentioned?

    db_set_payload = {

    "action": "Database.set",

    "token": self.token,

    "messaging": {

        "customAttributes": {

            "userName": self.user_name,

            "userEmail": self.user_email

            }

        }

    }

    logger.info(f"Sending Database.set payload: {db_set_payload}")

    await self.ws.send(json.dumps(db_set_payload))

    (I am waiting for the sessionResponse to arrive first as well)

    My end goal is to have a way to get the name "John Doe" (or whatever name I set in the command) to eventually end up in my inbound message flow as a variable (likely through participant datat) so I can set the Participant Data variable "name" so that when I answer the message in the queue in Genesys, the name shown is not "Participant" but "John Doe". If someone knows how I would be able to accomplish this, that would be great:


    #PlatformSDK
    #WebMessaging

    ------------------------------
    Brian Steuerman
    ------------------------------

    Attachment(s)

    zip
    app.zip   4 KB 1 version


  • 2.  RE: Trying to send custom Attributes into Architect flow using WebSocket connection to a Web Messaging Deploymeny, but failing

    Posted 06-26-2025 16:09

    Hey Brian, unfortunately the Messenger SDK is in javascript and will not work with python or other languages. 

    If you wish to have the customer/provided name appear in the roster and conversation areas, the custom attribute "name" could be used, but the most correct approach would be to take the attribute and match to an existing External Contact (or create new). These areas are designed to display the customer name based on the contact record.

    Hope this helps,



    ------------------------------
    Chad Hansen
    Product Manager
    Genesys - Employees
    ------------------------------