Link Messages

A Link Message has a few uses:

  • A simple way to send a link to users
  • A framed summary of a web page, article or other online content consisting of a picture, title, description and the url itself.
Example of a Link Message without any Details
Example of a Link Message showing an Article with Details
Field Required Type Description
mime_type Yes String application/vnd.layer.link+json
url Yes String The URL to open; used by the open-url action, and by the URL Enrichment Integration (optional)
title No String Title for the Link Message
description No String Rendered below the title
author No String Rendered below the description
image_url No String URL to an image to render over the title
custom_data No Object Data that will not be understood by any Layer provided Renderer, but which will allow additional context to be stored in the Message so your server can better understand it when next your server sees the Message

If url is provided, but no title, description, author or imageUrl then this Link Message will render as a conversational message and show the url value directly.

SAPI payload for creating a Basic Link Message:

{
	"sender_id": "layer:///identities/frodo-the-dodo",
	"parts": [
		{
			"id": "layer:///messages/GENERATE_A_UUID/parts/GENERATE_A_UUID",
			"mime_type": "application/vnd.layer.link+json;role=root",
			"body": JSON.stringify({
        "url": "https://layer.com"
      })
		}
	]
}

SAPI payload for a Full Link Message:

{
	"sender_id": "layer:///identities/frodo-the-dodo",
	"parts": [
		{
			"id": "layer:///messages/GENERATE_A_UUID/parts/GENERATE_A_UUID",
			"mime_type": "application/vnd.layer.link+json;role=root",
			"body": JSON.stringify({
        "url": "https://layer.com",
        "title": "This is not a terribly short title"
      })
		}
	]
}