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.
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.

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.