Message parts

Each Message contains a parts property with an array of MessageParts.

The following JSON represents a typical Message Part; referred to throughout this document as MessagePart:

{
      "id": "layer:///messages/940de862-3c96-11e4-baad-164230d1df67/parts/0",
      "mime_type": "text/plain",
      "body": "This is the message.",
      "updated_at": "2017-09-09T04:44:47+00:00"
}
Name Type Description
id string Layer ID to identify the Part
mime_type string The MIME Type (“text/plain”, “image/png”, etc)
body string The message text (“Hello world”, “Bonsoir”, etc)
encoding string (optional) “base64” if body is base64-encoded
content Content Sending Rich Content requires a Content object; use this for larger payloads
updated_at string (optional) output only field of the time of the last change of the message part

The mime_type property

The mime_type describes the type of content contained in the message part. You can use any value for the MIME type; it’s up to your application to determine how to display each type.

The body property

The body represents the actual content of your message part. For a “text/plain” message part, the body might be “hello world”. For an “image/png” message part, it might be a base64-encoded image string. For other formats, it might contain a JSON string.

Each message part is limited to 2KB for the unencoded body size. If sending a base64-encoded body, it will be decoded, and then rejected if the unencoded body exceeds 2KB.

If using the content property, the body should be omitted or have a value of null.

The encoding property

Each message part can have an optional encoding property. Typically this field will be null, but if sending/receiving data that is base64-encoded, the encoding value of “base64” should be used. This property only affects the body, so if you are using the content property, the encoding should be ignored.

The content property

Due to the 2KB limit on body size, message parts that are larger than 2KB will use the Rich Content APIs which create a Content object that allows the larger content to be stored on a separate server. If a Content object is not provided, this field will be null.

The updated_at property

Property describing the last server time when the message part has been altered in conjunction with the message