How to Optimize Tines Stories - Tips and Tricks for Managing Stories Efficiently

Written by Colleen GallagherCustomer Success Engineer, Tines

As mentioned in the first blog of this series, how you build and manage Tines stories varies based on your needs and priorities across your team or company. In part I, we shared tips and tricks for building. Here we'll focus on managing stories efficiently, including error handling, maintainability (or readability), and continuous improvement.

Error handling 

Another way of optimizing stories is not just for performance, but also for troubleshooting. This involves making sure that error handling is built into your stories so that if and when an error occurs, it's quick and easy to find and fix it.

1. Emit no match in the trigger action 

As mentioned previously, trigger actions have the option for emitting an event downstream even if a previous event’s data does not match any of the rules set out in the trigger. This is another way of capturing errors without completely stopping the story.

2. HTTP request actions options 

Within the HTTP request action, there are options that include retries, retry on status, log error on status, and timeout. Each of these options let you determine when errors should be created on certain status codes of HTTP requests, and if timeout and/or number of retries should be changed to account for one off issues that are resolved by just trying again.

3. Action monitoring 

Tines has built-in monitoring at the story and action level. From the main story panel on the right, you can set to alert on any event failure in a story. This can be an email alert or a webhook action, giving you the ability to build a story that handles any action failure in any story.

At the action level, under the “status” tab on the righthand pane, you have more options in terms of when alerts take place. This includes if no events are emitted in a given period of time or if any event is emitted, in addition to action failure.

4. Webhooks and send to story 

As noted above, you have the option to send an alert to a webhook if any action in a story fails. This could be implemented across all your stories to have one main story to handle and process all errors. Additionally, you could leverage the “send to story” capability for common errors that may arise in multiple stories. For example, a specific status code on an API response.

5. Error functions 

There are additional Tines functions that have been added to help with error handling. These include IF_ERROR() and ERROR(). These allow for the option of generating a custom error in the logs of an action on a certain condition (i.e. that red dot) or offer a default value if the first value causes an error. If an error occurs in an HTTP request action, a story will still continue, but if an error occurs in any other action type (often event transform actions), the story will stop. In conjunction with “customize output”, the IF_ERROR() can be used to let a story continue even if a given action fails while adding context to a specific error. The DEFAULT() function is another way to provide a “default” value if the first possible output is NULL, thus avoiding any potential errors or pauses in a story run.

Maintainability/readability 

Tines makes it easy to build any automation, but with any software, there will always be improvements to be made in the future. This is why maintaining Tines stories in an efficient and easy-to-understand way is crucial, especially if multiple people across a team need to be able to update or troubleshoot any given story.

1. Consistent and unique naming across actions 

It's important to be consistent with naming. This means each action should have a unique title that gives context to what the action is trying to do. You can also add additional context via the description element in each action, and within notes elements outside the action itself.

2. Balance of nesting functions vs one function per event 

Tines makes it easy to nest functions together if you prefer to condense actions. This is done by either nesting the functions within parentheses or using the pipeline syntax (|>and % ). One other option is to leverage local values to perform upfront calculations. These methods do have downsides as it may make it harder for a person not involved in the building process to follow and understand that logic that is happening. The method that you choose is dependent on the audience of these stories.

3. Visual organization of actions 

A great way to visually organize is to use grouping. The actions grouped together still contribute to the total number of actions in your story, but it greatly reduces the visual complexity and you only have deal with one input and output.

Note: Grouping actions does not cut down on events. It's only for condensing actions visually in storyboard view.

Continuous improvement 

There are other indicators when a story should be optimized. They include:

  • large amount of branches

  • issues with infinite looping

  • issues with pagination and other types of looping

    • here is a helpful story on how to paginate APIs

  • black holes (i.e. somewhere an event might get sent and never come out of)

Final thoughts 

Wherever possible, try to limit the amount of event data that gets created and processed in a story. A great example is for a phishing use case specifically, as these stories have a large amount of ingest. It's recommended to make use of deduplication and other forms of filtering out data, like whitelisting IP addresses or email domains saved as a resource, that doesn't need to be analyzed downstream in your story.

As with all aspects of Tines, there will always be further iteration, whether it’s more features, more training, and more techniques to optimize stories - so stay tuned! We will continue to help you become the best builders that you can be!

Built by you, powered by Tines

Talk to one of our experts to learn the unique ways your business can leverage Tines.