Teams regularly need to perform a task or a set of tasks in multiple different stories. For example, a threat intelligence story and a phishing response story may use the same procedure to analyze a URL, similarly, a user de-provision story and a vulnerability management story may require the creation of a Jira ticket.
Rather than creating the same set of actions in multiple stories (thus violating the DRY-principle), Send to Story allows users to create "sub-stories" to which events can be sent from other stories. When an event is received by a sub-story, the sub-story will perform its action and when finished, emit an event from the calling action.
Sub-stories
Sub-stories work the exact same as normal Tines stories. The only difference is that a sub-story has an Entry action and an Exit action. The entry action must be a webhook-type action and the exit action must be a message-only mode event transformation action.
Enabling a story for Send to Story (creating a sub-story)
From a storyboard, when no actions are selected, in the properties panel there is a checkbox to enable a story for Send to Story, when this checkbox is clicked, you'll be asked to specify entry and exit actions. A sub-story can only have one entry and one exit action.
Entry action
When an event is sent to a sub-story, the entry action will emit an event to its receiver actions. Entry actions must be of type Webhook.
Exit actions
The Exit actions are the last action in a sub-story and must be message-only mode event transformation actions. The content specified in the Exit action will be emitted by the action that originally sent the event to the sub-story.
Access
Controls who is allowed to send to this story. Either select everyone to allow any team to send to this story, or select the team that owns the story to restrict access.
Sending to a sub story
When you need to send data to a sub story, you should use a Send to Story action with the STORY
key in formulas. For example, say we have a sub-story called Substory
we would send events to this sub-story with the following Send to Story action:
{
"story": "<<STORY.substory_name>>",
"payload": {
"url": "http://example.com"
}
}
The entry action in Substory will then emit an event similar to the below:
{
"receive_url_to_analyze": {
"url": "http://example.com",
"#event_id": "1029",
"#action_id": "21"
}
}
When this event has run down the story, an event will be emitted at the calling Send to Story action that matches the exit action's configuration.
For example, let's say the HTTP Request action above was named "analyze URL" and we have the following exit action defined in Substory
:
{
"mode": "message_only",
"uppercase_url": "<<UPCASE(receive_url_to_analyze.url)>>"
}
When the sub-story is complete analyze URL
will emit an event similar to the below:
{
"analyze_url": {
"uppercase_url": "HTTP://EXAMPLE.COM"
}
}