Skip to main content

Remote Procedure Calls (RPCs)

What are they?

  • Think of RPCs as sub modules that are called to help the main modules get the inputs they need
  • They CAN NOT be called inside the module itself, instead, they are called inside of the "Mappable Parameters" tab

How do I use them?

  • List Files
    • Call this using rpc://listFolders
  • List Folders
    • Call this using rpc://listFiles




List Files

Communication

Each number in the following ordered list is referring to a block in code

  1. This block grabs the parent workspace id and initializes a counter so that the RPC will know where it currently is when it iterates in block 2. It also determines the last string in the path so that block 2 knows when it is done iterating
  2. This block iterates through each string in the path to get the nodeId by it's name
    • It knows it is done when the lastNamePath is equal to its currentName
    • This "condition": "{{if(parameters.path !== '/', true, false)}}" will prevent it from running when there is no path entered so as to save an API call
  3. This will show the user the next layer in the path

Notice

"response": {
     "iterate": "{{body}}",
     "output": {
          "label": "{{item.name}}",
          "value": "{{item.id}}",
          "file": "{{if(item.systemType === 7, true, false)}}"
      }
}
  • Our API responds with an array instead of an object, as a result Integromat does not know how to output the data
    • This means that we need to iterate through each element in the array and output the information we require
    • This "file": "{{if(item.systemType === 7, true, false)}}" is what determines if a proper file has been selected. If it evaluates to false then the module cannot proceed and will run the RPC again until it returns true

 

List Folders

Communication

Each number in the following ordered list is referring to a block in code

  1. This block grabs the parent workspace id and initializes a counter so that the RPC will know where it currently is when it iterates in block 2. It also determines the last string in the path so that block 2 knows when it is done iterating
  2. This block iterates through each string in the path to get the nodeId by it's name
    • It knows it is done when the lastNamePath is equal to its currentName
    • This "condition": "{{if(parameters.path !== '/', true, false)}}" will prevent it from running when there is no path entered so as to save an API call
  3. This will show the user the next layer in the path

Notice

"response": {
     "iterate": "{{filterFolders(body)}}",
     "output": {
          "label": "{{item.name}}",
          "value": "{{item.id}}"
      }
}
  • Our API responds with an array instead of an object, as a result Integromat does not know how to output the data
    • This means that we need to iterate through each element in the array and output the information we require
    • An IML function is called on the body to filter out all file node objects from the body