How to add Line Breaks to Webhook

Hello, (hopefully) my request is simple?

I’m using tags to send custom messages.

I want this: (all tags on one line)
{date_mdy} {Request:8} {Message:13}

To look like this: (all tags on separate lines)
{date_mdy}
{Request:8}
{Message:13}

If I add HTML, that code shows as HTML in the message…
Is there another method?

Help please and thank you.

Hi Matthew. You have two options. If you are in the Visual mode of the notification editor, typing in line breaks after each line will result in a line break (WordPress/Gravity Forms will convert the line breaks to actual HTML) so long as you DO NOT click the “Disable auto-formatting” checkbox. It’s this auto-formatting that will convert your carriage returns into actual HTML <br /> tags.

Or, if you are in the Text mode of the editor, you can add your own HTML markup there, like line breaks and paragraphs. You have to be in Text mode to add your own HTML. In visual mode, you will see the HTML in your notification: it won’t be HTML used for formatting.

If you have any other questions, please let us know.

1 Like

Thank you, Chris,

I should have included a screenshot (my bad!)

Here is the Webhooks view of the form:

  • You’ll see we are compiling select fields from the form.
  • Ideally, I’d like to have each value on a separate line.
  • We are currently sending {all-fields} to the client / customer
  • We are also sending this info to a CRM in which we’d like to have each value on a separate line.
  • Is there a quick and easy way to do this from this view?

Thank you

Hi Matthew. Your initial question was about notifications. The new screenshots are about Webhooks. Is this a new question altogether? I’m confused now …

My apologies Chris,

  • I wasn’t very clear the first time around.
  • I’m using Webhooks to write to a CRM
  • As the 2nd screenshot will show, I’m using TAGS to populate a ‘notes’ field within the CRM
  • Ideally, I’d like to break these into individual lines for each TAG
  • As it stands, the tags are all written in a continuous string.

Thank you :sunglasses:

Hi Matthew. You can add a carriage return or a line break in your JSON by adding \r or \n or maybe even \r\n. On the webhooks feed though, if you enter a backslash, it will be further escaped, and you would send this instead of \r\n:

`\r\n’

To avoid that, rather than mapping the individual merge tags to one key in the webhooks feed, you can use the gform_webhooks_request_data filter:

With that, you can combine all your fields into one string, with your line breaks and carriage results and encode the new lines as \r or \n. Then, it is up to your CRM to convert that \r or \n to a new line to store all the items as individual lines. If you have any other questions on implementation, please let us know.

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