Message-only mode

Add text or an object to the incoming event.

You can also configure the action such that instead of being run once for an incoming event, it can be run for every element of a list or object (this can be a list or an object in the incoming event, or a Liquid expression producing a list/object). Use loops to easily transform, filter or reduce incoming events.

Features 

  • Add text or an object to the incoming event.

  • Optionally use Liquid templating to build text.

Looping 

  • 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: {{ 'now' | date: '%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?