Introduction
FlockML is an XML based markup language used to show rich text messages and attachments in Flock.
<flockml>Hello <strong>foobar</strong>, Welcome to <a href="https://flock.co/">Flock!</a></flockml>
Its salient features are:
- Renders natively on both desktop and mobile
- Inspired by HTML, so you will be familiar with many FlockML's elements already
- Elements for actions specific to Flock, like linking to a user or triggering actions like opening a widget
Elements
flockml
The root element for FlockML. Any FlockML document that doesn't have <flockml> as its root is considered invalid.
Example |
---|
<flockml>Hello World</flockml> |
a
The anchor element <a>
defines a hyperlink. Clicking on this opens a URL in the browser.
Example | Rendered |
---|---|
<a href="">Hello World</a> | Hello World |
Attributes
Name | Required | Description |
---|---|---|
href | Yes | The URL to link to |
em
The emphasis element <em> is used to emphasise text and is typically italicized.
Example | Rendered |
---|---|
<em>Hello World</em> | Hello World |
i
The italics element <i> is used to italicize text.
Example | Rendered |
---|---|
<i>Hello World</i> | Hello World |
strong
The strong element <strong>
gives text strong importance, and is typically displayed in bold.
Example | Rendered |
---|---|
<strong>Hello World</strong> | Hello World |
b
The bold element <b> is used to display text in bold.
Example | Rendered |
---|---|
<b>Hello World</b> | Hello World |
u
The underline element <u>
renders text with an underline.
Example | Rendered |
---|---|
<u>Hello World</u> | Hello World |
br
The line break element <br>
produces a line break in text (carriage-return).
Example | Rendered |
---|---|
Hello<br/>World | Hello World |
user
This element can be used to link to a Flock user.
Example | Rendered |
---|---|
<user userId="u:guid">FirstName LastName</user> | FirstName LastName |
Attributes
Name | Required | Description |
---|---|---|
userId | Yes | Should be a user identifier. |
- If the Flock client knows the user's name, it will ignore any text content inside. Otherwise, it will display the text content if present.
- If the Flock client doesn't know the user's name, and no text content is provided, it will display "Unknown User".
action
The action
element allows an app to trigger a client action. The associated event is client.flockmlAction.
Example |
---|
click <action id="act1" type="openWidget" url="<url>" desktopType="sidebar" mobileType="modal">here</action> to launch a widget. |
Attributes
Name | Required | Description |
---|---|---|
type | Yes | The type of action to trigger. Should be one of:
|
id | No | An identifier for the action. It is included in the payload for client.flockmlAction as the actionId attribute. |
If type
is openWidget
, the following attributes should also be provided:
Name | Required | Description |
---|---|---|
url | Yes | The widget URL |
desktopType | Yes | The type of widget in desktop. Should be either modal or sidebar . Defaults to modal . |
mobileType | Yes | The type of widget in mobile. If provided, it should be set to modal . |
If type is openBrowser
, the following attributes should be provided:
Name | Required | Description |
---|---|---|
url | Yes | The URL to open |
sendContext | No | Whether to send context to the URL or not. Should be either true or false . Default value is false . |
If type is sendEvent
, no other attribute needs to be provided.