New line character in painless

i want to send new line char to api using watcher

"actions": {
    "sms": {
      "webhook": {
        "scheme": "https",
        "host": "127.0.0.1",
        "port": 80,
        "method": "post",
        "path": "/api/es/sms",
        "params": {},
        "headers": {
          "Content-Type": "application/json"
        },
        "body": """{"phones":["077452236958"], "message": "ctx.payload.server: \n ctx.error"}"""
      }
    }
  }

but \n gives me error and cant save watcher.
please help

May be try this:

"actions": {
    "sms": {
      "webhook": {
        "scheme": "https",
        "host": "127.0.0.1",
        "port": 80,
        "method": "post",
        "path": "/api/es/sms",
        "params": {},
        "headers": {
          "Content-Type": "application/json"
        },
        "body": """{"phones":["077452236958"], "message": "ctx.payload.server: \\n ctx.error"}"""
      }
    }
  }
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.