Line breaks, empty lines, and <br/> tags in html_notes rich text?

We are using Zapier to create new tasks in Asana. Using Zapier own “Create task” action, we have been adding rich text to the task description for a while now. This rich text included
tags to force line breaks in certain areas. However, it seems this all of a sudden stopped working last night, and is causing an XML error.

In particular it’s getting a 400 response.

{
  "errors": [{
    "error": "xml_parsing_error",
    "message": "XML is invalid",
    "help": "For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"
  }]
}

As soon as I remove the
it works fine.

Here is what Zapier’s logs showed: https://i.imgur.com/2IO4lCI.png

So, has anything changed within the last day regarding the rich text? I see the documentation doesn’t mention
anywhere: Rich text

But how else can we create multiple line breaks then? The HTML characters don’t seem to do anything within the Zapier Asana “description” field, since it’s apparently XML. It just outputs them as text when it gets sent to Asana (rather than making them line breaks):

  • \u200b
  • \n\u200b\n
  • \n\n
  • \n

Asana is rolling out a new format of rich text, perhaps it just hit your account yesterday?

We’ve had that functionality in our Asana account for a month now. But maybe, somehow Zapier has just become affected? Either way, I don’t see how to create an empty line break currently with Zapier’s integration then. :frowning:

hey @FreshyJon, there has been a rollout of new behavior for html_notes, and it seems like the Zapier integration has finally been included in the rollout. The <br/> tag is no longer supported, so removing that should fix this up. Instead, you should use a \n\n. However, stay tuned as we’ll be refining this behavior shortly due.

Thanks for the info. Unfortunately typing \n\n into their description box in Zapier just renders it as \n\n rather than it outputting a line break.

1 Like

Did you find a solution to this @FreshyJon ? Not seeing anything related to line breaks in the Rich text article.

Line break is \n

If it’s not working right in Zapier per @FreshyJon, perhaps it’s a Zapier issue?

Thanks, @Phil_Seeman ! I’m quite new to string manipulation so thank you for your responses as I’m sure this is quite elementary.

I’m using the Update a task reference to test this out before going back into Zapier.

I’m starting with a source field that starts like this:

Single Line
Line after soft return

Line after paragraph

I’m encoding into this format for the html_notes field:

<body>Single Line\\nLine after soft return\\n\\nLine after paragraph</body>

Which results in the CURL Request:

"html_notes": "<body>Single Line\\nLine after soft return\\n\\nLine after paragraph</body>"

And I’m getting a successful response:

"notes": "Single Line\\nLine after soft return\\n\\nLine after paragraph",

But it’s resulting in this:
Screenshot 2023-08-03 at 2.00.54 PM

Hmmm, you shouldn’t need the double backslash - what happens if it’s just \n and not \n ?

Hey @Adam_Ennis ,
In case it helps any, I was able to add a new line to text in the Zapier ‘Create Task’ Description field by pasting in a Zero-Width Space unicode character that I copied to my clipboard.
(Copied from here: ​ U+200B ZERO WIDTH SPACE - Unicode Explorer)

Thanks @KMcMorrow. @Phil_Seeman was quite right. I had been using the updatetask API reference to try out various code updates, but the \n was being interpreted in my sync tests as two literal characters: "\n"

However, I went and ahead and just coded the JSON in the Zapier Webhooks Integration and it worked flawlessly. Relied too much on the dev test rather than just go for it.

I will keep that ZWS in my back pocket for the future, tho! Thank you!

1 Like

The issue you’re encountering with the <br> tags causing XML parsing errors in Zapier’s “Create Task” action for Asana likely stems from a recent update or stricter XML validation in the Asana API. Since the documentation doesn’t explicitly support HTML tags in descriptions, a different approach is needed for line breaks.

Solution: Use Markdown for Line Breaks

Asana supports Markdown for formatting task descriptions. To create multiple line breaks, you can use double spaces followed by a newline (\n) to insert a line break in Markdown. Here’s how you can structure the text in your Zapier action:

  1. Single Line Break: Use two spaces followed by \n
  2. Multiple Line Breaks: Repeat the two spaces followed by \n as needed

Example

Instead of using <br>, format your description like this:

Line one with some text  
Line two with a line break after the first line  

Line three with two line breaks above

In your Zapier setup, the description field should look like:

Line one with some text \nLine two with a line break after the first line \n\nLine three with two line breaks above


Steps to Update Your Zap

1. Edit the Zap: Open your Zap that creates the Asana task.
2. Modify the Description Field: Replace any `<br>` tags with the appropriate Markdown syntax for line breaks as shown above.
3. Test the Zap: Run a test to ensure the description appears correctly formatted in Asana.

By using Markdown for line breaks, you should avoid the XML parsing error and have your task descriptions formatted correctly in Asana.

Still no luck here. For a while, Zapier’s “Create task” action was allowing real HTML to be able to use <body> tags and actual <strong>, <hr>, and <h1> tags to output HTML descriptions.

But now that action is using a “Legacy” version of the Asana integration. The newer version of the Zapier Asana integration once again requires XML via markdown syntax for “rich text”. But I can’t figure out how to get line breaks to work there.