Send to Story

The Send to Story action allows you to send data to a sub-story where it can be further processed.

Sub-stories are special stories in Tines that can be used to perform a common action or set of actions. Use the Send to Story action to send data to an 'analyze URL' sub-story or a 'deprovision user' sub-story.

⚠️Warning

Features 

  • Send event data to sub-stories where it can be processed.

  • Select from a list of sub-stories or define a formula function to specify the story name or ID

  • After selecting your sub-story, the action will populate with the inputs required to send to the sub-story

  • If the send to story action does not send all required inputs to a sub-story, it will fail

Configuration Options 

  • story: Provide the ID of the story to which data should be sent. Use the STORY formulas expression (<<STORY.story_name>>) to easily refer to your story of choice.

  • payload: Provide data that should be sent to the sub_story. Include information from upstream events by specifying a wrapped JSONPath.

  • send_payload_as_body: (Optional) True by default. When set to false, the payload emitted by the action is not nested under a body key.

  • send_to_test: (Optional) False by default. When set to true, allows sending an event to the test story when change control is enabled

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

Entry Action Events 

An entry action's event payload will include additional, non-configurable fields that will be sent from Send To Story action:

  • #action_id = The ID of the Send to Story action in the calling story

  • #event_id = The event ID received by the Send to Story action in the calling story if such event exists.

Emitted Events 

Events emitted by the Send to Story action will contain information returned by the sub-story's exit action.

Looping 

You can also configure the action for array processing using the LOOP action option. Looping helps you to easily process an array and transform, filter or reduce incoming events.

The loop will be processed serially in order to preserve the ordering of the array for event output.

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

  • 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.

  • A single output event will be emitted to the Send to Story action containing an aggregate of the loop results for the array.

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

  • The loop option is only available on a top level Send to Story action. It cannot be configured for a nested send to story.

  • As with normal StS configuration the sub-story input action must be a webhook type action and the output action must be a message-only mode event transformation action.

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

  • If you wish to loop over a list 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.

Loop error handling
  • If one index in the array produces a failure, the loop processing is stopped and an error is logged / indicated to the user.

  • Error path handling is required if it is necessary to proceed with loop processing so should be built into the story.

Example Configuration Options 

Send a single URL to a sub-story to analysis.

{
  "story": "<<STORY.analyze_url>>",
  "payload": {
    "url": "http://evil-site.net"
  }
}

When resolving the story name the system first looks in the current team, then for any stories that are globally enabled for Send to Story.

Send the same URL for analysis, but this time use the ID of the story.

{
  "story": 7,
  "payload": {
    "url": "http://evil-site.net"
  }
}

Looping 

Given the incoming StS below, process each element in the list and output an aggregated event result containing the payload message for each element in the list.

{
  "numbers": [1, 2, 3]
}
{
  "story": "=STORY.test_loop"
  "loop": "=numbers",
  "payload": "Message: This is index # <<LOOP.index>>, value=<<LOOP.value>>"
}
[
    "message": "Message: This is index #0, value=1",
    "message": "Message: This is index #1, value=2",
    "message": "Message: This is index #2, value=3"
]
Was this helpful?