Objects simplify and automate data mapping between triggers and actions. They enable one-click-mapping at the template level. When a trigger and an action consume the same object, you do not need to map the individual fields in templates. You just map the object and the fields are auto-filled. Objects create a relationship between actions and triggers.
Objects are a step towards smarter templates. The field mapping shifts from templates to activity creation, to the developers’ end. So, to simplify the template creation process for both a developer and a non-developer. Now, when you create templates, you will not be required to know trigger output details, just map the object.
To make this concept clearer, here’s a deeper dive:
The objects we introduced on our platform are mostly generic such as Contact, Task, User, Event, etc. Their attributes are derived from the most commonly used data fields in integrations such as for a Contact Object we’ll have fields like First Name, Last Name, Email. Or for Task Object it’ll be Task Name, Task Created At, Project Name, Project ID, etc. This is to shift the load of mapping fields in templates from your end to our end. Also, to take a step towards smarter templates.
Now, once your Activity produces a Contact Object, you can connect it with any Activity of any App that can consume the Contact Object. This makes Template creation much faster.
There are two types of objects
- Input Objects
- Output Objects
We will see the details below.
Adding an Output Object in an Activity
The process to add an output object to an action or a trigger is almost the same. Right now, we will walk through an example of adding an object to the trigger.
Let’s say you are creating a trigger “Contact Created” in your app. Whenever a contact is created in your app, Integry is notified. The result of the trigger is a new Contact Object. We then send this object to the next action in your workflow.
Setting up the Trigger Output Object
While you’re creating the trigger endpoint, you specify the output object of the trigger. This means you can tell the system what kind of object is expected from the trigger.
There is an Output Object field in the endpoint form as shown below. Output Object field displays the available objects in a dropdown menu. Also, you specify the action that is performed on the object via the Output Action field such as create, update, delete, etc. So, in the running example, our object will look like as shown below.
Once you select the object, the attributes of the object are populated in the Object Output field in a form of the JSON object. You need to provide the values of these attributes, received from your app’s API. Let’s say the contact information received in the payload from your app is
At first, the Object Output code snippet will look like as shown below. This is an autogenerated JSON of the standard fields of our Contact Object.
You will enter the dynamic values received in the request using the requestBody object, as shown below. Essentially you’re mapping your values with our Contact Object’s attributes.
The output objects can be added in the actions the same way. But when you come to the Object Output field for an action output object, the values are assigned to the object attributes through the response object as shown below
Adding an Input Object in an Action
Generally, Triggers send Objects and Actions consume Objects. Let’s say you are creating an action, “Create Contact” in your app. As an action starts from our platform, it takes both input and output objects, unlike triggers. The input object basically tells the action what kind of object does the action consumes.
Setting up the Input Object
When creating an action, under the Actions tab in your app you specify the Input Object and the action to be performed on that object as shown below.
For the running example, we took the Contact as an input object and the action we perform on the object is Create, that is creating the contact.
Mapping the Object Fields with Activity Fields
When you select the Input Object of an action, the data attributes of the objects are available to the action’s activity fields in a drop-down menu. As you add an activity field, you can see an Object field, which displays the attributes of the input object as shown below.
The name of the activity field is Test First Name while it’s machine name is test_f_name, as indicated above. An additional field appears here, the Object field where you map the object attribute to the activity field. For all the activity fields you add in the action, you map each activity field.
The next step is to learn, how data is mapped in Templates via Objects.