Content Types

This specification is a work in progress and is subject to change without notice.

Although is not part of the core protocol, this page suggests some common message content types that can be reused in the implementations of the protocol.

Chat State

Allows the chat clients to exchange information about conversation events.

MIME type

                    application/vnd.lime.chatstate+json
                

JSON Schema

                    
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "ChatState",
    "type": "object",
    "properties": {
        "state": {
            "enum": [
                "starting",
                "composing",
                "paused",
                "deleting",
                "gone"
            ]
        }
    },
    "required": [ "state" ]
}

                

Properties

  • state - The current chat state. The possible values are:
    • starting - The other chat party started a new chat a conversation.
    • composing - The other party is typing.
    • paused - The other party was typing but stopped.
    • deleting - The other party is deleting a text.
    • gone - The other party left the conversation.

Example

                    
{
    "from": "jesse@breakingbad.com/junkyard",
    "to": "heisenberg@breakingbad.com",
    "type": "application/vnd.lime.chatstate+json",
    "content": {
        "state": "composing"
    }        
}

                

Collection

Represents a collection of documents.

MIME type

                    application/vnd.lime.collection+json
                

JSON Schema

                    
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Collection",
    "type": "object",
    "properties": {
        "itemType": {
            "type": "string",
            "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
        },
        "total": {
            "type": "integer"
        },
        "items": {
            "type": "array",
            "items": {
                "type": "object"
            }            
        }
    },
    "required": [ "items", "itemType" ]
}

                

Properties

  • itemType - The media type of all items of the collection.
  • total - The total of items in the collection. The count refers to the original source collection, without any applied filter that may be applied in the items on this collection.
  • items - The collection items.

Example

                    
{
    "from": "ww@breakingbad.com",
    "to": "jesse@breakingbad.com",
    "type": "application/vnd.lime.collection+json",
    "content": {
        "itemType": "text/plain",
        "items":[
            "methylamine",
            "acetic acid",
            "phenyl acetic acid"
        ]
    }        
}

                

Document select

Aggregate a list of document options for selection. This type is similar to the select, but allows generic documents to be defined in the select header and options, instead of plain text.

MIME type

application/vnd.lime.document-select+json

JSON Schema

                    
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Select",
    "type": "object",
    "properties": {
        "scope": {
            "enum": [
                "transient",
                "persistent",
                "immediate"
            ]
        },
        "header": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
                },
                "value": {
                    "type": "object"
                },
                "required": ["type","value"]
            }        
        },
        "options": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "order": {
                        "type": "integer"
                    },
                    "label": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
                            },
                            "value": {
                                "type": "object"
                            },
                            "required": ["type","value"]
                        } 
                    },
                    "value": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
                            },
                            "value": {
                                "type": "object"
                            },
                            "required": ["type","value"]
                        } 
                    },
                    "required": ["label"]
                }
            }
        }
    }
    "required": [ "options" ]
}

                

Properties

  • scope - The scope which the select options is valid. This property hints to the destination of the select when the sender is able to receive and understand a select option reply. The possible values are:
    • transient - The select is transient and its valid during a temporary conversation scope. This is the default scope.
    • persistent - The select is persistent and its valid in any time for the specific sender.
    • immediate - The select is valid only valid for the current scope.
  • header - The select header document.
  • options - An array with the available select options. This property is mandatory. Each item in the array define the following properties:
    • order - The option order number.
    • label - The option label document. This property is mandatory. It have the following properties:
      • type - The media type of the document.
      • value - The actual document JSON.
    • value - The option value to be returned to the caller. If not defined, no value should be returned.
      • type - The media type of the document.
      • value - The actual document JSON.

Example

                    
{
    "from": "ww@breakingbad.com",
    "to": "jesse@breakingbad.com/junkyard",
    "type": "application/vnd.lime.select+json",
    "content": {
        "header": {
            "type": "text/plain",
            "value": "Do you wanna cook crystal meth?"
        } 
        "options": [
            {
                "order": 1,
                "label": {
                    "type": "text/plain",
                    "value": "yes"
                }
            },
            {
                "order": 2,
                "label": {
                    "type": "text/plain",
                    "value": "np"
                },
                "value": {
                    "type": "application/x-action-call-phone+json",
                    "value": {
                        "phoneNumber": "911"
                    }
                }
            }
        ]
    }        
}

                

Location

Represents a geographic location information.

MIME type

                    application/vnd.lime.location+json
                

JSON Schema

                    
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Location",
    "type": "object",
    "properties": {
        "latitude": {
            "type": "number"
        },
        "longitude": {
            "type": "number"            
        },
        "altitude": {
            "type": "number"            
        },
        "course": {
            "type": "integer"            
        },
        "speed": {
            "type": "number"            
        },
        "accuracy": {
            "type": "number"            
        }
    },
    "required": [ "latitude", "longitude" ]
}

                

Properties

  • latitude - The latitude, in degrees. Latitude can range from -90.0 to 90.0. Latitude is measured in degrees north or south from the equator. Positive values are north of the equator and negative values are south of the equator.
  • longitude - The longitude, in degrees. The longitude can range from -180.0 to 180.0. Longitude is measured in degrees east or west of the prime meridian. Negative values are west of the prime meridian, and positive values are east of the prime meridian.
  • altitude - The altitude, in meters.
  • course - The course, in degrees. The course can range from 0 to 360.
  • accuracy - The location accuracy, in meters.

