Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Trying to use data action to create record in inbound message flow

    Posted 09-02-2025 12:13

    I want to configure a digital flow that will be use in my messenger. The digital bot will first ask cx his prefer language between English and Arabic. If the choice is English, the bot should greet cx in English. otherwise he should write the greeting in Arabic. Regardless of the choice, the next question is to ask cx if he is new or existing customer (do this for both English and Arabic). If cx pick existing, use the necessary action to collect cx response and compare it with what we have in the database. Note: we want to use cx email to verify if he is an existing cx. if the email not found in our database, tell cx no record found and prompt him to provide hie email, and fullname so that we can store it as new customer. If cx pick option of new customer, prompt him to provide is email and fullname so as to store them in our table. use necessary action , including expression at every point in time. I use data table to store information



    Try to test my data action:

    i got this error when run the test:

    {
      "message": "Bad Request",
      "code": "bad.request",
      "status": 400,
      "messageParams": {},
      "contextId": "61651ce2-60b6-44f9-a877-92497d60429c",
      "details": [
        {
          "errorCode": "ACTION.PROCESSING"
        }
      ],
      "errors": [
        {
          "message": "Failed due to malformed requestUrlTemplate. Illegal character in path at index 52: https://api.mec1.pure.cloud/api/v2/flows/datatables/{datatableId}/rows",
          "code": "BAD_REQUEST",
          "status": 400,
          "messageParams": {},
          "details": [],
          "errors": []
        }
      ]
    }

    #Architect
    #Integrations
    #PlatformAPI

    ------------------------------
    Teslim Oyedotun
    ------------------------------


  • 2.  RE: Trying to use data action to create record in inbound message flow

    Posted 09-03-2025 09:34

    In the URL template the datatableId should be something like ${input.dataTableId} or whatever the name of the input variable is.



    ------------------------------
    --Jason
    ------------------------------



  • 3.  RE: Trying to use data action to create record in inbound message flow

    Posted 09-03-2025 09:46

    thanks @Jason Mathison.
    corrected it but now faced with execution error:

    {
      "message": "Bad Request",
      "code": "bad.request",
      "status": 400,
      "messageParams": {},
      "contextId": "3926f966-a368-4771-a18e-9293add6aa02",
      "details": [
        {
          "errorCode": "ACTION.REMOTE_ENDPOINT"
        }
      ],
      "errors": [
        {
          "message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service:  [3926f966-a368-4771-a18e-9293add6aa02]",
          "code": "BAD_REQUEST",
          "status": 400,
          "messageParams": {},
          "details": [],
          "errors": []
        }
      ]
    }


    ------------------------------
    Teslim Oyedotun
    ------------------------------



  • 4.  RE: Trying to use data action to create record in inbound message flow

    Posted 09-03-2025 10:05

    I would suggest that you expand the "Resolve request URL template" and "Resolve request body template" operations in test mode and make sure that everything looks correct. 



    ------------------------------
    --Jason
    ------------------------------



  • 5.  RE: Trying to use data action to create record in inbound message flow

    Posted 09-04-2025 08:27

    Hello Teslim,

    I believe your Request Body Template is formed incorrectly,

    If you are using the POST on that endpoint to create a new datatable row then according to the documentation it "should be a json-ized' stream of key -> value pairs { "Field1": "XYZZY", "Field2": false, "KEY": "27272" }"

    So instead of having what i saw in the screenshot you should have something like this:
     
    {
      "key": "${input.email}",
      "name": "${input.name}"
    }

    I believe the UI on the API explorer may be a little buggy on this.



    ------------------------------
    Michael McEwen
    Application Developer
    ------------------------------



  • 6.  RE: Trying to use data action to create record in inbound message flow

    Posted 09-04-2025 17:17

    @micheal thanks for your suggestion. they were very insightful.  I was able to resolve the issue by using the below in request template body:
    this work for post:
    {
      "KEY": "$esc.jsonString($input.key)", 
      "Name": "$esc.jsonString($input.Name)" 
    }



    ------------------------------
    Teslim Oyedotun
    ------------------------------