In addition to integrations, we provide utilities that make integration Flows easy. Generally, Flows created are independent of each other. They do not share any data between them. However, there can be instances where the output generated as a result of a Trigger or an Action in one Flow is required by another Flow as input.
Similar to this, in a single Flow, output or input associated with an Activity may be required at the next instance that Activity runs. This can be because of a change or update happening to that same record. To address this kind of situation, you can use the Storage App.
An example can be, a Flow that creates contact with Sendinblue Trigger and MailChimp Action. When a contact gets updated in the Sendinblue app which was created before activating the integration, then adding an update subscriber Action will crash the integration. A solution is to track all the contacts that were synced using this Flow. This can be done with the help of a Storage step.
The Storage App
Storage App is a System App that allows you to store and get data entries from our data store. The data is usually stored in the form of key-value pairs which is easy to retrieve later. A key-value pair is persistent between runs in an integration and allows us to find the previous records of contacts or any data attribute that is stored in our app. This helps the Integry app identify the incoming sets of information in every call/run of an integration and makes a connection between them.
Let's get to the process of adding a Storage App to your Flow.
Adding the Storage App
The above image shows a Guided Flow with Sendinblue Trigger and MailChimp Action.
Add a new step to this Flow. Search and select the Storage app.
There are several Action types in the Storage app. Here, we will first discuss in detail the ones that are commonly used.
1. Set Value
This sets the value in the storage to be retrieved later by the key. For any incoming data in an integration, you can set its value in our data store and save it.
For our current example, whenever a new contact is added in Sendinblue, it will also be added in MailChimp. That contact will also be run through the Storage app. It will create a unique key-value pair for that contact in Integry’s storage. The simplified steps for this in the Flow will look similar to what is shown below.
The Trigger for new contact at the first step will generate an Object for that contact as output. This will have the attributes for that contact including a unique contact ID. We will make use of that in the Storage step. This contact is created in MailChimp through the Action step. Finally, that contact’s entry will be saved in our data store through the Set Value Storage step. In the fields for this step, you will need to provide a Key and its associated Value. Along with the rest of the fields, they will look as shown below.
Going into the details of these fields.
- Namespace: This is a medium for separating key-value pairs. It allows you to save the same key multiple times in an integration with different values. This is useful when your Flow deals with multiple distinct types of entities and there is a chance that they might have some overlap in their Key entry. So you can store similar Keys in different namespace segments and they will not override each other's values.
- Key: This is the name of the unique key to identify the operation.
- Value: This is the value of the unique key.
- Is key case insensitive ?: By default, the entries stored in key are case sensitive. You can provide a value 'true' in this field to make it case insensitive.
- Is value case insensitive ?: By default, the entries stored in value are case sensitive. ou can provide a value 'true' in this field to make it case insensitive.
In the above fields, a unique key is being assigned to the new contact through the “Key” field. For Sendinblue, it is the contact ID. The “Value” field saves the email address for that same contact as the value entry.
Providing these two things will store this entry in the storage app as a key/value pair in our data store. An example of this saved in the data store will look like this:
2. Get Value
This Action type retrieves the data stored in ‘value’ against any given ‘key’. If there is a change or modification to an entry that previously exists in our integration, we can fetch the already present entry through this Get Value Action.
For the running example, if you update a contact in Sendinblue, we will need to find the corresponding contact in MailChimp so that the change can reflect there as well. The Get Value Action will first fetch that contact’s record from Integry’s data store and then lookup against that record in MailChimp’s contact list to find that existing contact. After this, the update contact Action will be applied to that contact. This provides the required mapping for an Action execution on a contact in Sendinblue and its reflection in MailChimp.
The simplified steps for this in the Flow will look like this:
In the fields for Get Value, you will only need to provide a key that was previously stored for the contact.
The fields for this are similar to the Set value fields. except:
Return 404 Error?: This will abort the use case if we don't have any matching value.
The contact ID attribute of the “Contact updated” Trigger will be given in the key field. This will return the email address of this updated contact as the “Value” entry against this key. If we assume that this is the same contact as created above, the contact ID will be the same and will be given in the key. The data entries for the key and value pair will be as shown below.
Returned result: email@example.com
The above contact will then be updated in MailChimp as the Action.
Good to know: The storage app also creates a duplicate entry when setting a key-value pair. In this entry, it reverses the data store in “key” and the corresponding “value”. This allows you to enter both the key or its value in the Get Value “Key” field to look up for an entry. For example, if you provide the email address of the contact in the above “Key” field, it will return the original key (contact.id) to you from storage.
3. Delete Key
You can also delete a key from the storage. This is useful for many cases like when a contact is deleted or its email is updated, we no longer need the key for the previously stored contact. So, the delete key Action takes a key as input and deletes all entries of that key from storage.
For the running example, deleting a contact in Sendinblue and its reflection in MailChimp will have the following steps in the Flow.
When you delete a contact in Sendinblue (Trigger), the Get Value Action will first fetch that contact’s record from Integry’s data store and then lookup against that record in the MailChimp. The delete contact Action will then delete that contact from MailChimp. After this, the delete key storage Action will delete the stored key-value pair against that contact from our data store.
Just like Get Value Action, in the fields for Delete Value Action, you only need to provide a key in the “Key” field. The storage app will then delete the entries against that key.
The key/value pairs for multiple contacts can also be stored at a time in the data store in a similar manner as the above Action types. There are a few other Action types in the storage app as well that are similar to the ones explained above. These are briefly talked about below.
4. Bulk Set
This is similar to the Set Value Action, except that it allows you to set multiple key-value pairs for incoming data in a single step execution. You need to provide a JSON payload as its input field. The payload should contain an object having multiple key-value pairs.
5. Bulk Set from JSON
This Action has the same purpose as bulk set, but instead of one JSON object, it allows you to provide a JSON array of objects as the input to save in the data store. You can give paths to the properties in those objects to use as key and value.
6. Get Value Bulk
This is similar to the Get Value Action, except that it allows you to provide multiple keys in the form of an array and returns the values stored against all of them in a single execution.
7. Set Value - Poll Bookmark
In our integrations, poll-based Triggers store the tracking property value of the processed objects in the Storage app. However, these values are stored separately from the data stored via other Storage app Actions. In some cases, you might want to manually set a value in the poll storage. This Action allows you to do that.
In the configure fields section, you need to provide the activity ID of the Trigger in the Flow as well as the tracking property value that you want to set.
8. Delete Value - Poll Bookmark
This Action type is similar to the one discussed above. It allows you to delete a value from the poll-specific storage. In the fields. you need to provide the Trigger Activity ID and tracking property value that you want to delete.
A detailed guide on how to create your Flows from scratch can be found here.