Skip to content

Attributes

Attributes use data stores which are JSON documents. To get or set use JSONPath to refer to a specific location in the document. It is very similar to XPath for XML documents.

To get a value at a specific path use dot notation prefixed with the root, for example $.full.path.dots.

JSONPath information: * Tutorial at restfulapi.net * Online tester at jsonpath.com

Data mutations

Data mutations for DataSet

{
    path=JSONPath,
    value=Any
}

Data mappers for DataMap and DataMapContext

{
    from=JSONPath,
    to=JSONPath
}

DataGet

core.DataGet(query)

Get data for a user

  • query:String user query such as given user [..] and JSON path expression

Data for the query

DatatSet

core.DatatSet(userId, mutations)

Save data for a user

  • userId:UUID user id
  • mutations[] see above

Boolean

DataMap

core.DataMap(query, mappers)

This will use the mappers to update user attributes for each dispatch in the series.

  • query:String Dispatch query
  • mappers[] data mappers, see above

Data at the path or nil

DataMapContext

This will use the mappers to update user attributes for the context dispatch; this assumes the script was called by a dispatch lifecycle trigger.

core.DataMapContext(path)
  • mappers[] data mappers, see above

Data at the path or nil

Examples

Executed during a lifecycle trigger; copies data from the dispatch to the user attributes.

    core.DataMapContext(
        {from="$.height", to="$.intake.height"},
        {from="$.weight", to="$.tracking.weight"},
        {from="$.about", to="$.about.blurb"},
        {from="$.location", to="$.about.location"}
    )

Executed using a dispatch query.

    core.DataMap(
        "given tracker [intake]",
        {from="$.height", to="$.intake.height"},
        {from="$.weight", to="$.tracking.weight"},
        {from="$.about", to="$.about.blurb"},
        {from="$.location", to="$.about.location"}
    )