Links not working when creating task with API

Hello,

Links not working when creating task with API.

Hi @Sunny_Techo,

We’ll need more detail than that to be able to provide any feedback or help.

How are you creating the link? What does one look like once you’ve created it? Exactly what happens - what is the result in your browser - when you click on it? Etc.

1 Like

Hello Phil,
Thanks for your response.

So, I’m sending link as a text without any anchor tag and It’s automatically created in links. Today, When I checked it’s seems links no longer automatically applied anchor tag on it.

Please see shared image.

screenshot-app.asana.com-2020.09.25-00_14_42

So, here more detailed description:
→ Creating task using API and sending all description information with html_notes.
Description include text and some tags but I’m sending link as a text without any anchor link on them.
→ In Asana, task created successfully and Initially, I’t converting text link into anchor tag link but when we observe today. It seems it’s not working that way.

To confirm this, when I tried to edit same task with my Asana mobile app. It’s seems to be working fine their means all link text will be converted into anchor tag link and they are clickable.

But, this is not working in browser.

I think what I would do is format your link tag as indicated here:

Yes, I got it but It’s automatically converted before and this a tag is introduced recently?

Make sure you’re not being caught by what I believe is a typo in the docs:


It was introduced on March 13 of this year:

This is really strange. It’s working for us till yesterday but suddenly stopped.

Hmm, afraid I’m stumped on that one then.

@Ross_Grambo you guys didn’t just change anything with rich-text link formatting, right?

Soooo something did change here and I’ll explain my understanding.

There was a change at the beginning of the year where the API stopped auto-formatted hyperlinks for you (the link @Phil_Seeman mentioned). This meant when you send https://example.com in html_notes we no longer automatically turn that into <a href="https://example.com">https://example.com</a>. I believe the reasoning was because html_notes is explicit and gives the dev the power to determine what should be linkify-ed and what shouldn’t (meaning if you pass https://example.com in notes, we will linkify it for you).

The yesterday part is that the team that handles how text is displayed in Asana the product, was auto-linkifying items on read still until yesterday. So developers didn’t see their integrations break back in March and are instead seeing it break now.

In summary: If you want auto-linkifying, you should use notes instead of html_notes, or explicitly declare the link inside of your html_notes.

2 Likes

Thanks Ross, for your explanation but it’s also affected task already created and not updated recently. Do you confirm it’s work like that?

So If I start using notes, do I rely on them or start adding link explicitly?

Also one more observation, when I tried to edit using mobile app then it’s working like before but not in browsers.

Any task created since we rolled out vanity links in March could have unlinkified notes (due to that API change). The web app was automatically adding <a> tags around www.example.com on read (but no longer does), and the mobile app continues to do that.

I would recommend sticking with html_notes but explicitly setting <a> tags around things you want linked. That way, if you want to use other features of html_notes in the future, you’re good to go.

2 Likes

Thanks Ross_Grambo,
I’ll make changes and unfortunately I’ve to stick with html_notes because we are using some other html tags too.
I believe that’s answer my question. So, I marked it as a solution.

Thanks for your response.
Have a good day and stay safe.

1 Like

Hi @Sunny_Techo ,
If you used vanity link in html notes could you please give the sample code. I tried below 2 formats and it says bad request through API. I am tring to add a link in descirption field of task in update scenario.
Format 1:
String httpBody = ‘{’ +
‘“data”: {’ +
‘“html_notes”: “Here”}}’;
Format 2:
String httpBody = ‘{’ +
‘“data”: {’ +
‘“html_notes”: “Here”}}’;
@Phil_Seeman @Ross_Grambo


sorry website turned them into links after I posted code. Attaching image instead. @Phil_Seeman @Sunny_Techo

Hi @Hema_Sri_Sankarneni,

There should be an error message also coming back with your error code, which might provide more clues as to the exact problem. What’s the text of the message it’s sending you?

1 Like

Hi @Phil_Seeman ,
body code:
String httpBody = ‘{’ +
‘“data”: {’ +
‘“html_notes”: “Here”}}’;


error message: {“errors”:[{“message”:“Could not parse request data, invalid JSON”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: Build an app with Asana”}]}

In postman, I tried with same html notes as above and update worked fine.


In the same body as above, if we add remove anchor tag and try to hit the api update worked fine.
String httpBody = ‘{’ +
‘“data”: {’ +
‘“html_notes”: “Test Test”}}’;

If it worked fine in Postman, then it’s not an API issue, must be something with the client code. Not sure what you’re using to do the programmatic access (one of the official libraries or rolling your own?) but I’m thinking perhaps there needs to be some escaping of some of the string elements?

Hi @Phil_Seeman , I am not sure this what you asked for but I added a remote site setting in salesforce and using the callouts to post into and retrieve from ASANA. I am using REST API(http).