Skip to content

Switch JSON schema

Switch logic

A definition of the logic that a switch uses when determining which actions to execute when an event is triggered.

Properties

NameTypeDescriptionRequired
versionstringThe Yetto format which this schema abides by.
Format: "date"
yes
eventsobjectThe events that this switch will listen for.
yes

Additional Properties: not allowed Example

{
    "events": {}
}

events: object

The events that this switch will listen for. Must be one of the following strings:

  • "conversation.created"
  • "conversation.updated"
  • "conversation.closed"
  • "conversation.reopened"
  • "conversation.assigned"
  • "conversation.unassigned"
  • "conversation.labeled"
  • "conversation.unlabeled"
  • "conversation.destroyed"
  • "conversation.*"
  • "inbox.created"
  • "inbox.updated"
  • "inbox.renamed"
  • "inbox.destroyed"
  • "inbox.*"
  • "message.created"
  • "message.updated"
  • "message.destroyed"
  • "message.*"
  • "organization.created"
  • "organization.updated"
  • "organization.renamed"
  • "organization.destroyed"
  • "organization.*"
  • "plug_installation.created"
  • "plug_installation.updated"
  • "plug_installation.destroyed"
  • "plug_installation.*"

Additional Properties: not allowed

events object

Properties

NameTypeDescriptionRequired
conditionsobjectA list of conditions that must be met for the actions to be executed.
no
actionsobject[]Lists the actions which the switch will execute when the event is triggered.
yes

Additional Properties: not allowed Example

{
    "conditions": {},
    "actions": [
        {}
    ]
}

################################ events.*.conditions: object

A list of conditions that must be met for the actions to be executed.

Properties

NameTypeDescriptionRequired
ifstringExecutes the action if the result of this logic is true.
unlessstringExecutes the action if the result of this logic is false.

Additional Properties: not allowed ################################ events.^*$.actions[]: array

Lists the actions which the switch will execute when the event is triggered.

Items

Item Properties

NameTypeDescriptionRequired
namestringA name describing the action.
no
usesstringThe name of the action to execute.
Enum: "send_to_plug", "send_to_webhook", "apply_labels"
yes

No properties.

IF object

  • has properties, where
    property uses is apply_labels

THEN

Properties

NameTypeDescriptionRequired
addstring[]The list of label paths to add.
removeThe list of label paths to remove. If a string, must be *, indicating all labels should be removed.

Either one of add or remove must be present.

IF property uses is send_to_plug

THEN

Properties

NameTypeDescriptionRequired
toobjectyes
withobjectno

Example

{
    "to": {},
    "with": {}
}

IF property uses is send_to_webhook

THEN

Properties

NameTypeDescriptionRequired
toobjectyes
withobjectno

Example

{
    "to": {},
    "with": {}
}

No properties.

0.then.add[]: array

The list of label paths to add.

Items

Item Type: string

1.then.to: object

Properties

NameTypeDescriptionRequired
plug_idstringyes

1.then.with: object

No properties.

2.then.to: object

Properties

NameTypeDescriptionRequired
plug_idstringno

2.then.with: object

No properties.

3.then.to: object

Properties

NameTypeDescriptionRequired
plug_idstringyes

3.then.with: object

No properties.