Using API and Rich Text to generate bold font in description

Hello :smiley:

Could someone help me on this :wink:. I’m trying to import Jira XML file to Asana.

I wanted to use bold font for the imported title, and Asana Developer Rich Text rule suggested me to use tag, and I did like this:

            if (titleTags.includes(key)) {
                // Bold the title
                key = `<strong>[${key.toUpperCase()}]</strong>`;
                contentSections[key] = value;
            } else if (key === 'customfields') {

However, the imported text showed tag text directly instead of bold text

Hi @杜宇1 ,

It looks like you are trying to add rich text to a task description. To do that you’ll want to send the rich text request in the html_notes property of your request body.

Here’s a sample request of updating a task description to include rich text in cURL:

curl --location --request PUT '<YOUR_TASK_GID>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--data '{
  "data": {
    "html_notes": "<body><strong>Title 1</strong>\n\n<strong>Title 2</strong></body>"

Example result:

TIP for working with our Rich Text:

Let’s say you want to make your text look a certain way and do not know which tags to use in your rich text. You can play around with the styling the text in Asana and then make a GET request to see what tags was used and copy that style in your POST or PUT /tasks request.

  1. Edit the description in Asana with the style that you want (EX: bold a text)
  2. Make a request to get that task (Get a task) and specify that you want the html_notes property back in the response by specifying it in the opt_fields query param.
  3. Copy the result from html_notes in the response to your Create a task or Update a task API call


Thank you John, you are a genius!!! Really appreciate it!!!

When I noticed it should be wrapped in it worked!!! :partying_face: :partying_face:

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