Entity Service
Use the entity
service to allow your app to render a Structured Object created by the REST API within a message:
The following methods are available on the entity
service:
registerRenderer()
Register a renderer for a type
of entity:
Parameter
Type
Description
type
String
The type of entity that will be rendered by your application. Entities are namespaced using reverse domain name notation, e.g. com.symphony.address
.
options
Array
Reserved for future use.
serviceName
String
The name of the application service that will be used to render this entity.
You must implement the render()
method on the specified application service. This method will be invoked when the associated entity is rendered in the Symphony client.
render()
Renders an entity given its type and data values:
Parameter
Type
Description
type
String
The type of entity to be rendered.
data
Object
The data for the specific entity being rendered. This data is specified when the message is created.
The render method returns an object with the following fields:
Parameter
Type
Description
template
String
An ExtensionML string that specifies the object's presentation.
In addition to ExtensionML tags, iframe tags are also supported.
data
Object
An object containing the data referenced by the template. Described in entity advanced templating.
entityInstanceId
String
A unique identifier used to reference a specific entity.
update()
Effectively re-renders an entity with new template and data objects given its entityInstanceId:
Parameter
Type
Description
entityInstanceId
String
The instance id of the entity to be updated
data
Object
The data for the entity being updated
Sample Renderer Application
pause() and resume()
The 'pause' and 'resume' methods are optional. If you choose to use the methods, implement them on the renderer service. These methods will be invoked when the associated entity is rendered in the Symphony client.
Entities are checked periodically (every two seconds) if they are visible on the screen. If an entity is completely visible, a resume event is triggered to the renderer service of this entity. If an entity is partially visible or completely hidden, a pause event is triggered instead.
Example: • Pause event: responsible for stopping/pausing a video transmission (video iframe). • Resume event: responsible for playing the video.
Note: An entity is considered not visible when scrolling the screen down/up or when changing the module (conversation) to a new chat room or screen.
If the entity has an iframeId
, it will be passed in the invocation of the methods, otherwise the entityInstanceId
will be used instead.
iFrame Tag Support
In addition to ExtensionML tags, iframe
tags are also supported in the template
parameter:
Last updated