How To Dig Through Workflow Output Data

How To Dig Through Workflow Output Data

Written by: Colby Allen, Technical Support Engineer @ Kustomer

Workflows are one of the most powerful features of the Kustomer platform. You can build a Workflow to automate just about any process you see fit,  from eliminating tedious manual tasks, to integrating with another connected app outside of Kustomer. This can sometimes be a double-edged sword, as Workflows can get very robust and dense quite quickly. It becomes imperative to understand what data you are sending from one step to the next within your Workflow. 

As you create steps that build upon one another, and take data from the previous step to the next, it is important to know and confirm that you are passing down data that is exactly what you want. This can become quite difficult when you’re not entirely sure what data you are passing down and how to sift through the long payload. Accessing the view logs within a Workflow, and diving into the output data, can make building your Workflows much easier. This way, you can ensure you are targeting the correct data attributes for each step along the way. 

How To Get To View Logs

Great! You have a Workflow built, you’ve added a handful of action steps, and even some conditionals. You turn it on and run the event to trigger the Workflow, and check back on the conversation or action… and nothing happened. Now what? How are you supposed to figure out what went wrong and how to fix it? This is where our view logs come in handy, which includes the input and output data for each step of the Workflow you just built out. 

Clicking on the “view logs” button on the bottom left of your screen brings up the events log and the debug mode. But at this point you won’t see any data. First, you’ll need to click on the “refresh” icon and then trigger your Workflow again. After triggering it, you will now see the most recent log events, up to 100 of them if you have that many. Once you see the events, you can click on one, and it will allow you to view the log details, and then you can see which step of your Workflow it made it through. If it successfully made it to the end, all the steps will be green. If not, it will show you which step it stopped on with a red dot. From here, you can click on any step, and the right side panel will bring up the input and output data.

Input vs Output Data 

Before we get too deep into how to dig through the input and output data, let's discuss a few differences between the two that will be helpful for troubleshooting your Workflows. Input data is what gets passed from the previous step, or passed into the Workflow in the trigger step. For example, if you’re looking at the input data on step #3 of your Workflow, you are viewing the output data from step #2. 

Conversely, the output data is the data that gets sent to the next step. Again, if in step #2 you are taking data and applying any actions such as appending tags to a conversation, or routing that conversation to a specific queue, you will see that applied in the output data. Now that output data will move down the Workflow, and become the input data for the next action step you have set up.

Digging Through Output Data

Now that we have established the differences between the input and output data, what are we looking at? There are numbers, symbols, quotation marks and all kinds of characters. But how does this help you? What you’re looking at is a data block that gives key information about the data you are passing through your Workflow.  Even more importantly, it shows which parts of that data block were changed when going from one step to another. This can be incredibly useful, as you can see exactly what changed at which point in the Workflow, or what update happened to the customer, conversation, message, or object. 

Diving deeper, let's go over the output data and what attributes can be found. In this simple scenario, let's say we have a conversation that starts as a chat conversation and changes to an email conversation. You would like to re-assign the conversation to a different team or user when that happens. A customer chats in, your chat team handles the chat and then sends a follow-up email to say thanks, and the user marks the conversation done. A day or so goes by and the customer responds to the email looking for a bit more help, but the original user needs to reassign it to the correct team or user. This process only takes a few clicks for the user, but why not automate it?

We build a simple Workflow that is triggered on a conversation update, then we add a few steps to assign the conversation to a new team, new agent, or put it in a new queue. But how do we use the output data to sift through the conversation attributes and see if this chat conversation is now a chat and an email conversation? We can navigate to the conversation update step in the view logs and scroll through the data to a specific attribute called “changes”. This changes object will do exactly what is described, showing what changes were made to the conversation. 

In this example, you will see the channels attribute with a before and after view. Specifically, the before will be an array with “chat” inside it, and the after will be an array with “chat” and “email” inside it. The image below shows the “changes” attribute where I copied and pasted it into a text editor just to view the entire object. 


This is a very simple example, but you can see how it can help when you get into more complex Workflows and build steps like a generic regex match, or you would like to take data and add it to a note to post to a conversation. 

Tips & Tricks

I’ve talked about using the “changes” object as a source of truth when building Workflows, and how useful it can be. It can be useful in many scenarios, mainly when businesses are building automations wherein data gets automatically changed. Below is another very useful part of the output data. Looking at the “lastMessageIn” attribute, you can make use of the time attributes Kustomer offers. Seeing things like what time a conversation was last updated, or the last time a customer sent a message, can be extremely useful, and take manual tasks off a users’ plate when automated. 

Looking through the output data can be overwhelming, as the data block is so long, and at times daunting when you don’t know what you are looking for. One thing I like to do when building Workflows is highlight the entire output data block and copy and paste it into a Word document or code editor. For me personally, I am a visual learner and like being able to see the full picture. But another useful trick is to use either Command + F on Mac or Ctrl + F on Windows within the output data. That way, you can search for key phrases or specific attributes. This is helpful if you have something specific you are looking for. Reading through the data will take practice for you to get comfortable with, and give you a better understanding of the specific data that is useful to your organization, as you will see the same attributes continuously. 

When building out Workflows, it can often get frustrating when things aren’t working how you would expect them to and you’re not sure why. By looking at view logs and output data, you have a source of truth that can reveal when and where things are breaking down. If you would like to dive deeper into anything that has been discussed, or have any general questions about how to better understand Workflows as a whole, feel free to reach out to or visit our knowledge base at Kustomer University is another great resource, with videos and tutorials to help you better utilize everything Kustomer has to offer.