Macros

When an executes, each Trigger or Action receives or sends data. Received data or status of sending can be utilized to configure the . For example, if you create an to ‘check your GMail account for new emails and copy any attachments received in them to a Google Drive’, then you should know what are the attachment files you have received, so that you can configure Google Drive service stating what files need to be copied. Macros allows you to access these types of data by allowing you to specify a parameter name.

When creating/designing your , you have to create & test Nodes (steps) of the which represent your app, service or device. As you create & test your Nodes, Macros are constructed from your test data. You can access these Macro parameter names from previous Nodes in latter steps of the graph to configure those Nodes. Macros also allows you to access individual field values of your data.

Though, Macros represent test/sample data at design time, they represent real data when are executed.

How Macros are represented?

Macros are represented as {{#node-name:index.param-names}}. Macro contains a parameter name delimited by {{# and }}. where:

  • node-name: This represents app, service or device Node in the graph. e.g. google-mail Node as a Trigger and google-drive Node as an Action
  • index: This is the index of the Node in the graph, e.g. if you have two slack nodes to send messages, then one would have value 1 & other value 2.
  • param-names: A hierarchy of parameter names as they found in the data JSON (see ICApp’s data formats)

If you take the above example with Gmail, your test/sample received data for new emails would be something like (simplified version):

{
    "title": "sample title", 
    ....
    "attachments":[
        {
            "filename": "image.png",
            ...
        }
        ...
    ]
    ...
}

When you configure google-drive Node, you would have following Macros:

  • {{#google-mail:1}} : Contain full data received from Gmail as JSON
  • {{#google-mail:1.title}} : Contain only the title of email
  • {{#google-mail:1.attachments[0].filename}} : Contain the attachment file name. Here, attachments is a array to hold multiple attachments if your emails have received with multiples of them.

When configuring google-drive Node, you may need to copy the attachment. You can use {{#google-mail:1.attachments[0].filename}} in the google-drive Node configuration against the file name.

To select Macro in latter steps of the graph, you have to click the double down arrow sign shown on the right most side of each configuration parameter input box. For example, it will be as follows:

Select Macro

For more information on how to create and configure similar ICApps you can refer to Services Integration Guide

Substitution in Selection drop downs (or Combo Boxes)

Selection drop downs (or Combo Boxes) have names & values of your related data for the given field. Values are shown in parenthesis (if different from name). When using Macros in selection drop downs, you must use Macros having values of the field. e.g. if drop down has “Departments” as the name & ID values in parenthesis, the Macro such as {{#conName:1.department.id}} will allow you to substitute the id values for the field and Macro such as {{#conName:1.department.name}} will not resolve to the correct value expected, as the field need the id (values are shown in parenthesis) instead of the name.

Last modified September 2, 2024