CeleryScript: How to refer to another sequence in the body of sequence


#1

I’ve taken a look at examples of CeleryScript at https://gist.github.com/RickCarlino/10db2df375d717e9efdd3c2d9d8932af#request-69 and https://developer.farm.bot/docs/celery-script. I have also seen the more complete list of formats at https://github.com/FarmBot/farmbot-js/blob/master/dist/corpus.d.ts.

But I still can’t find what the CeleryScript adds an existing sequence to the list of actions for a new sequence. Does anyone know how?

Alternatively, does anyone know how to get the CeleryScript or ID of a sequence that I can only see from the Web App?


#2

If you are using Chrome, you can open a console (Ctrl + Shift + J) and enter

JSON.stringify(Object.values(store.getState().resources.index.references).filter(x => x.kind.includes("Sequence") && x.body.name === "new sequence 1").map(x => x.body.body)[0], (k, v) => (k === "uuid" || (k === "body" && v.length == 0)) ? undefined : v, 2)

to get the the CeleryScript of a sequence (where new sequence 1 is the name of the sequence). It can be helpful to create a new sequence, add a step that you’d like to understand better, and view the CeleryScript via the method above. For example, adding the execute sequence step and running that code will return something similar to

[
  {
    "kind": "execute",
    "args": {
      "sequence_id": 123456
    }
  }
]

where 123456 is the ID of the sequence to be executed.