Message-only mode

Produce an event with arbitrary structure, usually incorporating upstream data.

Features 

Emit an event with data of any type – an object, a list, text, etc. Hardcode data, or refer to upstream data using formula expressions.

Looping 

You can also configure the action such that instead of producing a single event, it can produce an event based on each element of a list or object. Looping helps you to easily transform, filter or reduce incoming events.

  • Specify the path to a field in an incoming Event that contains a list or an object and Tines will invoke the action for each element of the list or object.

  • When specifying the output event payload, a LOOP object will be provided for each loop iteration. The LOOP object will contain:

    • value – The current value in the loop.

    • index – The current index in the loop.

    • key - When iterating over key/value pairs in an object, this is the current key in the loop. This will be absent when iterating over a list.

    • previous_result – The result of the previous iteration.

  • A single output event will still be emitted.

  • The payload of the output event will always be a list. It can potentially contain NULL elements.

Loop size limits
  • A loop can only be ran on a list or an object that contains fewer than 20,000 elements.

  • If you wish to loop over a list or object that contains more than 20,000 elements, it is recommended that:

    • The CHUNK_ARRAY function is used to break the list into a list of smaller lists.

    • An Explode Mode Event Transformation action is used to emit an event for each of the smaller lists.

    • The lists contained in each emitted event can be looped over without exceeding the loop size limit.

Configuration Options 

  • mode: 'message_only'

  • payload: a string or object which will be included in the emitted event. Only the payload contents will be included in the output event.

  • loop: (Optional) Specify the name of a field in an incoming event that contains a list or an object.

Example Configuration Options 

Include a key and message object in the emitted event.

{
  "mode": "message_only",
  "payload": {
    "message": "This is an automatically generated message from Tines",
    "another_message": "This is another message from Tines. The time is: <<DATE('now', '%Y-%m-%d %H:%M')>>."
  }
}

Include a simple message in the emitted event.

{
  "mode": "message_only",
  "payload": "This is an automatically generated message from Tines"
}

Looping 

Given the incoming Event below, generate a message for each element in the list.

{
  "numbers": [1, 2, 3]
}
{
  "mode": "message_only",
  "loop": "<<numbers>>",
  "payload": "This is message # <<LOOP.index>>, value=<<LOOP.value>>"
}
[
  {
    "message": "This is message #0, value=1"
  },
  {
    "message": "This is message #1, value=2"
  },
  {
    "message": "This is message #2, value=3"
  }
]

Given the incoming Event below, generate a message for each element in the object.

{
  "teams": { "team_1": "value_1", "team_2": "value_2" }
}
{
  "mode": "message_only",
  "loop": "<<teams>>",
  "payload": "This is message #<<LOOP.index>>, key=<<LOOP.key>>, value=<<LOOP.value>>"
}
[
  {
    "message": "This is message #0, key=team_1, value=value_1"
  },
  {
    "message": "This is message #1, key=team_2, value=value_2"
  }
]
Was this helpful?