Events

In Touch Portal there are events which will be triggered when a certain state changes. You can create events for the plugin as well. These events can be triggered when a linked state is changed.

Please note: when a user adds an event belonging to a plugin, it will create a local copy of the event and saves it along with the event. This means that if you change something in your event the users need to remove their instance of that event and re-add it to be able to use the new additions.

Key Type Req. API Description
id Text yes 1.0 This is the id of the event. When the event is triggered, Touch Portal will send this information to the plugin with this id.
name Text yes 1.0 This is the name in the action category list.
format Text yes 1.0 This is the text the action will show in the user generated action list. The $val location will be changed with a dropdown holding the choices that the user can make for the status.
type Text Yes 1.0 Currently the only option here is "communicate" which indicates that the value will be communicated through the sockets.
valueChoices Array Yes 1.0 These are all the options the user can select in the event.
valueType Text Yes 1.0 Currently the only option here is "choice" which indicates that the type of event will be an dropdown with predefined values.
Text Yes 7.0 The "text" option is now also available. This will check whether the state is the same as the user specified value in the text box.
valueStateId Text Yes 1.0 Reference to a state. When this states changes, this event will be evaluated and possibly triggered if the condition is correct. Can be empty but is mandatory.
subCategoryId Text No 7.0 This attribute allows you to connect this event to a specified subcategory id. This action will then be shown in Touch Portals Action selection list attached to that subcategory instead of the main parent category.
localstates Array No 10.0 Array of all Local State objects related to this event. These can be selected by the user only when the event is used and added. If not added, the local states will not be shown in the state selector popups.


Local States Object

The local states object represents the representation and visualisation within Touch Portal. The id is the reference when used as a tag in text. The actual setting of the local states object when the event is triggered are described in the communication section.

Key Type Req. API Description
id Text yes 10.0 This id of the local state.
name Text yes 10.0 This name of the local state.
parentCategory Text yes 10.0 The parent category the local state belongs to.

Event Object JSON Structure

{
  "id":"event002",
  "name":"On breakfast eating",
  "format":"When we eat $val as breakfast",
  "type":"communicate",
  "valueType":"choice",
  "valueChoices": [
    "Apple",
    "Pears",
    "Grapes",
    "Bananas",
  ],
  "valueStateId":"fruit"
}

This shows a JSON of an event.