# New line character in painless

**URL:** <https://discuss.elastic.co/t/new-line-character-in-painless/271604>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting, painless\
**Created:** [April 29, 2021, 8:54am UTC](https://discuss.elastic.co/t/new-line-character-in-painless/271604 "2021-04-29T08:54:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lstoneir](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@lstoneir](https://discuss.elastic.co/u/lstoneir)\
**Post date:** [April 29, 2021, 8:54am UTC](https://discuss.elastic.co/t/new-line-character-in-painless/271604/1 "2021-04-29T08:54:54Z")

</div>

i want to send new line char to api using watcher

```auto
"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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 29, 2021, 11:48am UTC](https://discuss.elastic.co/t/new-line-character-in-painless/271604/2 "2021-04-29T11:48:38Z")

</div>

May be try this:

```auto
"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"}"""
      }
    }
  }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 27, 2021, 11:48am UTC](https://discuss.elastic.co/t/new-line-character-in-painless/271604/3 "2021-05-27T11:48:50Z")

</div>

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