Product Messages

The Product Message represents a product for sale. Unlike many other informational Messaging Experiences, this does not depend upon the Standard Message Container which provides a standard layout of information. There is a lot of custom information about a product that needs to be shown. Typically this Message would be used to allow a user to purchase, bookmark or perhaps return a Product. Such actions are attached using the Buttons Message.

Standard Product Message
Name Required Type Description
name N String Name of your product
brand N String Brand of your product
description N String One or more lines of product description
price N Number Cost per unit of this product
quantity N Number Number of units of the product; defaults to 1
currency N String ISO 4217 currency codes; default is USD
url N String URL to open if user clicks for more information
image_urls N String[] Array of URLs to a product pictures. Currently only the first is rendered.

Message Part Roles:

Name Required Type Description
options No Choice Message A Choice Message representing a Product Option. There can be many such options.

A Product Model can be created via the following SAPI request:

	"sender_id": "layer:///identities/frodo-the-dodo",
	"parts": [
        "mime_type": "application/vnd.layer.product+json;role=root",
  			"id": "layer:///messages/GENERATE_A_UUID/parts/" + id1,
        "body": JSON.stringify({
          "name": "Apple 2 plus desktop computer",
          "brand": "Apple",
          "description": "This computer will last you a lifetime.  Its processing power far outweighs your old calculator.  Its DOS based interface is the most modern available anywhere in the world. Keyboard is built-in and ergonomic.",
          "image_urls": [""],
          "price": 175,
          "quantity": 3,
          "url": ""
    }, {
        "mime_type": "application/vnd.layer.choice+json;role=options;parent-node-id=" + id1,
        "id": "layer:///messages/c2486d60-c040-4014-8c66-76e63ded80b1/parts/" + id2,
        "body": JSON.stringify({
          "label": "RAM",
          "type": "label",
          "allow_reselect": true,
          "response_name": "ram",
          "enabled_for": "layer:///identities/174fe653-85a1-4667-b166-9c35c1caa0b7",
          "choices": [
            {"id": "small","text": "2K"},
            {"id": "medium","text": "4K"},
            {"id": "large","text": "8K"}
    }, {
        "mime_type": "application/vnd.layer.initialresponsestate-v1+json;role=initial_response_state;parent-node-id=" + id2,
  			"id": "layer:///messages/GENERATE_A_UUID/parts/GENERATE_A_UUID",
        "body": JSON.stringify([