Genesys Cloud - Main

 View Only

Sign Up

  • 1.  Agentless Email API fails to send a body with expression variable

    Posted 11-22-2025 18:28

    Hello,

    I am using a data action to send an agentless email using the agentless email api.

    The data action fails when I use a variable expression for my email body. The data action is successful when I use a variable literal for my email body.

    See the screen shot.

    My goal is to send an email with line break characters.

    Variable Task.test_email_body_expression is defined as expression "hello" + " \n " + "world".

    The email fails when I use this variable for the email body.

    Variable Task.test_email_body_literal is defined as literal hello \n world.

    The email is successful when I use this variable for the email body.

    Any suggestions how to solve this?

    thanks,

    David


    #API/Integrations
    #ArchitectandDesign
    #Outbound

    ------------------------------
    David Martinez
    Architect
    ------------------------------


  • 2.  RE: Agentless Email API fails to send a body with expression variable
    Best Answer

    Posted 11-22-2025 23:29

    Well, after more research I solved this. I had two use two slashes.

    This works.

          append("hello ", " \\n ", "world")

    David



    ------------------------------
    David Martinez
    Architect
    ------------------------------



  • 3.  RE: Agentless Email API fails to send a body with expression variable

    Posted 11-23-2025 21:28

    Yes, anytime you try to use special characters, you usually need to prefix with the \.  You can find more about this here: https://help.mypurecloud.com/articles/use-string-literals-expressions/



    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 4.  RE: Agentless Email API fails to send a body with expression variable

    Posted 11-24-2025 06:30

    You can use $esc.jsonString() in your Data Action to add escape characters where needed on input variables.

    https://help.mypurecloud.com/articles/velocity-macros-data-actions/



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------