Tweet with a link

Jan 24, 2014 at 1:24 PM
What's the best way to post a tweet with a link? I see the UrlEntity class but every time I try and add it to a new Tweet on the Urls or Entities.Urls object, they are always null.

Thanks!
Coordinator
Jan 24, 2014 at 2:19 PM
Edited Jan 24, 2014 at 2:19 PM
Hi,

The answer is you don't :)
UrlEntities are object that you get not that you set. Basically when you wish to send a tweet with a link you just put the link as a plain text.
Twitter will automatically detect that it is a link and transform it.
var tweet = new Tweet("Check this link : https://tweetinvi.codeplex.com");
Regards,
Linvi
Marked as answer by linvi on 1/27/2014 at 6:00 AM
Jan 24, 2014 at 2:20 PM
Thanks for the quick reply. I had a feeling it was just something that was provided by twitter.

Should I modify the length of the tweet to accommodate a link or will Twitter handle that for me?
Coordinator
Jan 24, 2014 at 2:44 PM
Twitter will do it automatically for you.

As a result when publishing a Tweet with a link please use the Tweet.Length property to verify that the length is valid.
Tweetinvi calculates the length of the tweet message based on the algorithm Twitter uses.
For example Twitter would not resize www.google.com but resizes other links.

Linvi
Marked as answer by linvi on 1/27/2014 at 6:00 AM
Jan 24, 2014 at 3:29 PM
Thank you for everything! Tweetinvi is working great now.