Skip to content

Instantly share code, notes, and snippets.

@dbuos
Created June 2, 2021 01:46
Show Gist options
  • Select an option

  • Save dbuos/62df809c9a58222a53ac26ecce722328 to your computer and use it in GitHub Desktop.

Select an option

Save dbuos/62df809c9a58222a53ac26ecce722328 to your computer and use it in GitHub Desktop.
var flow_example = [0, ":block", [[ //Start of block 0
//Action
[1, ":send_command", ["cmd_name", {age: "ctx.human.age"}, "service0"]],
//Action
[2, ":query_pet", ["query_pet", {id: "ctx.human.petId"}, "target0"]],
// Action "Rule"
[3, ":delay", [{time: 7000}]],
// High level action
[4, ":send_email", [{template: "contact", name: "#ctx.human.name"}]],
// High level Action
[5, ":tag_human", [{tag: "contacted"}]],
// If Structure Flow Control
[6, ":if", [ //Start of IF 6
//IF Condition (May be a string too)
[":<", "#ctx.human.age", 25],
//True Action (Individual action)
[7, ":send_email", [{template: "contact", name: "#ctx.human.name"}]],
//False Action (Block action)
[8, ":block", [[ //Start of Block 8
//Some Action
[12, ":send_command", ["cmd_name", {age: "ctx.human.age"}, "service0"]],
//Other Action
[23, ":query_pet", ["query_pet", {id: "ctx.human.petId"}, "target0"]],
// Wait for Structure Flow Control
[11, ":wait_for", [ //Start of wait_for 11
//Condition to wait
["event_name1", "prop_event", "#ctx.human.id", 50000],
//True Action
[12, ":send_email", [{template: "contact", name: "#ctx.human2.id"}]],
// False Action (Maybe not present)
[13, ":noop", []]
]]//End of wait_for 11
]]] //End of Block 8
]] //End of IF 6
]]] //End of block 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment