Macros

When ICApp executes, each Trigger or Action receive or send data. Received data or status of sending can be utilized to configure the ICApp. For example, if you create a ICApp 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 file to be copied. So Macros allow you to access these type of data by allowing you to specify a parameter name.

When creating/designing your ICApp, you have to create & test Nodes (steps) of the ICApp 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 a latter steps of the ICApp graph to configure those Nodes. Macros also allow you to access individual field values of your data.

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

How Macros are represented?

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

  • node-name: This represents app, service or device Node in the ICApp 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 Gmail example, you may have test/sample received data for new emails would be something like (simplified version):

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

so when you try to 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 email title
  • {{#google-mail:1.attachments[0].filename}} : contain attachment file name, here attachments is a array to hold multiple attachments if your emails have received with multiple of them.

To configure google-drive Node 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 a latter steps of the ICApp graph, you have to click the double down arrow sign shown on the right most side of each configuration parameter input box. for example see following figure:

Select Macro

For more information how to create and configure similar ICApp you can refer to our Services Integration Guide

Substitution in Selection drop downs (or Combo Boxes)

Selection drop downs (or Combo Boxes) has 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” 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 {{#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 August 17, 2022