To see some examples of attachments see Sending Attachments.
Structure of an Attachment
The code block below shows in complete detail every element that can go inside an attachment. Examples of creating different kinds of attachments is covered under Sending Attachments.
|String||No||A unique identifier for the attachment as provided by your app.|
App id for the app that sent the attachment. Any value that your app provides for this attribute will be overwritten with your app's actual id by Flock.
|String||No||The title of the attachment.|
|String||No||A longer description of the attachment.|
|String||No||A hex value (e.g. "#0ABE51") for the color bar.|
|Views||No*||Provides user visible views for the attachment. See below for more details.|
|String||No||The URL to open when user clicks an attachment, if no widget or FlockML is provided. When generating a URL Preview this should always be set.|
An array of download objects. Note: As of now this array should contain at max one object.
Each object has the following attributes:
An array of attachment buttons. Each object has the following attributes:
* While neither
downloads is required, one of these must always be present in the attachment.
Flock will select one of the objects inside
Views to display on the chat screen. See Sending Attachments for the precedence order of these views.
Displays an attachment widget inside the chat screen in desktop, or pops up a modal when the attachment is opened on mobile.
Displays the HTML string inside the chat screen in desktop (using an iframe). It has the following attributes:
|String||No*||A string containing FlockML content. It is displayed inside the chat screen on both desktop and mobile.|
An image for the attachment. This is an object with two attributes:
The value for both these attributes is an
* At least one of these objects must be present
|String||Yes||The URL of the image|
|Number||No||Width of the image in pixels|
|Number||No||Height of the image in pixels|
This object describes the action that should be triggered when a user clicks on an attachment button.
It can be used to open a widget:
Or open a URL in the browser:
Or send an event to the event listener URL:
It requires at least one attribute,
The configured action. It can have any one of the following values:
In addition, if
openWidget, these attributes may be required:
The widget URL
|String||Yes||How the widget should be opened on the desktop. It can be either |
|String||No||How the widget should be opened on mobile. There is only one possible value for this, |
openBrowser, these attributes may be required:
The URL to open in the browser
|Boolean||No||Whether context should be sent to the browser or not. Defaults to |