In addition to integrations, we provide utilities that make integration flows easy. Typically, templates 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 template is required by another template as input.
Similar to this, in a single template, an 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 situation, we bring you the Storage App.
The Storage App
This is a utility 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.
To add the Storage step in your template, add an action step and select “Storage” from the list of apps.
There are several action types in the storage app. Here, we will first discuss in detail the ones that are most used in the template.
1. Set Value
For any incoming data in an integration, you can set its value in our data store and save it.
Let’s say that you create an integration for contacts sync between Salesforce and SurveyMonkey. Whenever a new contact is added in Salesforce, it will also be added in SurveyMonkey. 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 template will look similar to what is shown below.
The trigger for new contact at Step 0 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 SurveyMonkey through the action step at Step 1. Finally, that contact’s entry will be saved in our data store through the Set Value storage step at Step 2. 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,
By default, the entries stored in your key and value pairs are case sensitive. You have the option of making them case insensitive as well. To do that, you just have to provide the value “true” in their respective fields.
In the above fields, a unique key is being assigned to the new contact through the “Key” field. For Salesforce, 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 Salesforce, we will need to find the corresponding contact in SurveyMonkey 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 SurveyMonkey’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 Salesforce and its reflection in SurveyMonkey.
The simplified steps for this in the template 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.
Shown above in the key field is a variable similar to what was shown in the Set Value example. The contact ID attribute of the “Contact updated” trigger at Step 0 is given in this 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: firstname.lastname@example.org
The above contact will then be updated in SurveyMonkey as in the Step 2 of the template shown above.
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 Salesforce and its reflection in SurveyMonkey will have the following steps in the template.
When you delete a contact in Salesforce (trigger at step 0), the Get Value action at step 1 will first fetch that contact’s record from Integry’s data store and then lookup against that record in the SurveyMonkey. The delete contact action at Step 2 will then delete that contact from SurveyMonkey. After this, the delete key storage action at step 3 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 template 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
Learn how to use adapters in your templates.
A detailed guide on how to create your templates from scratch can be found here.