Web Link

One or more URLs can be put in a message. All links generate tracked links, an URL image preview, and much more (see JSON response below).

Example: Here how to post text message with an URL

String message = "This is a web link shared with all https://blog.algolia.com/supporting-open-source-projects";

FeedPost feedPost = new FeedPost.Builder()
  .setMessage(message)
  .setVisibility(AccessControl.PUBLIC)
  .build();

Feed createdFeed = session.getNewsFeed().blockingCreate(feedPost);
List<URLTag> urlTags = createdFeed.getBodyMessageTagEntities().getUrlTags();

for (URLTag urlTag : urlTags) {
  System.out.println(urlTag.getTitle());
}
let message = "This is a web link shared with all https://blog.algolia.com/supporting-open-source-projects"

let feedPost = try FeedPost.Builder()
  .setMessage(message)
  .setVisibility(.Public)
    .build()

let createdFeed = try session.newsFeed.blockingCreate(feedPost)
let urlTags = createdFeed?.bodyMessageTagEntities?.urlTags

urlTags?.forEach {
    NSLog($0.title!)
}
let post = (new FeedPost())
    .setMessage("This is a web link shared with all https://blog.algolia.com/supporting-open-source-projects")
    .setVisibility(AccessControl.Public);
let feed = await session.newsFeed.create(post);
let post = (new FeedPost())
    .setMessage("This is a web link shared with all https://blog.algolia.com/supporting-open-source-projects")
    .setVisibility(AccessControl.Public);
session.newsFeed.create(post).then((feed)=> {

});

url_tag JSON object looks like this.

{
  "id": 5252505885935120000,
  "created_date": "2018-07-30T14:08:44Z",
  "content_type": "article",
  "original_url": "https://blog.algolia.com/supporting-open-source-projects",
  "original_host_url": "blog.algolia.com",
  "short_url": "https://u470584465854a194805-api.mysocialapp.io/5Qcvm_",
  "title": "Supporting the Open Source Software that makes us Great",
  "description": "At Algolia many of us are working with, contributing to, or benefitting from open source projects on a daily basis. We’re all about the tools that help us to get the job done, and get it done right…",
  "preview_url": "https://blog.algolia.com/wp-content/uploads/2018/04/Blogpost-KB-Open-Source.jpg",
  "start_index": 35,
  "end_index": 91,
  "access_control": "PUBLIC",
  "text": "https://blog.algolia.com/supporting-open-source-projects",
  "entity_type": "URL_TAG",
  "displayed_name": "Supporting the Open Source Software that makes us Great",
  "id_str": "5252505885935120741",
  "partner": false,
  "type": "URLTag",
  "original_url_to_display": "blog.algolia.com/supporting-open..",
  "is_partner": false
}

Tracked URL is short_url: https://u470584465854a194805-api.mysocialapp.io/5Qcvm_ this is super useful if you need to rewrite URL. Please contact us to get more information about this.