Example

                    
{
    "from": "heisenberg@breakingbad.com",
    "to": "jack@breakingbad.com",
    "type": "application/vnd.lime.location+json",
    "content": {
        "latitude": 34.988889, 
        "longitude": -106.614444
    }        
}

                

Represents an external link to a media content.

MIME type

                    application/vnd.lime.media-link+json
                

JSON Schema

                    
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "MediaLink",
    "type": "object",
    "properties": {
        "type": {
            "type": "string",
            "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
        },
        "size": {
            "type": "integer"
        },
        "aspectRatio": {
            "type": "string"
        },        
        "uri": {
            "type": "string"            
        },
        "title": {
            "type": "string",
            "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
        },
        "text": {
            "type": "string"
        },
        "previewType": {
            "type": "string",
            "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
        },
        "previewUri": {
            "type": "string"            
        },
    },
    "required": [ "uri" ]
}

                

Properties

  • type - The media type of the linked media.
  • size - The media size, in bytes.
  • aspectRatio - The media display aspect ratio. Common values are 1:1, 4:3 and 16:9.
  • uri - The link URI.
  • previewUri - The link preview URI. It can be used to provide a preview of the media, like a thumbnail image.
  • previewType - The type of the link preview.
  • title - The link title text.
  • text - The link description text.

Example

                    
{
    "from": "jesse@breakingbad.com",
    "to": "ww@breakingbad.com",
    "type": "application/vnd.lime.media-link+json",
    "content": {
        "uri": "http://flowjournal.org/wp-content/uploads/2012/11/breakingbad.png",
        "text": "Nice pants"
    }        
}

                

Select

Aggregate a list of options for selection.

MIME type

application/vnd.lime.select+json

JSON Schema

                    
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Select",
    "type": "object",
    "properties": {
        "scope": {
            "enum": [
                "transient",
                "persistent",
                "immediate"
            ]
        },
        "text": {
            "type": "string"
        },
        "options": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "order": {
                        "type": "integer"
                    },
                    "text": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string",
                        "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
                    },
                    "value": {
                        "type": "object"
                    },
                    "required": ["text"]
                }
            }
        },
    },
    "required": [ "options" ]
}

                

Properties

  • scope - The scope which the select options is valid. This property hints to the destination of the select when the sender is able to receive and understand a select option reply. The possible values are:
    • transient - The select is transient and its valid during a temporary conversation scope. This is the default scope.
    • persistent - The select is persistent and its valid in any time for the specific sender.
    • immediate - The select is valid only valid for the current scope.
  • text - The select question text.
  • options - An array with the available select options. This property is mandatory. Each item in the array define the following properties:
    • order - The option order number.
    • text - The option label text. This property is mandatory.
    • type - The media type of the option value.
    • value - The option value to be returned to the caller. If not defined, the value of order (if defined) or text should be returned.

Example

                    
{
    "from": "ww@breakingbad.com",
    "to": "jesse@breakingbad.com/junkyard",
    "type": "application/vnd.lime.select+json",
    "content": {
        "text": "Do you wanna cook crystal meth?",
        "options": [
            {
                "order": 1,
                "text": "yes"
            },
            {
                "order": 2,
                "text": "no",
                "type": "application/x-action-call-phone+json",
                "value": {
                    "phoneNumber": "911"
                }
            }
        ]
    }        
}

                

Text

Plain text content type. It's intended to be used for general text messages, like SMS or messenger clients.

MIME type

text/plain

Properties

  • content - The escaped value of the message text.

Example

                    
{
    "from": "jesse@breakingbad.com/junkyard",
    "to": "heisenberg@breakingbad.com",
    "type": "text/plain",
    "content": "Yeah, bitch! Magnets!"
}

                

Represents an external link to a website page.

MIME type

                    application/vnd.lime.web-link+json
                

JSON Schema

                    
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "WebLink",
    "type": "object",
    "properties": {
        "uri": {
            "type": "string"            
        },
        "title": {
            "type": "string",
            "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
        },
        "text": {
            "type": "string"
        },
        "previewType": {
            "type": "string",
            "pattern": "^[-\w]+/[-\w.]+(\+\w+)?$"
        },
        "previewUri": {
            "type": "string"            
        },
        "target": {
            "enum": [
                "blank",
                "self",
                "selfCompact",
                "selfTall"
            ]
        }        
    },
    "required": [ "uri" ]
}

                

Properties

  • uri - The link URI.
  • previewUri - The link preview URI. It can be used to provide a preview of the web page, like a thumbnail image.
  • previewType - The type of the link preview.
  • title - The link title text.
  • text - The link description text.
  • target - The sets the target for showing the web link content.
    • blank - Indicates that the web link content should be displayed in a new container.
    • self - Indicates that the web link content should be displayed in the current container.
    • selfCompact - Indicates that the web link content should be displayed compacted in the current container.
    • selfTall - Indicates that the web link content should be displayed tall in the current container.

Example

                    
{
    "from": "jesse@breakingbad.com",
    "to": "ww@breakingbad.com",
    "type": "application/vnd.lime.web-link+json",
    "content": {
        "uri": "http://www.amc.com/shows/breaking-bad",
        "title": "Breaking Bad",
        "text": "The sun has set on Walter White's empire. See how it was built."
    }        
}