File Messages

A File Message has a few uses:

  • Allow a user to drag and drop one or more files from their desktop and send them as Messages that recipients can open
  • Allow an application to send a reference to a file in its library, with accompanying descriptions
Name Required Type Description
mime_type Yes String application/vnd.layer.file+json
source_url Yes String URL to a remote file (should not be used if source is in use)
title No String Title for the File Message
author No String Rendered below the title
size No Number Represents the size of the file in number of Bytes
mime_type No String Indicates the MIME Type of the file referenced by source_url
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

SAPI payload for a File Message:

	"sender_id": "layer:///identities/frodo-the-dodo",
	"parts": [
			"id": "layer:///messages/GENERATE_A_UUID/parts/GENERATE_A_UUID",
			"mime_type": "application/vnd.layer.file+json;role=root",
			"body": JSON.stringify({
        "source_url": "",
        "mime_type": "text/plain",
        "title": "The Web XDK License"